<<Previous | TOC | Next>>
I bough the 7" touch display for the Raspberry Pi quite a while ago, with the intension of putting it on my robot controller. I decided ChessLR would be the better use for it. I am using it in portrait mode, which required a few configuration changes.
There seems to be a difference in the way you change the rotation input on newer and older distros. When this article was first written, the older distro method worked. On my latest distro from 2020, the new distro works.
display_rotate values:
0 no rotation
1 rotate 90 degrees clockwise
2 rotate 180 degrees clockwise
3 rotate 270 degrees clockwise
You need only add display_rotate and the two dtoverlay settings to the top of /boot/config.txt file.
To edit, use sudo vim /boot/config.txt.
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
# screen rotation
display_rotate=1
dtoverlay=rpi-ft5406,touchscreen-inverted-x=1
dtoverlay=rpi-ft5406,touchscreen-swapped-x-y=1
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
First change was to add display_rotate=1
to the /boot/config.txt
. To edit, use sudo vim /boot/config.txt.
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
# screen rotation
display_rotate=1
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
Other values for rotate are:
0 no rotation
1 rotate 90 degrees clockwise
2 rotate 180 degrees clockwise
3 rotate 270 degrees clockwise
This only rotates the display. It doesn't effect the touch input. So you also need to run the following xinput
commands. I put them into a shell script to make it easier to automate the process in the next step. I put the script in /home/pi/bin/rot.sh
.
xinput set-prop 'FT5406 memory based driver' 'Evdev Axes Swap' 1
xinput set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 0 1
And lastly, to execute the script automatically when X starts, I created the following file .config/autostart/.desktop
:
[Desktop Entry]
Type=Application
Exec="/home/pi/bin/rot.sh"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Startup Script
Copyright © 2025, Lee Patterson