Turning off the TFT screen on the OGST or Cloudshell cases



  • The TFT screen on the OGST is very bright (especially at night) so I wanted to be able to turn it off since my gameing box is in the bedroom.

    Here are the commands to do just that:

    #Turn the backlight ON
    echo 0 > /sys/class/backlight/fb_ili9340/bl_power
    
    #Turn the backlight OFF
    echo 1 > /sys/class/backlight/fb_ili9340/bl_power
    

    I have written a script that does this for you.

    #!/bin/bash
    
    filename='/sys/class/backlight/fb_ili9340/bl_power'
    read -r state<$filename
    
    if [ "$state" = "0" ]; then
            echo 1 > /sys/class/backlight/fb_ili9340/bl_power
    else
            echo 0 > /sys/class/backlight/fb_ili9340/bl_power
    fi
    
    

    to use the script do the following.

    Log in to your recalbox via SSH
    then use these commands

    cd
    nano backlight
    #copy paste the script into this new document
    ctrl+x then y #this will exit and save the document
    chmod +x backlight #make the script executable
    
    

    To use the script simply type ./backlight to toggle the TFT backlight on and off

    I am hoping backlight control can be built in to the next version.

    FOR DEVELOPERS

    This is the command to turn off all backlights if you want to include a universal backlight control in the next version

    # Turn off backlight
    echo 1 | tee /sys/class/backlight/*/bl_power
    
    # Turn on backlight
    echo 0 | tee /sys/class/backlight/*/bl_power
    


  • A slightly better version of the script that accepts 'on' and 'off' arguments. If no argument is given it toggles the backlight state

    #!/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 selcted, 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
    

  • Staff
    Developer
    Team
    Global moderator
    Translator

    @Zaphod hi and thank you for your script! I‘d suggest you to please open an issue on gitlab and add your script there with the explanation. Gitlab is the platform for development and just having it here, although useful for the community, has the risk of getting forgotten.


  • Staff
    Developer
    Global moderator
    Creator
    Team



  • @ian57 I guess great minds think alike. I do have a suggestion for that script but I will make it in gitlab



Want to support us ?

243
Online

80.4k
Users

21.5k
Topics

157.4k
Posts