Template: Touch Rotating
Rotation
Note: To rotate the touch, you can re-compile the kernel as well. There is an example for reference (use 7inch HDMI LCD (C).)
Display Rotating
To rotating the display, you can append this statement to the config file
display_rotate=1 #1: 90; 2: 180; 3: 270
Reboot the Raspberry Pi
sudo reboot
Touch rotating
With the operation above. The screen could rotate in display. However, the touch works improperly. To rotate the touch as display, you could do as below:
1. install libinput
sudo apt-get install xserver-xorg-input-libinput
2. create an xorg.conf.d folder
sudo mkdir /etc/X11/xorg.conf.d
3. copy file 40-libinput-conf to the folder which we created
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
4. Append a statement to touchscreen part of the file as below:
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
sudo reboot
After completing these steps. The LCD could rotate 90 degree both display and touch.
Note:
90 degree: Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
180 degree: Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
270 degree: Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"
Demo video about rotating