Press "Enter" to skip to content

How to rotate your touch screen

bist 0

So. Maybe you have your shiny new Magic Mirror online and you got all those cool modules installed. Since you are using a touch screen you probably are going to want to use your touch screen. And if you have your display in portrait mode…well chances are your touch interface will not have rotated with your screen. In other words, your touch will not appear on the screen where you expected.

Well, here you go. This is for a 90 degrees rotation
sudo nano /boot/config.txt 
add line: “display_rotate=1” at end of file
Save and exit
sudo reboot
The display will be rotated, but the touch screen is still reversed.
sudo apt-get install xserver-xorg-input-libinput
sudo mkdir /etc/X11/xorg.conf.d
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
Find the section “libinput touchscreen catchall”
add: Option “CalibrationMatrix” ” 0 1 0 -1 0 1 0 0 1″   for 90degree rotation
add: Option “CalibrationMatrix” ” 1 0 1 0 -1 1 0 0 1for 180degree rotation
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Save, Exit and Reboot
Bobs you uncle, enjoy

Leave a Reply

Your email address will not be published. Required fields are marked *