14

I'm using Raspbmc. I'd like the display to actually go to sleep (not simply just screensaver) after 15 minutes, but I can't seem to find any option for that in the settings. Am I missing something?

Kurtis Nusbaum
  • 273
  • 1
  • 3
  • 7
  • 3
    There are many people in the same boat.

    http://www.raspberrypi.org/phpBB3/viewtopic.php?t=13801

    They discuss this issue in detail, and have several fixes. They use the tvservice command, with some work arounds. Have a look, hope it helps.

    – Impulss Jan 22 '13 at 04:20

4 Answers4

5

There is an undocumented option in /boot/config.txt that might help you:

hdmi_blanking=1

Tried and tested under Raspbian "Jessie" (not Raspbmc). The display goes to sleep after about 10 minutes of inactivity. Source: https://github.com/raspberrypi/linux/issues/487

[Note that the Pi itself cannot sleep like grown-up PC-s do.]

Edit: Turns out that this trick does not work on more modern versions of the Pi hardware, such as the RPi 4. Similarly, new releases of various Pi OS-es may behave differently. Thanks to Dmitry Grigoryev for pointing this out. My answer is valid for old hardware (I tested it on the RPi 2) and old software such as Raspbian "Jessie".

András Aszódi
  • 226
  • 2
  • 5
  • Here we go again. Someone downvoted this (correct) answer without any explanation. I would like to learn, and a large number of other people on this site would like to learn, too. The downvoter is hereby kindly asked to enlighten us what s/he didn't like about this answer. Thank you. – András Aszódi Sep 24 '19 at 14:18
  • I downvoted this answer because it didn't work for me. BTW, the official documentation has since been updated to specifically state this won't work on RPi4. – Dmitry Grigoryev Oct 17 '19 at 11:27
  • 1
    @DmitryGrigoryev Thank you for the clarification. May I call your attention to the fact that I provided this answer in 2015, i.e. 4 years ago. Hardware and software change rapidly, and I do believe you that this option does not work with an RPi4, or even with an RPi3, or with newer OS releases, but still... it would have been much friendlier if you had just added this information instead of downvoting an answer which was definitely correct at the time when I provided it. – András Aszódi Oct 22 '19 at 13:05
  • 1
    That's the problem with catch-all questions which have no RPi model tag: there's no way to know if the answer will work, while asking a new question on the same topic will typically result in a close vote. I won't be able to undo my downvote unless you edit your answer, which IMO is a good opportunity to tell on which hardware you did this. – Dmitry Grigoryev Oct 22 '19 at 13:15
  • 1
    As an independent observer, I abhor downvotes without comments and I have empathy for Answer posters who fail to, as you put it, properly caveat their answers with a matrix of Pi models they tested their answer on to future-proof it 4 years into the future. If you feel strongly about this, perhaps engage the SE committees rather than using the system against itself? – Scott Prive Mar 12 '20 at 12:28
  • 1
    This solution worked perfectly for me on a RPi 3B with Raspbian GNU/Linux 10 (buster). – Victor Yarema Apr 23 '20 at 13:33
  • @ScottPrive Not sure why I should "engage the SE committees" (what are these anyway?) I downvoted an answer that no longer worked, it got fixed, I upvoted it: that's exactly how the system is supposed to work. And BTW, comments like yours, shaming people for voting something down, are exactly the reason why people tend to downvote anonymously. – Dmitry Grigoryev Dec 08 '20 at 10:14
  • 1
    @DmitryGrigoryev With me, when I see correct answers downvoted without any comment, I see that as damage. We should strive to be constructive, which was my perspective on how the system should work. – Scott Prive Dec 08 '20 at 20:32
  • @ScottPrive Totally agree, however, I've never seen seen this happening. If you refer to me and this question, I did try it and it didn't work, so the correct part doesn't really apply, does it? What I see regularly is the opposite kind of damage: wrong answers upvoted by people who obviously didn't bother to try them, like the xscreensaver answer here. – Dmitry Grigoryev Dec 09 '20 at 07:59
  • @DmitryGrigoryev I could have worded this better. Rephrased, I was expressing a +1 that it's really unfortunate when Pi-related answers "do not" caveat which models they are talking about (because these are often model-specific or OS specific), but on the other hand if people are going to downvote such answers at least say why. – Scott Prive Dec 10 '20 at 18:32
  • @DmitryGrigoryev I agree the xscreensaver answer is way off. The "go to sleep (not simply just screensaver) " is 100% clear to me and you - it means "power management", but it may not have been to clear to @paul for whatever reason (language, skill). I think wrong answers are handled well (reliably, fall to the bottom), but downvotes are abused (and everyone gets the same subtraction power regardless of rep) – Scott Prive Dec 10 '20 at 18:42
