[mythtv-users] X dpms problem

Krzysztof Adamski k at adamski.org
Sat Jun 7 01:22:32 UTC 2008

xset needs the display variable to be set correctly. If you have it set
correctly then run "xhost +" from a xterm to allow anybody to modify
your X session.


On Sat, 2008-07-06 at 12:31 +1200, Robin Gilks wrote:
> I'm having problems getting the dpms line in my power on/off script (see
> below) to work!!
> If I run the script from a telnet session its OK, if I run it from an
> xterm in the same X session as MythTV it runs OK but if the script is run
> by irexec (as a result of me pressing the Power button on the remote) it
> doesn't seem to do anything.
> I guess this is something to do with irexec being run as a service and
> hence run by root so something is missing from the environment but even
> putting the '-display' option into the xset command as "xset -display :0
> dpms force off" I don't get anywhere. I've also tried exporting the
> DISPLAY variable at the start of the shell script and I've tried it in
> short and long form (i.e. as :0 and as hostname:0).
> More ideas required:-)
> #!/bin/sh
> AMP=rm-aap013
> FILE=/home/mythtv/.power
> DEV=/dev/lircd1
> DATE=`date +%s`
> # Use the presense of a flag file to see if we are powering up or down
> if [ -e $FILE  ]
> then
> LAST=`cat $FILE`
> # ignore unless at least 10 seconds has passed  this stops a keybounce
> # from turning us off straight after a turn on
> if [ $(($LAST + 10)) -lt $DATE ]
> then
> # power down - just blindly do it
> /usr/bin/xset dpms force off
> # the amp needs the code repeated to get it to work - handled by repeat
> value in the conf file
> /usr/bin/irsend -d $DEV SEND_ONCE $AMP A_power
> /bin/rm -f $FILE
> fi
> else
> # power up and select the correct input on the amp
> /usr/bin/xset dpms force on
> /usr/bin/irsend -d $DEV SEND_ONCE $AMP A_dvd
> /usr/bin/irsend -d $DEV SEND_ONCE $AMP A_dvd
> /usr/bin/irsend -d $DEV SEND_ONCE $AMP A_dvd
> echo $DATE > $FILE
> fi

More information about the mythtv-users mailing list