Configuring a Shuttle SD32G2 to wakeup using ACPI from Linux

, No Comments »

I recently configured my Shuttle SD32G2 MythTV PVR server to automatically wakeup when it needed to record a scheduled TV recording. Many of the examples on the web for doing this from MythTV used NVRAM. However, after installing NVRAM it didn’t recognise the BIOS. Given how NVRAM splashes about in sensitive memory in the BIOS I wasn’t too keen to try my luck getting that to work.

Some other web pages such as ACPI Wakeup mentioned being able to use the Linux Advanced Configuration and Power Interface (ACPI) instead. This was a much better option and I soon had everything working using simple command line scripts.

To configure your Shuttle SD32G2 server to work with ACPI all you need to do is:

  1. Start the machine up and go into the BIOS configuration (hold down Delete while the machine boots)
  2. Select Power Management Setup
  3. Change the Resume By Alarm option to Enabled
  4. Save the BIOS configuration change and reboot the machine

This configures the BIOS so it will indeed wake up when the alarm is set.

The following are notes that relate to configuring the use of the ACPI alarm in Linux (based on Kubuntu Feisty Fawn 7.04)

  • The date format for the ACPI alarm for the SD32G2 appears to be yyyy-MM-dd hh:mm:ss. The date format can be confirmed by executing cat /proc/acpi/alarm and looking at the alarm time that is already set in the BIOS.
  • The SD32G2 doesn’t appear to support setting the day of month for the wakeup alarm. This should be fine for TV recording with my configuration since the machine will simply boot up on the specified time on the next day and then shut down 2 minutes later if it doesn’t start recording.
  • If the day is set to 0 (which always seems to appear), then than means start up at the specified time on every day.
  • The wakeup alarm can be set using echo "2007-06-11 16:23:00" > /proc/acpi/alarm if run as root or inside a script executed using sudo
  • The wakeup alarm can be set using sudo sh -c "echo '2007-06-11 16:23:00' > /proc/acpi/alarm" if using sudo. Trying to simply do a direct sudo echo always gave me a permission problem.
  • Content located at ACPI Wakeup is quite useful. The Shuttle BIOS did not need any modifications to the hwclock.sh script though and don’t bother with the clumsy script to alter the time from local time to UTC. Just alter the BIOS clock to use the local time.
  • The BIOS time can be changed from UTC to local time in Kubuntu by opening the /etc/default/rcS file and changing UTC=yes to UTC=no. Much easier all round.
  • The BIOS clock can be set from the system clock using sudo hwclock -systohc. I’m reasonably sure the Kubuntu does this on shutdown.

MythTV server now starts up and shuts down automatically

, , No Comments »

I’ve spent the last few nights playing with the wonderful world of Linux Advanced Configuration and Power Interface (ACPI) so that the MythTV server will now automatically start up to record a scheduled TV show, and automatically shut down afterwards if there are no logged in users.

This is pretty cool because it means I won’t miss recording any more of the Americas Cup Highlights because I didn’t get out of bed early enough to turn on the server.

It was a pretty arduous task with a number of steps based on content from a number of different web-sites to get things to work. After all the research though it’s not actually that complicated to setup. At a high level the following was done (subsequent blog posts will cover off some of the more tricky bits in more detail):

  1. Configure Power Management in the BIOS of your machine to allow being resumed by alarm
  2. Install appropriate bits for Linux to support ACPI
  3. Alter the Linux configuration so the BIOS uses local time rather than UTC time (since MythTV works using local time)
  4. Ensure that the ACPI alarm interface works as expected when set
  5. Create a small script to set the ACPI alarm given a date
  6. Create a small script to check to see if it is OK to shutdown the server
  7. Configure MythTV to use the two scripts created above
  8. Alter the sudo permissions for the MythTV user so the scripts can be executed without permission problems
  9. Alter the login permissions so only root can shut the server down (to prevent accidental shutting down when the server is recording

Updated EPG instructions for MythTV in New Zealand

, 1 Comment »

I’ve been learning a bit more about Linux over the last few weeks and updated my electronic program guide (EPG) configuration to better reflect “standard” file location usage. The changes work better for my backup strategy as well as I do not backup any directory that starts with a dot.

  1. The location of the EPG script has changed. The EPG related scripts are now in the /home/mythtv/epg directory. Within that directory are two further directories. One for the old xmlTVNZ EPG configuration and the other for the new nice EPG configuration.
  2. The name of the EPG script has been changed. It is now simply called nice.sh and lives in the /home/mythtv/epg directory.
  3. The nice.sh script has been modified to log to the /var/log/mythtv directory:
    cd /home/mythtv/epg/nice
    wget http://nice.net.nz/epg/listings.xml.gz
    gunzip -f listings.xml.gz
    rm /var/log/mythtv/mythfilldatabase.log
    mythfilldatabase --no-delete --file 1 -1 listings.xml --update > /var/log/mythtv/mythfilldatabase.log
Design by j david macor.com.Original WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in