Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[SOLVED] How to Disable Screen Saver Blanking on the Raspberry Pi as Kiosk

2,491 views
Skip to first unread message

DisneyWizard the Fantasmic!

unread,
Oct 5, 2015, 10:54:06 PM10/5/15
to
==== TYPE = THIS = TO = NIX = THE = SCREEN = SAVER ====
xset s 0 0 s off s noblank s noexpose -dpms
at a command prompt,
or make it stick by placing that line in an init file.
=============================================
[SOLVED] How to Disable Screen Saver Blanking on the Raspberry Pi as Kiosk

I wanted to demonstrate using the Raspberry Pi as a weather/traffic
information kiosk for use by dispatchers in dispatch centers and by
guests in hotel lobbies, having neither mouse nor keyboard, just an HDMI
monitor. The problem was that for an unmanned 24/7 status display,
screen blanking occurred automatically on the Pi every ten minutes.
Disabling that "helpful" screen saving feature seemed to be a pain of
discovering the obscure documentation. The good news is that I had
already long-ago built both HTML traffic and weather pages with
auto-refresh, and a bit more which was stripped out for the .html file
loaded native to the RPi such as National Institute of Standards/Time
widgets and such, as my own personal agents (seen at
http://weather.disneywizard.com and http://traffic.disneywizard.com .)
The auto refresh is accomplished in the <head> of the traffic.html and
weather.html pages with this line:
<meta http-equiv="refresh" content="600">

The content="600" meta http-equiv instructs client-side browsers which
honor refresh to display the page anew six times an hour by waiting
six-hundred seconds (10minutes*60) before re-loading is forced. (I'll
likely double the refresh rate to 12/hr by reducing refresh to 300 when
the kiosk is installed.) Thankfully Iceweasle honors refresh.

ARGh! How do I turn Screen Saver off?! Six-hundred seconds is also the
default "screen saver" blankout default in my Raspberry Pi Debian Wheezy
stock distribution. After several misfired Google searches due to poor
keyword selection I finally came upon
http://idratherhack.blogspot.com/2011/09/disable-screen-blanking-in-linux-how.html
Bingo! It helped immensely, but failed to locate the global default
xinitrc file, which is in the /etc/X11/xinit/xinitrc directory locaton.
Startx first searches for an xinitrc local startup file in each users
home directory labeled with a dot in front: .xinitrc , list it with
console command line ls -a to find the hidden file. If the file doens't
exist it uses the global settings in /etc/X11/xinit .
These user and global files are the initial hook which launches Xsession
when the user invokes startx. In the global file I inserted this line
utilizing 'root@Pi:~# leafpad /etc/X11/xinit/xinitrc ':
xset s 0 0 s off s noblank s noexpose -dpms
[your favorite editor will do this fine, I chose Leafpad.]

The xset command can be typed on the command line from any current
directory to tweak the Xwindow behavior before starting it, here in
xinitrc it happens to be this - the semi-permanent script seen below:
(the actual script is much shorter, I've included the "#xset usage:"
comment section for localized reference later when I forget what I did.):

#!/bin/sh
# /etc/X11/xinit/xinitrc
#
# global xinitrc file, used by all X sessions started by xinit (startx)

# Disable blanking. See
http://idratherhack.blogspot.com/2011/09/disable-screen-blanking-in-linux-how.html
xset s 0 0 s off s noblank s noexpose -dpms

# invoke global X session script
. /etc/X11/Xsession


#xset usage: xset [-display host:dpy] option ...
# To turn bell off:
# -b b off b 0
# To set bell volume, pitch and duration:
# b [vol [pitch [dur]]] b on
# To disable bug compatibility mode:
# -bc
# To enable bug compatibility mode:
# bc
# To turn keyclick off:
# -c c off c 0
# To set keyclick volume:
# c [0-100] c on
# To control Energy Star (DPMS) features:
# -dpms Energy Star features off
# +dpms Energy Star features on
# dpms [standby [suspend [off]]]
# force standby
# force suspend
# force off
# force on
# (also implicitly enables DPMS features)
# a timeout value of zero disables the mode
# To set the font path:
# fp= path[,path...]
# To restore the default font path:
# fp default
# To have the server reread font databases:
# fp rehash
# To remove elements from font path:
# -fp path[,path...] fp- path[,path...]
# To prepend or append elements to font path:
# +fp path[,path...] fp+ path[,path...]
# To set LED states off or on:
# -led [1-32] led off
# led [1-32] led on
# -led named 'name' led off
# led named 'name' led on
# To set mouse acceleration and threshold:
# m [acc_mult[/acc_div] [thr]] m default
# To set pixel colors:
# p pixel_value color_name
# To turn auto-repeat off or on:
# -r [keycode] r off
# r [keycode] r on
# r rate [delay [rate]]
# For screen-saver control:
# s [timeout [cycle]] s default s on
# s blank s noblank s off
# s expose s noexpose
# s activate s reset
# For status information: q

...and here is what the "xset s 0 0 s off s noblank s noexpose -dpms"
line did:
s 0 0 # s [timeout [cycle]]: set timeout and cycle to zero
s off # set screen-saver control to off
s noblank # set screen-saver control to noblank
s noexpose # set screen-saver control to noexpose
-dpms # set control Energy Star (DPMS) features -dpms Energy Star
features to off

That last one '-dpms' may indicate an error when accessing your Pi
headless from within PuTTY shell on a remote laptop or terminal, because
the server does not load the DPMS Extension when it has no HDMI monitor
to handshake. Not to worry should you see an error message, it's
harmless and just indicates no HDMI or energy star monitor was attached
when booted up. Truncate the -dpms switch option should you find the ''
xset: unable to open display "localhost:12.0" '' message error when
DPMS (Energy Star):
Server does not have the DPMS Extension.

Type 'xset q' to see the damage:P(tongue in cheek) er... status information:

root@Pi:/etc/X11/xinit# xset q
Keyboard Control:
auto repeat: on key click percent: 0 LED mask: 00000000
XKB indicators:
00: Caps Lock: off 01: Num Lock: off 02: Scroll Lock: off
03: Shift Lock: off 04: Group 2: off 05: Mouse Keys: off
auto repeat delay: 500 repeat rate: 31
auto repeating keys: 00ffffffdffffbbf
fadfffdfffdfe5ef
ffffffffffffffff
ffffffffffffffff
bell percent: 50 bell pitch: 400 bell duration: 100
Pointer Control:
acceleration: 2/1 threshold: 4
Screen Saver:
prefer blanking: no allow exposures: no
timeout: 0 cycle: 0
Colors:
default colormap: 0x20 BlackPixel: 0x0 WhitePixel: 0xffffff
Font Path:
built-ins
Bug Mode: compatibility mode is disabled
DPMS (Energy Star):
Server does not have the DPMS Extension
root@Pi:/etc/X11/xinit#

Of course you don't need to lock Screen Blanking Disable out of every
startx by editing xinitrc to include
xset s 0 0 s off s noblank s noexpose -dpms
and just type it on a command line before invoking startx per
non-blanking session.

And just in case all that above makes it sound more difficult than it
actually was, all I did was type
xset s 0 0 s off s noblank s noexpose -dpms
at a command prompt, and make it stick by placing that line in an init
file.

Yet to go: Cold booting directly into Iceweasle full-screen without
requiring an [F11] key -press

-------Synopsis----------
I'd Rather Hack's blog

http://idratherhack.blogspot.com/2011/09/disable-screen-blanking-in-linux-how.html
did a great job pointing me in the right direction, and to get me
started, but was missing
/etc/X11/xinit/xinitrc as the location of the key file nor did it
mention that screen saver cycle was an extra space zero value
immediately after the timeout value , nor that there could be a
different result if shelling in over Ethernet versus the native console.
In other words I'm not just parroting I'd Rather Hack to steal his
glory, but rather contributing my two cents of experience and spreading
the word of success here on c.s.r-pi.

He also mentions these three console-centric commands:
setterm -blank 0
setterm -powerdown 0
setterm -powersave 0
which I didn't invoke, and yet my weather and traffic pages successfully
burn on through the night!

--
- better to learn by mistakes of others, - Wiz.
- erroneous examples as provided, - Wiz.
- than to learn by mistakes made for oneself. - Wiz.
- A bakers dozen out of 12 Wizards agree: "And far less painful. - Wiz."
visit —(o=8> http://disneywizard.com <8=o)— visit
p.s. Please be gentle with your replies, as this is my very fiirst
[SOLVED] post on news:comp.sys.raspberry-pi .

Russell Gadd

unread,
Jan 6, 2016, 12:07:11 PM1/6/16
to
On 06/10/15 03:53, DisneyWizard the Fantasmic! wrote:
> ==== TYPE = THIS = TO = NIX = THE = SCREEN = SAVER ====
> xset s 0 0 s off s noblank s noexpose -dpms
> at a command prompt,
> or make it stick by placing that line in an init file.
> =============================================
> [SOLVED] How to Disable Screen Saver Blanking on the Raspberry Pi as Kiosk
>
> ... <rest snipped>

A good explanation of the action of xset. It took me some time to sort
out suppression of screen blanking as I am trying to set up a permanent
display for a notice board. I have a slightly different solution which
also uses xset but follows the recipe of some of the googled articles
which I tried, but which failed because raspbian has clearly been
tweaked since.

These articles suggested adding lines to a file "autostart" in
/etc/xdg/lxsession/LXDE

There's also a directory /etc/xdg/lxsession/LXDE-pi with another
autostart in.

Doing anything in these locations failed to stop the blanking. However I
found yet another autostart file here:
/home/pi/.config/lxsession/LXDE

Adding the following lines to autostart in this directory worked:
@xset s noblank
@xset s off
@xset -dpms

I also commented out the following line in this file (discovered from
another googled page) by adding # in front:
@xscreensaver -no-splash

I'm not particularly impressed by the duplication of all these autostart
files. I did a test to see if a script added to any of these files would
execute at startup. Only the script in the .config location was
executed. So the other autostart files appear entirely redundant.

There is in my system yet another autostart file - this:
/etc/xdg/lxsession/LXDE/autostart.01-02-2016_05:21:16.
As I never had a pi in January or February (depending on whether this
was created in the UK or US) this is clearly nothing which my personal
installation created.

I hope this helps someone to disable screen blanking but also acts as a
message to the devs to clean this up.



Joe Beanfish

unread,
Jan 7, 2016, 9:32:03 AM1/7/16
to
On Wed, 06 Jan 2016 17:07:10 +0000, Russell Gadd wrote:
> There's also a directory /etc/xdg/lxsession/LXDE-pi with another
> autostart in.
>
> Doing anything in these locations failed to stop the blanking. However I
> found yet another autostart file here:
> /home/pi/.config/lxsession/LXDE
>
> Adding the following lines to autostart in this directory worked:
> @xset s noblank
> @xset s off
> @xset -dpms
>
> I also commented out the following line in this file (discovered from
> another googled page) by adding # in front:
> @xscreensaver -no-splash
>
> I'm not particularly impressed by the duplication of all these autostart
> files. I did a test to see if a script added to any of these files would
> execute at startup. Only the script in the .config location was
> executed. So the other autostart files appear entirely redundant.

Perhaps the system one in /etc is a fallback if the personal one in .config
doesn't exist. It's often the case with config files that there's a global
default one that can be overriden with a personal one under the home directory.

It's sometimes interesting to watch a program with strace -e open,access
and see the myriad of config files they look for.

The Natural Philosopher

unread,
Jan 7, 2016, 9:43:39 AM1/7/16
to
On 07/01/16 14:29, Joe Beanfish wrote:
> It's often the case with config files that there's a global
> default one that can be overriden with a personal one under the home directory.
>

That is such an important concept it bears repeating


It's often the case with config files that there's a global
default one that can be overriden with a personal one under the home
directory.


In fact it is more the rule for any program which MIGHT be opened by
another user who MIGHT want it to have different behaviour.


If you are coming from te 'one man one machine and one ring to rule them
all written by Microsoft' world, stop and consider how you give a
different user experience to copies of the same program WITHOUT a user
specific config [file], and how you can govern default behaviour WITHOUT
a central one.

files in ~/.application are the standard way that everyone does this,
nit because its necessarily anything more than an arbitrary mechanism,
but because it is a de facto standard and not worth 'improving'

> It's sometimes interesting to watch a program with strace -e open,access
> and see the myriad of config files they look for.

Should you be aware of what strace is and how to use it ;-)

Another fun but of spyware into your system is netstat, to see what's
connected to what.

Especially when running a public server

--
Ideas are more powerful than guns. We would not let our enemies have
guns, why should we let them have ideas?

Josef Stalin

Martin Gregorie

unread,
Jan 7, 2016, 1:36:15 PM1/7/16
to
On Thu, 07 Jan 2016 14:43:38 +0000, The Natural Philosopher wrote:

> That is such an important concept it bears repeating
>
Agreed.

> It's often the case with config files that there's a global default one
> that can be overriden with a personal one under the home directory.
>
Another common convention is that applies to programs you've written or
that weren't in one of your distro's standard packages is to put them
in /usr/local/bin, put their system-wide configuration files in
/usr/local/etc and their manpages in /usr/local/man/*. This has several
benefits:

- the programs, configuration and documentation are safe from being
overwritten by another program of the same name being added to the
distro's packages

- the programs, configuration and documentation will still be there after
a clean install if you've moved /usr/local/* to, say, /home/local/* and
then replaced /usr/local with a symlink to /home/local

These programs will typically look for configuration by searching
.:~./application:/usr/local/etc:/etc in that order and it is good
practise to write programs to work like this.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

Russell Gadd

unread,
Jan 7, 2016, 3:08:43 PM1/7/16
to
Understood now, thanks.
0 new messages