How-To: Toggle the Backlight on the OGST Case in Linux

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

View the original forum post here.

Previous article Home Assistant ODROID-M1 Bundle!

Leave a comment

Comments must be approved before appearing

* Required fields

x