So, i added udev rules for using gpio
https://wiki.batocera.org/udev_rules
https://wiki.odroid.com/troubleshooting/gpiomem
added both, because i’m not a programmer 🙈 added them manually (rwx-rwx-r, group gpio - owner root) because i got the following message in the terminal: addgroup: group ‘gpio’ in use - and then saved my overlay.
Then i added following lines to OGST_screen.sh for testing (https://wiki.batocera.org/launch_a_script)
echo 24 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio24/direction
while true; do
rightbutton=$(cat /sys/class/gpio/gpio24/value)
if [ $rightbutton == “0” ]; then
echo 1 > /sys/class/backlight/fb_ili9340/bl_power
fi
done
echo 24 > /sys/class/gpio/unexport
i oriented me on https://github.com/crcerror/XU4-ORA-scripts/blob/master/reset_button.sh
https://forum.recalbox.com/topic/20750/turning-off-the-tft-screen-on-the-ogst-or-cloudshell-cases
but i can’t get i work
that should be the final script:
echo 24 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio24/direction
while true; do
rightbutton=$(cat /sys/class/gpio/gpio24/value)
filename=‘/sys/class/backlight/fb_ili9340/bl_power’
read -r state<$filename
if [ “$state” == “0” ] && [ $rightbutton == “0” ]; then
echo 1 > /sys/class/backlight/fb_ili9340/bl_power
fi
if [ “$state” == “1” ] && [ $rightbutton == “0” ]; then
echo 0 > /sys/class/backlight/fb_ili9340/bl_power
fi
done
echo 24 > /sys/class/gpio/unexport
Does anyone know what I’m doing wrong?
Thanks