Kodi Community Forum

Full Version: Having trouble with hibernate and wakeup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Created /usr/bin/setwakeup.sh which contains:
#!/bin/sh
#$1 is the first argument to the script. It is the time in seconds since 1970
#this is defined in mythtv-setup with the time_t argument

echo 0 > /sys/class/rtc/rtc0/wakealarm #this clears your alarm.
echo $1 > /sys/class/rtc/rtc0/wakealarm #this writes your alarm

But when hibernate, it does not wake up.


Mythbackend.log shows:
Nov 22 14:46:41 MythTV mythbackend: mythbackend[2351]: N Scheduler scheduler.cpp:2934 (ShutdownServer) Running the command to set the next scheduled wakeup time :-#012#011#011#011#011#011#011/usr/bin/setwakeup.sh 1385108100
Nov 22 14:46:41 MythTV mythbackend: mythbackend[2351]: E Scheduler scheduler.cpp:2940 (ShutdownServer) SetWakeuptimeCommand failed, shutdown aborted
Nov 22 14:48:08 MythTV mythbackend: mythbackend[2351]: I ProcessRequest mainserver.cpp:1420 (HandleAnnounce) MainServer::ANN Monitor

I tried adding
xbmc ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend
using sudo visudo
but it says it saved visudo.tmp (although I cannot see this file).

I updated the livetv settings in xbmc to include sudo setwakeup.sh

Thanks
Scripts looks the same as mine, does it work manually? ie

sudo /usr/bin/setwakeup.sh 1385108100

you shouldnt get a password prompt.

cat /sys/class/rtc/rtc0/wakealarm

to check if it has been set
Thanks teeedubb.

It did prompt for a password, so it must be the issue with visudo

myth@MythTV:/$ sudo /usr/bin/setwakeup.sh 1385108100
[sudo] password for myth:
myth@MythTV:/$ cat /sys/class/rtc/rtc0/wakealarm
1385108100

changed
xbmc ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend
to
myth ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend

and now it does not prompt

Trying hibernate again.
Its very hard to test this.

If I set a recording at a near time, the box does not wake up
then when I start it, I find there are two recordings I cant play present

If I set a recording far in the future then hibernate, when I startup (by powering on) it either:
- hangs
- starts in 720 instead of 1080 and mythbackend does not start

a reboot seems to fix this.

is there an easy way to test this functionality?

I copied several of my recording from another box, and also the database from that box
There are some listed that are not actually there
I am not sure if this is causing part of my problems
Is there some easy way to delete all the current recordings? As all I really wanted were the power searches set up on the old box.

thanks.
Followed http://www.mythtv.org/wiki/ACPI_Wakeup#M..._wakealarm
the manual test worked for me, it restarted after 5 min.

But suspend from xbmc still does not wake up
I don't think mythtv will set a wakeup time if it doesnt do the suspending. You may be able to work around it using a suspend hook maybe or I'd be setting myth to control suspending using a mythtv-shutdown-check script - have xbmc exit instead of suspending and mythtv to check if xbmc is run ng before trying to suspend.