[mythtv-users] suspend-to-ram working

W Gadsby wgadsby at yahoo.com
Mon May 30 00:50:02 UTC 2011


Hi,
I finally figured out how to get my mythtv pc to suspend-to-ram when idle.  I'm 
running
mythdora version 12.24 in 64-bit mode.  It took a while, so I thought I'd 
document it here in 

case someone else is having trouble.  For reference, I started with the mythtv 
wiki:  

http://www.mythtv.org/wiki/ACPI_Wakeup and changed a few things.  My setup is a 
combined 

mythdora frontend/backend and includes a PC Chips A13G+ motherboard with an AMD 
Sempron 

LE-1150 processor and a GT Force 9400 GT PCI-X video card.  It's been working 
fine for 

several weeks and I've only found one or two minor glitches that are easily 
overcome.  I'm 

running the latest mythdora version (12.24) in 64-bit mode.

The first glitch is that when I bring the system out of suspend and
start watching something, on rare occasions it reverts to the mythwelcome screen 

after maybe ~60 seconds, and I have to start mythfrontend again and start the 
program again.  

Another quirk is that sometimes when resuming, mythfrontend is a little sluggish 
for a 

short time.  It fixes itself after perhaps a minute.  I haven't had any
system crashes or other unusual behavior and the system appears to be very 
stable.  

Mythbackend settings:
under general, shutdown/wakeup options page:
block shutdown before client connected:  unchecked
idle shutdown timeout (secs): 300
maximum wait for recording (mins): 15
startup before recording (secs): 120
wakeup time format: yyyy-MM-ddThh:mm:ss
command to set wakeup time:  mythshutdown --setwakeup $time
server halt command:  mythshutdown --shutdown
pre-shutdown-check command: mythshutdown --check

I configured mythdora to use mythwelcome instead of mythfrontend as the main 
startup program as suggested in the wiki.

mythwelcome settings:
(hit F11 when in mythwelcome):
command to set wakeup time:  /usr/local/bin/setwakeup.sh $time
wakeuptime format: time_t
nvram-wakeup restart command:  /sbin/grub-set-default 1
command to reboot:  /usr/bin/reboot
command to shutdown:  /usr/bin/pm-suspend

I believe the BIOS was already set up correctly, and I didn't have to do 
anything special to enable wake on lan there, or do any of the RTC modifications 

described in the hwclockupdates section of the ACPI_Wakeup wiki document.

When I first set it up, I had trouble with mythfrontend occasionally losing 
communication with mythbackend and causing some general flakiness, requiring 
a complete reboot.  My Airboard keyboard also lost mouse operation on a resume.  


I added the following files, which I adapted
from some example files for pm on the web.

/etc/pm/sleep.d/S30mythbackend:

*******************************************************************************************************



#!/bin/bash

#. /usr/lib/pm-utils/functions

suspend_mythbackend() {
    # shut down back end
    /etc/init.d/mythbackend stop
}

resume_mythbackend() {
    # restart back end
    /etc/init.d/mythbackend start
}

case "$1" in
    hibernate|suspend)
        suspend_mythbackend
        ;;
    thaw|resume)
        resume_mythbackend
        ;;
    *)
        ;;
esac

exit $?
***********************************************************************************************************






and /etc/pm/sleep.d/S31inputattach:

***********************************************************************************************************





#!/bin/bash

#. /usr/lib/pm-utils/functions

#suspend_inputattach() {
#    inputattach automatically stops on suspend, so no need
#    usr/sbin/inputattach
#}

resume_inputattach() {
    # restart input attach program
    /usr/sbin/inputattach --mouseman /dev/ttyS0 &
}

case "$1" in
    thaw|resume)
        resume_inputattach
        ;;
    *)
        ;;
esac

exit $?
***********************************************************************************************************






These files cause pm to restart mythbackend and the inputattach program whenever 
the system wakes 

up, and seem to solve any instability problems.  I also added the following line 
to /etc/rc.local to enable 

wake on lan, so I can wake it from another PC:

/usr/sbin/ethtool -s eth0 wol g

Now when I want to access the web interface, I run 

wol -p 7 <MAC>

from another PC on the network.  It shuts down again after 15 minutes unless it 
is doing something else.  


I've measured the power consumption of the system in various states:

off:  4 W
suspend:  4 W
on, idle:  75 W
on, playback:  80 W

Putting the PC in suspend draws about as much power as just shutting it off, but 
it only takes about ten
seconds for a full recovery from suspend.  While the wiki suggests doing a 
complete reboot after resuming
from suspend, it looks like it isn't necessary, at least with my hardware.


More information about the mythtv-users mailing list