xbmc ACPI suspend with xmbc running on a mythtv-backend?
#1
Does anyone use ACPI suspend with xmbc running on a mythtv-backend?

I currently have mythfrontend setup so that when it exits I get back to mythwelcome and mythbackend then will run a mythsuspend script to do suspend to RAM.
The important thing though is that it programs my RTC clock so that it wakes up in time for the next recording schedule.

I'm removing mythfrontend and running xbmc instead as a frontend, but I'm going to guess that if I just use XBMC's suspend feature, it will just suspend and my PC will not wake up for its next recording.

How does one do ACPI suspend with xbmc on a PC that is also running a myth backend?

Thanks,
Marc
Reply
#2
I dont have a combined back/frontend but I use a backend with with acpi suspend and rtc wakeup. You can have mythbackend run a script that will run a few checks (for downloads/used shares/certain programs) and if there is no output from the commands within the script myth-backend suspends the machine. Here is the script I use, which I found on these forums somewhere so it contains an command to check if xbmc is running.

Code:
cat /usr/bin/mythshutdown-check.sh                                                              
#!/bin/bash
mythshutdown --check > /dev/null
if [ "$?" -ne "0" ]; then
        mythshutdown --status > /dev/null
echo "Cannot suspend as mythbackend is not idle: status = '`echo $?`'"

echo         0 - Idle
echo         1 - Transcoding
echo         2 - Commercial Flagging
echo         4 - Grabbing EPG data
echo         8 - Recording - only valid if flag is 1
echo        16 - Locked
echo        32 - Jobs running or pending
echo        48 - Possibly 16 + 32
echo        64 - In a daily wakeup/shutdown period
echo       128 - Less than 30 minutes to next wakeup period
echo       255 - Setup is running

# TODO: List out the appropriate error message.
#-s/--status         (returns a code indicating the current status)
#         0 - Idle
#         1 - Transcoding
#         2 - Commercial Flagging
#         4 - Grabbing EPG data
#         8 - Recording - only valid if flag is 1
#        16 - Locked
#        32 - Jobs running or pending
#        48 - Possibly 16 + 32
#        64 - In a daily wakeup/shutdown period
#       128 - Less than 30 minutes to next wakeup period
#       255 - Setup is running
        exit 1
fi

if [ "`pidof -s xterm`" ]; then
        echo "Cannot suspend as a xterminal is open"
        exit 1
fi

if [ "`pidof -s synaptic`" ]; then
        echo "Cannot suspend as Synaptic package manager is running"
        exit 1
fi

if [ "`ls /mnt/downloads/incomplete`" ]; then
        echo "Cannot suspend as downloads are in progress"
        exit 1
fi

if [ "`ls /mnt/public |grep lock`" ]; then
        echo "Cannot suspend as a lock file is present"
        exit 1
fi


if [ "`net status shares | grep movies`" ]; then
        echo "Cannot suspend as a samba share is being used (movies)"
        exit 1
fi

if [ "`net status shares | grep tvshows`" ]; then
        echo "Cannot suspend as a samba share is being used (tv shows)"
        exit 1
fi

if [ "`net status shares | grep music`" ]; then
        echo "Cannot suspend as a samba share is being used (music)"
        exit 1
fi

if [ "`net status shares | grep public`" ]; then
        echo "Cannot suspend as a samba share is being used (public)"
        exit 1
fi

if [ "`net status shares | grep tv-recor`" ]; then
        echo "Cannot suspend as a samba share is being used (tv-recordings)"
        exit 1
fi

#if [ "`pidof -s xfs_fsr`" ]; then
#        echo "Cannot suspend as the XFS defragmentation tool is running"
#        exit 1
#fi

#if [ "`pidof -s -x rdiff-backup`" ]; then
#        echo "Cannot suspend as rdiff-backup is running"
#        exit 1
#fi

#if [ "`users`" != "xbmc" ]; then
#        echo "Cannot suspend the machine as there are users other than xbmc: '`                               users`'"
#        exit 1
#fi

#if [ "`netstat | grep nfs`" ]; then
#        echo "Cannot suspend as an NFS share is being used"
#        exit 1
#fi

#if [ "`pidof -s xbmc.bin`" ]; then
#        echo "Cannot suspend as XBMC Media Center is running"
#        exit 1
#fi

#if [ "`pidof -s firefox-bin`" ]; then
#        echo "Cannot suspend as Firefox is running"
#        exit 1
#fi

#if [ "`pidof -s mousepad`" ]; then
#        echo "Cannot suspend as Mousepad is running"
#        exit 1
#fi

#if [ "`pidof -s transmission`" ]; then
#        echo "Cannot suspend as Transmission is running"
#        exit 1
#fi

#if [ "`pidof -s xfce4-terminal`" ]; then
#        echo "Cannot suspend as Terminal is running"
#        exit 1
#fi

exit 0

Ive made some changes and have commented out what Im not using. Im thinking you could have xbmc exit on pressing the power button and automatically after X minutes of idle. I know myth-welcome can detect if a machine has been woken for a recording or by a user and launch the frontend based on that, but I think that a mythtv frontend wont shutdown automatically (I could be wrong, Ive just begun setting up a be/fe machine for my parents) so I dont know if theres much point trying to integrate xbmc into mythwelcome, just have xbmc launched on resume and close after X mins idle.
Reply
#3
Thanks for your tips, they are quite helpful.

In my case, I have an edge: when I shut off my TV/receiver, I can have that send a command to my HTPC, so it can suspend based on that.

Cheers,
Marc
Reply

Logout Mark Read Team Forum Stats Members Help
xbmc ACPI suspend with xmbc running on a mythtv-backend?0