Rotate Touchscreen with RaspberryPi

After a lot of trying, I found out to do the following for rotating the screen for the Touch

Here is my current solution. I work with the Raspberry Pi 3 Model B+ in combination with the official Raspberry touchscreen. Un fortunately the casing/screen is upside down. Therefore, the screen inclusive the touch need to rotate.

Teh following instructions solves everything I need for GUI environment but it’s still showing the splash screen upside down etc.
My solution will only work if you are using autologin to your GUI.

1. Create a file that a) rotate the screen and b) change the input rotation to the same.
Example /usr/local/bin/rotate-180

#!/bin/bash
xrandr --output DSI-1 --rotate inverted
# sleep a while so that the rotation can take affect
sleep 1
# map input to output rotation.
xinput --map-to-output "generic ft5x06 (79)" DSI-1

2. Make it executable.

sudo chmod +x /usr/local/bin/rotate-180

3. Autostart that file when the GUI gets started using a xdg autostart file.
example ~/.config/autostart/rotate-screen.desktop

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=Xrandr DSI-1 1 Rotation
Icon=preferences-desktop-screensaver
Exec=/usr/local/bin/rotate-180
Terminal=false
OnlyShowIn=LXDE;OPENBOX;GNOME;KDE;
Categories=System;Security;Utility;
StartupNotify=false
X-KDE-autostart-after=panel
X-OPENBOX-Autostart-enabled=true

4. Reboot and live happily ever after.


Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.