Raspberry Pi: Turning the monitor power on and off

dale

Consolidating the info found here: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=64&t=7570

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.

Leave a Reply

You must be logged in to post a comment.