monsur / sonos-now-playing

A digital picture frame that displays the currently playing track on Sonos
22 stars 3 forks source link

Put display to sleep when not in use #29

Closed monsur closed 9 years ago

monsur commented 9 years ago

Right now, the screen blanks after 15 mins by showing a black div. While this works, the display itself is still on during this time, causing a glow. It would be nice if the display could go to sleep when its not in use. The instructions here explain how to do this: http://the-martins.org/?p=81

Putting the monitor into power saving mode:

/opt/vc/bin/tvservice -p && /opt/vc/bin/tvservice -o

Turning the power back on: /opt/vc/bin/tvservice -p && chvt 1 && chvt 7 Both “tvservice” and “chvt” need root permissions to work. So you could use “sudo” or be logged in as root to run those commands, or you can make them suid: chmod u+s /opt/vc/bin/tvservice chmod u+s /bin/chvt Note that suid binaries are generally considered a security risk since they run with root permissions. Often there are ways to use the escalated privileges to run other commands as root. So only make those binaries suid if you’re in an environment where it would be OK for anyone to have root privileges. The information here was tested with a Raspberry Pi V2 connected to a DVI monitor through a $2 HDMI->DVI converter.

monsur commented 9 years ago

Also this link has similar recommendations: http://raspberrypi.stackexchange.com/questions/22039/turn-on-hdmi-programatically-but-doesnt-turn-on

sudo tvservice -o

sudo tvservice -p sudo chvt 9 && sudo chvt 7

monsur commented 9 years ago

This is mostly working, just a few notes so I don't forget: