Lx-Soft.com is still alive!

Vink's EPIA Story: Myth TV

....

Wakeup the PC before a recording

You will need to enable some feature on your kernel (*):

  • CONFIG_RTC_LIB=m
  • CONFIG_RTC_CLASS=m
  • # RTC interfaces
  • CONFIG_RTC_INTF_SYSFS=y
  • CONFIG_RTC_INTF_PROC=y
  • CONFIG_RTC_INTF_DEV=y
  • # Platform RTC drivers
  • CONFIG_RTC_DRV_CMOS=m

After a reboot, you will have a /sys/class/rtc/rtc0/wakealarm available on your system.

Now, we will have to check the time of the next recording. Luckily, a perl script which is supplied with mythtv (myth_upcoming_recordings.pl) does 99% of the work. I've writem a patch for this script to display only the UNIXTIME of the next recording.

We need to feed this value to the RTC Wakealarm before the system shutdown. The simplest thing is to patch /sbin/shutdown command, thus it will work with any call to shutdown. You have to move /sbin/shutdown to /sbin/shutdown.orig. Use this new /sbin/shutdown command to do what we want:

#!/bin/bash

TIME=<path to myth_upcoming_recordings.pl>/myth_upcoming_recordings.pl --time_text --recordings 1
let WAKE=$TIME-600 echo 0 > /sys/class/rtc/rtc0/wakealarm echo $WAKE > /sys/class/rtc/rtc0/wakealarm /sbin/shutdown.orig $@

(*) kernel 2.6.26 does not support ACPI wake-up (Vanilla kernel). You will need to patch this kernel to correct the issue.