Wednesday, February 18, 2009

Update: MythTV Wakeup with kernel >= 2.6.22

In this post, I discussed how to get MythTV to automatically wakeup when it needed to record something, and shutdown when it had finished.


Since writing that post, I switched my setup from KnoppMyth to Mythbuntu, because my wireless keyboard/mouse combo didn't work under Knoppmyth. Anyway, it turns out that the auto-wakeup procedure is a bit different than I described if you are using a linux kernel version 2.6.22 or newer.


The basic differences are that the ACPI timestamp must be placed into /sys/class/rtc/rtc0/wakealarm, instead of /proc/acpi/alarm, and that the timestamp must be expressed in "UNIX time" (i.e., the number of seconds elapsed since 1970/01/01 00:00:00), rather than a "yyyy-MM-dd hh:mm" formatted string. Also, the wakealarm file must first be "flushed" to a value of zero prior to setting the wakeup time. For a detailed discussion of this, see the MythTV Wiki.


You can still follow my previous guide, with the following corrections:


  • In mythwelcome --setup, change Wakeup time format to time_t. Do not change the time format in mythtv-setup! I did that at first...seemed logical, does not work.
  • In mythwelcome --setup, change the Command to Set Wakeup Time to sudo /usr/local/bin/setwakeup.sh
  • Create the file sudo /usr/local/bin/setwakeup.sh. Make it look like this:


    #!/bin/sh
    # $1 is the time, in seconds since 1970/01/01 00:00:00.
    # (a.k.a. the "time_t" format)

    sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" # clear the alarm
    sudo sh -c "echo $1 > /sys/class/rtc/rtc0/wakealarm" # write new alarm



That should do it. Don't forget to chmod +x /usr/local/bin/setwakeup.sh.

No comments:

Post a Comment