[mythtv-users] X dpms problem

Robin Gilks g8ecj at gilks.org
Sat Jun 7 00:31:07 UTC 2008

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:-)



DATE=`date +%s`

# Use the presense of a flag file to see if we are powering up or down
if [ -e $FILE  ]
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 ]
# 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

# 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


Robin Gilks

More information about the mythtv-users mailing list