Shows how to easily rotate (in this case invert to make orientation correct within a case) the Raspberry Pi 7" Touch Screen.
This will also update the calibration for the touch screen so it will work correctly.
References:
To make both touch and backlight controls work:
First enable I2C via
raspi-config
.
# /boot/config.txt
dtoverlay=rpi-backlight,i2c0,i2c1
And to control backlight via xscreensaver:
#!/bin/sh
#
# /usr/local/bin/xscreensaver-backlight
#
# Add this to the session autostart after launching xscreensaver
#
process() {
while read line; do
case "$line" in
UNBLANK*)
sh -c 'echo "0" > /sys/class/backlight/rpi_backlight/bl_power'
;;
BLANK*)
sh -c 'echo "1" > /sys/class/backlight/rpi_backlight/bl_power'
;;
esac
done
}
xscreensaver-command -watch | process
Which needs a udev rule to allow access to the system backlight:
# /etc/udev/rules.d/99-backlight.rules
SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power"