Preventing DPMS operation in X in Debian 8 (jessie)

Since switching to Debian 8 on my shack computer, drlog has acquired an obnoxious behaviour.

In the past, when left unattended the screen would blank after a few minutes, and the normal screen could be restored simply by tapping a key on the keyboard. Although slightly annoying, I was never sufficiently motivated to go looking for the cause of the blanking, since once the screen was restored, drlog continued to function correctly.

This changed with the installation of Debian 8 (jessie). The screen would blank as before, but then once the screen was restored, drlog could no longer key the rig.

So now I had to find out what was going on.

It turns out that the blanking is caused by the operation of DPMS. By default, X enables DPMS, and further causes DPMS to enter sleep mode after 600 seconds.

Nothing I have seen suggests that DPMS should affect more than the display, but, apparently, in Debian 8 it also affects the parallel port -- and, further, when the computer emerges from the sleep state, operation of the parallel port is not properly restored.

In a contest one wants as little as possible happening on the computer other than the operation of the contest program (simply because every operation that is happening not under the control of the logging program is a fragility one doesn't want). So the obvious solution is to disable DPMS.

This turns out to be trickier than one would think.

Since the use of DPMS is controlled by X, it means that one has two reasonable choices: disable DPMS on a case by case basis, and ensure that it is disabled when the logging program is invoked; or configure the system so that by default DPMS is no longer enabled when the X server starts.

The first of these can be accomplished by issuing the commands:
  xset -dpms
  xset s off
prior to starting the logging program.

I prefer the second solution, but it is trickier, since it requires changing the configuration of the X server when it starts.

In Debian 8 there is no longer an X configuration file. In the absence of a configuration file, X automatically uses a reasonable default configuration. Unfortunately, it is this "reasonable default" that enables DPMS. So the first thing to do is to create an X configuration file.

To do this, at the Linux console (i.e., not in an X session) stop the desktop manager. Since I use kdm, the command (as root) is:
  /etc/init.d/kdm stop

Now generate the X configuration file corresponding to the "reasonable default".

As root, type:
  X org -configure

This creates the file /root/xorg.conf.new. Copy this file to /etc/X11/xorg.conf.

This will be the configuration file that X will use when the X server starts. It's a good idea to test this now, either by restarting X or rebooting.

Assuming that X starts as normal following the restart/reboot, then we need to make a couple of edits to the xorg.conf file we just created.

To the "Monitor" section add the line:
  Option "DPMS" "false"

This should stop DPMS being enabled. But while we're at it, we can also stop the separate screen blanking that X by default also executes. (Confusingly, this also happens after 600 seconds: so in the default configuration there are actually two operations that occur after 600 seconds of inactivity, and both have the effect of blanking the screen. It is the use of DPMS that also causes the parallel port issue; but we might as well stop the screen from blanking while we are here.)

To the xorg.conf file add the following:

Section "ServerFlags"
  Option "BlankTime" "0"

Next time you start X, the screen (and parallel port) should no longer be affected in any way after a period of inactivity.

And, most importantly, you can now leave the computer during a contest, and drlog should operate correctly when you return.