How-To: Toggle the Backlight on the OGST Case in Linux
From forum.odroid.com user adiastra:
I would like to turn on and off the TFT backlight [...]
I have written this script which works great. It accepts either 'on' or 'off' arguments and if no argument is given it toggles the backlight (and provides instructions).
#!/bin/bash filename='/sys/class/backlight/fb_ili9340/bl_power' read -r state<$filename if [ "$1" = "off" ]; then echo 1 > /sys/class/backlight/fb_ili9340/bl_power elif [ "$1" = "on" ]; then echo 0 > /sys/class/backlight/fb_ili9340/bl_power else echo "This command accepts the following arguments" echo "on - turns the backlight on" echo "off - turns the backlight off" echo "If no argument is given the backlight will toggle" echo "No state selected, toggling." if [ "$state" = "0" ]; then echo 1 > /sys/class/backlight/fb_ili9340/bl_power else echo 0 > /sys/class/backlight/fb_ili9340/bl_power fi fi
Leave a comment