Having trouble with hibernate and wakeup

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
glubbish Offline
Junior Member
Posts: 35
Joined: Nov 2013
Reputation: 0
Location: Melbourne Australia
Post: #1
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
find quote
teeedubb Offline
Donor
Posts: 2,034
Joined: Mar 2010
Reputation: 42
Location: Down Under
Post: #2
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

My Add-ons, only available for XBMC:
Steam Launcher|Music Party Mode|Reboot2oOS|Triple J Radio
find quote
glubbish Offline
Junior Member
Posts: 35
Joined: Nov 2013
Reputation: 0
Location: Melbourne Australia
Post: #3
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.
find quote
glubbish Offline
Junior Member
Posts: 35
Joined: Nov 2013
Reputation: 0
Location: Melbourne Australia
Post: #4
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.
find quote
glubbish Offline
Junior Member
Posts: 35
Joined: Nov 2013
Reputation: 0
Location: Melbourne Australia
Post: #5
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
find quote
teeedubb Offline
Donor
Posts: 2,034
Joined: Mar 2010
Reputation: 42
Location: Down Under
Post: #6
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.

My Add-ons, only available for XBMC:
Steam Launcher|Music Party Mode|Reboot2oOS|Triple J Radio
find quote