FYSETC / FYSETC-CTP40

This repo contains the infomations and drivers for FYSETC CTP40 display
10 stars 3 forks source link

About rotation #4

Closed 0r31 closed 3 years ago

0r31 commented 3 years ago

Hi guys,

First of all, thanks for the great work. I am running your screen on a Raspberry 4 2GB (so using the Pi4-64-beta folder) and it's working pretty well (just one small issue when installing the whole stuff, will send a PR).

My concern is about the rotation stuff. Indeed, when trying to run the rotation command (from ssh), i get the following error:

pi@raspberrypi:~ $ sudo ctp40-rotate left
Rotating display
Can't open display
Traceback (most recent call last):
  File "<stdin>", line 15, in <module>
  File "/usr/lib/python2.7/dist-packages/screenlayout/xrandr.py", line 43, in __init__
    version_output = self._output("--version")
  File "/usr/lib/python2.7/dist-packages/screenlayout/xrandr.py", line 64, in _output
    raise Exception("XRandR returned error code %d: %s"%(status,err))
Exception: XRandR returned error code 1: Can't open display

Setting matrix: 0 -1 1 1 0 0
Unable to connect to X server
Saving touch settings to /etc/udev/rules.d/98-ctp40-calibration.rules

Will dig into that, but if you have any advice, it would be welcome ;)

Regards, Orel

0r31 commented 3 years ago

Hi again,

Setting the display to use before running the command (as stated in the rpi4 folder) seems to solve the issue even if errors are raised.

pi@raspberrypi:~ $ DISPLAY=:0.0 ctp40-rotate left
Rotating display
Traceback (most recent call last):
  File "<stdin>", line 15, in <module>
  File "/usr/lib/python2.7/dist-packages/screenlayout/xrandr.py", line 43, in __init__
    version_output = self._output("--version")
  File "/usr/lib/python2.7/dist-packages/screenlayout/xrandr.py", line 64, in _output
    raise Exception("XRandR returned error code %d: %s"%(status,err))
Exception: XRandR returned error code 1: No protocol specified
Can't open display :0.0

Setting matrix: 0 -1 1 1 0 0
Saving touch settings to /etc/udev/rules.d/98-ctp40-calibration.rules
0r31 commented 3 years ago

To get rid of the python error, one must set the XAUTHORITY variable (again, as stated in the rpi4 folder):

pi@raspberrypi:~ $ DISPLAY=:0.0 ctp40-rotate left
Rotating display
Saving display settings to /usr/share/dispsetup.sh
Setting matrix: 0 -1 1 1 0 0
Saving touch settings to /etc/udev/rules.d/98-ctp40-calibration.rules