[GUIDE] Touch screen rotation on Volumio 3

So having tried Volumio 3 x86 on a Dell Venue 8 pro 5585 I’ve noticed that the older screen rotation tutorials won’t work. So I did some tinkering, used some parts of the older tutorials and decided to write a new one. Since this solution doesn’t use any platform specific things it will likely work on other platforms as well. All you need is to enable SSH and connect with an ssh client. let’s get started!

First of all we’re going to install 2 packages:

sudo apt update
sudo apt install xrander xinput

Now we want to know the name of the touch input device. To do this we will execute the following commands:

sudo export DISPLAY=:0
sudo DISPLAY=:0 xinput list

This will give an output that looks something like this:

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Wacom HID 4809 Finger id=9 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Wacom HID 4809 Pen id=8 [slave keyboard (3)]
↳ Intel HID events id=10 [slave keyboard (3)]
↳ gpio-keys id=11 [slave keyboard (3)]
↳ gpio-keys id=12 [slave keyboard (3)]
↳ Dell WMI hotkeys id=13 [slave keyboard (3)]

In my case the touch input device is called ‘Wacom HID 4809 Finger’ ‘Coordinate Transformation Matrix’ Copy and store this value as you will need it later.

There’s one more thing we need to know and that’s the name of our primary display:

sudo xrandr

This will give you a very long output like:

Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 16384 x 16384
DSI-1 connected primary 1920x1200+0+0 left (normal left inverted right x axis y axis) 0mm x 0mm
1200x1920 60.00*+
1920x1200 59.88 59.95
1920x1080 60.01 59.97 59.96 59.93
1600x1200 60.00
1680x1050 59.95 59.88
1600x1024 60.17
1400x1050 59.98
1600x900 59.99 59.94 59.95 59.82
1280x1024 60.02
1440x900 59.89
1400x900 59.96 59.88
1280x960 60.00
1440x810 60.00 59.97
1368x768 59.88 59.85
1360x768 59.80 59.96
1280x800 59.99 59.97 59.81 59.91
1152x864 60.00
1280x720 60.00 59.99 59.86 59.74
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
1024x576 59.95 59.96 59.90 59.82
960x600 59.93 60.00
960x540 59.96 59.99 59.63 59.82
800x600 60.00 60.32 56.25
840x525 60.01 59.88
864x486 59.92 59.57
800x512 60.17
700x525 59.98
800x450 59.95 59.82
640x512 60.02
720x450 59.89
700x450 59.96 59.88
640x480 60.00 59.94
720x405 59.51 58.99
684x384 59.88 59.85
680x384 59.80 59.96
640x400 59.88 59.98
576x432 60.06
640x360 59.86 59.83 59.84 59.32
512x384 60.00
512x288 60.00 59.92
480x270 59.63 59.82
400x300 60.32 56.34
432x243 59.92 59.57
320x240 60.05
360x202 59.51 59.13
320x180 59.84 59.32
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)

You may need to scroll back. What’s important is which display is connected as primary. In my case it says DSI-1 connected primary so I know my display is called DS-1

Now we’re going to create a script directory and write a script that we want to execute at boot.

sudo mkdir /scripts
sudo nano /scripts/flipscreen.sh

This will present you with a text editor. Let’s write our script.

!/bin/bash
sleep 5
export DISPLAY=:0
xrandr --output YOUR_PRIMARY_DISPLAY --rotate left
xinput set-prop ‘Name of your touch input device’ 0 -1 1 1 0 0 0 0 1

Replace ‘Name of your touch input device’ with the actual name you copied earlier. In my case this would be ‘Wacom HID 4809 Finger’ ‘Coordinate Transformation Matrix’

**Replace YOUR_PRIMARY_DISPLAY with the actual name of your primary display. In my case this would be DSI-1

Now press ctrl+x and press y when prompted to save. What this script does is wait 5 seconds (you might want to experiment with this) as this is how long it takes from the screen going blank to putting the touch interface on it. After that it flips the screen with xrandr and the touch interface with xinput.

Now we have to make the script executable which we will do like this:

sudo chmod 755 /scripts/flipscreen.sh

Now it’s a good time to actually test if your script is working. Just enter the following:

sudo /scripts/flipscreen.sh

This should result in the screen rotating 270 degrees after 10 seconds. Try and see if all the buttons and menu options respond to touch input. If anything seems of it might be that the touch interface is not in sync with the screen. In that case you might have to do some adjustments. More info on that can be found here: X/InputCoordinateTransformation - Ubuntu Wiki and you can change the xrandr rotation from left to the following values: right, left, inverted and normal.

Assuming that you’ve got your script going we’re going to create a service by doing the following:

sudo nano /etc/systemd/system/touchscreen.service

Now we will be presented with the same text editor as before. We will put the following in our service:

flips the touchscreen
[Unit]
Description=ScreenFlip
After=default.target
[Service]
ExecStart=/scripts/flipscreen.sh
[Install]
WantedBy=default.target

Now press ctrl+x and press y when prompted to save.

What this service does is starting the first script we wrote once the Volumio touch interface starts to load.

Now let’s make the file executable by doing:

chmod 755 /etc/systemd/system/touchscreen.service

We’re almost done now. Let’s install the service so that it starts on boot.

sudo systemctl daemon-reload
sudo systemctl enable touchscreen.service

Now that’s it! Grab a coffee, reboot your system and see if it flips the screen at boot!

** If the screen doesn’t flip at boot or takes a while (up to 10 seconds to flip) you may need to adjust the sleep value in /scripts/flipscreen.sh

1 Like