[TUTO] touchscreen rotations

Hi everyone!

After many hours to find the solution I finally found it!
And since I could not find a complete answer on this forum I decided to create a topic on the subject.
So here is a topic on How to rotate EVERY touchscreens.

1- Connect to volumio with ssh.

2- Got to:

sudo nano /boot/config.txt

And add this:


This rotate the picture at 270° but not the touch (for other rotations: display_rotate=1 —>90 degrees; display_rotate=2 —>180 degrees).
To do that you have to:

3- Update your system and install xinput:

sudo apt-get update
sudo apt-get install xinput

4- Check your device name:

sudo DISPLAY=:0 xinput list

You should see something like this:

volumio@mikhifi:~$ sudo DISPLAY=:0 xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ WaveShare WS170120 id=6 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
Here, the name of my screen is: WaveShare WS170120 (Don’t forget to write down the lowercase and upper case letters)

5- Now you just have to edit this file:

sudo nano ~/.xsessionrc

by adding this line:

xinput set-prop 'YOUR DEVICE NAME' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1

to rotate the touch at 270°.
If you need to turn it in another position read this: https://wiki.ubuntu.com/X/InputCoordinateTransformation

6- Now restart your system: the touchscreen should be in the good position.
NOTE: For those who have a waveshare touchscreen, you don’t need to replace the kernel file by the one given with the screen. For me it doesn’t work because of a version problem. So don’t use it it is totally useless.

Here we are! I hope this will help some of you :slight_smile:

1 Like