2

Case 1 : for x11 with no auto start X

$ vim ~/.xinitrc

xset s off # don't activate screensaver
xset -dpms # disable DPMS (Energy Star) features.
xset s noblank # don't blank the video device

Case 2 : for X11 with auto start X

Follow the instructions for Case 1, then

$ vim /etc/lightdm/lightdm.conf

[SeatDefaults]
xserver-command=X -s 0 -dpms

cd ~/.config
mkdir autostart
cd autostart
vim screensaver.desktop

[Desktop Entry]
Type=Application
Exec=/home/pi/.xinitrc

Case 3 : bash without X

$ sudo vim /etc/kbd/config

BLANK_TIME=0
POWERDOWN_TIME=0

$ sudo /etc/init.d/kbd restart
Alex Chamberlain
  • 15,530
  • 14
  • 67
  • 113
  • 1
    Hey @Gilles, welcome to RPi.SE. Great answer. It would be even better if you could add a link to your references and/or add some commentary to help beginners along the way. – Alex Chamberlain Aug 30 '13 at 07:14
  • 1
    This just disables the screensaver entirely. How do you set X to use a screensaver after a specific amount of time? – Macil Feb 27 '15 at 07:49
1

Update: now that DPMS issue is resolved, it is sufficient to set

xset dpms 900 0 0

on the command line (900 is 15 minutes in seconds) or

Section "ServerFlags"
    Option "StandbyTime" "15"
EndSection

in xorg.conf

Before DPMS was working properly on the Pi 4, I used to install xautolock which runs an arbitrary command as a screen locker. For instance, mine looks like this:

tvservice -o
DISPLAY=:0 xev -geometry 1900x1200 | stdbuf -o0 grep Motion >&-
tvservice -e "CEA 4"

The first line shuts down HDMI signal, making the TV go to sleep. The second line starts the "X event" tool in a window which is bigger than the screen, and waits until "Motion" is reported, that is, when the user moves the mouse inside the window (which is anywhere on the screen). Finally, the third line sets the HDMI mode back to the one I use, which is 1280x720.

xautolock itself is started from lxsession/LXDE-pi/autostart with:

xautolock -time 10 -corners +--- -cornerdelay 5 -noclose -locker bcmsaver

This means that the screen will be locked after 10 minutes, or after 5 seconds if the mouse pointer is "parked" in the top left corner. bcmsaver is the name of locker script above. Depending on how you run xautolock, you may need to specify the full path to the locker script, and use an & to send xautolock to the background.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144
0

In order to "ENABLE" power management options on Raspbian

GUI version:

sudo apt-get install xscreensaver

(might take a while to install)

You then find the screensaver application in Start > Preferences

Select the first tab Display Modes

Set Mode to "Blank Screen Only"

Set Blank After to "15" minutes"

Select the second tab Advanced

Enable Quick Power-Off in Blank Only Mode

I would recommend to leave Quick Power-Off in Blank Only Mode values for "Standby After, Suspend After and Off After" as default

Please note, that the screensaver daemon might not autostart on reboot

paul
  • 9
  • 2