- SSH into the pi
- Run
DISPLAY=:0 xrandr and note which display says connected. It should be DSI-1. The full output should look like Screen 0: minimum 320 x 200, current 800 x 480, maximum 7680 x 7680
HDMI-1 disconnected primary (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DSI-1 connected 800x480+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
800x480 59.93*+
- Run
sudo vim /usr/share/X11/xorg.conf.d/90-monitor.conf
- Paste the following into the file:
Section "Monitor"
Identifier "DSI-1"
# This identifier would be the same as the name of the connector printed by xrandr
# for example "DVI-I-1 connected primary" means that the identifier is "DVI-I-1"
# another example "Unknown19-1 connected primary" some GPIO screens identify as Unknown19
Option "Rotate" "inverted"
# Valid rotation options are normal,inverted,left,right
#Option "PreferredMode" "800x400"
# May be necessary if you are not getting your preferred resolution.
EndSection
You may have to modify some values. Save and exit.
- Run
DISPLAY=:0 xinput and note which name corrisponds to your touchscreen. The output should look like
Virtual core pointer id=2 [master pointer (3)]
Virtual core XTEST pointer id=4 [slave pointer (2)]
generic ft5x06 (00) id=6 [slave pointer (2)]
vc4-hdmi-0 id=7 [slave pointer (2)]
vc4-hdmi-1 id=8 [slave pointer (2)]
Virtual core keyboard id=3 [master keyboard (2)]
Virtual core XTEST keyboard id=5 [slave keyboard (3)]
vc4-hdmi-0 id=9 [slave keyboard (3)]
vc4-hdmi-1 id=10 [slave keyboard (3)]
- Run
DISPLAY=:0 xinput set-prop "generic ft5x06" 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 (changing the name if needed) and verify that your touchscreen works right
- Run
sudo vim /etc/udev/rules.d/51-touchscreen.rules and paste the following into it (changing the name as needed)
ACTION=="add", ATTRS{name}=="generic ft5x06 (00)", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1 0 0 1"
- Reboot and verify that everything worked