Qt World Summit: Register Today!

Forcing to enter sleep mode after a delay

  • Hi !

    I would like to force my screen to enter in the framebuffer sleep mode for saving energy when my board is not used.

    I know I have to use the following command lines to force enter in the fb sleep mode :
    @echo 1 > /sys/class/graphics/fb0/blank@
    And in order to force my screen to get out of the sleep mode :
    @echo 0 > /sys/class/graphics/fb0/blank@

    Unfortunately my board doesn't enter in sleep mode after a delay. I think I have to code somethin in my Qt app so that after a certain time
    of inactivity the first command is launched thanks to a QProcess. And once a somebody put his finger in the touchscreen the second command will have to be lauched too in order to get back to a normal screen mode.

    I don't really know how to start building such thing. I though of using a Qt timer that is reset to 0 at every mouse event, and once the certain delay is reached a signal should be sent to a special slot whose aim is to launch the command. And once a mouse is got another signal should force the screen to wake up.

    I don't know if it is the right way to proceed. Have you some advice ? Because I'm not that at ease with that way of working, it looks a little bit dirty for me ...

    Thanks you !

  • QTimer is definitely an option for what you want to do. Did you investigate running a separate screen saver though? Those usually do the screen blanking AFAIK.

    PS: Why don't you just use a QFile to open /sys/class/graphics/fb0/blank and write the 1/0 into it? That should save you the QProcess...

Log in to reply