Package: util-linux Version: 2.13.1.1-1 Severity: normal Hi,
Whilst trying to get our Dull server to wakeup at a specific time I had a go at playing around with the ACPI RTC wakeup alarm[1] functionality of the system. Apart from being disappointed at Dull using sub-standard parts and only giving me an upper limit of 24 hours into the future for a wakeup event I found that the Debian hwclock.sh inadvertantly nukes this ability on shutdown[2]. I have attached a patch that tests if the RTC alarm has been set to a time in the future and if so restore it after the --systohc command is executed; thus letting this handy but not often used functionality work. Hopefully it's considered sane :) Cheers Alex [1] http://acpi.sourceforge.net/documentation/alarm.html [2] http://www.mythtv.org/wiki/index.php/ACPI_Wakeup#Disable_hwclock_updates -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.26 (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages util-linux depends on: ii libc6 2.7-12 GNU C Library: Shared libraries ii libncurses5 5.6+20080713-1 shared libraries for terminal hand ii libselinux1 2.0.65-2 SELinux shared libraries ii libslang2 2.1.3-3 The S-Lang programming library - r ii libuuid1 1.41.0-3 universally unique id library ii lsb-base 3.2-15 Linux Standard Base 3.2 init scrip ii tzdata 2008c-1 time zone and daylight-saving time ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime util-linux recommends no packages. Versions of packages util-linux suggests: ii console-tools 1:0.2.3dbs-65.1 Linux console and font utilities ii dosfstools 2.11-6 utilities for making and checking ii util-linux-locales 2.13.1.1-1 Locales files for util-linux -- no debconf information
--- /etc/init.d/hwclock.sh.orig 2007-12-22 13:47:04.000000000 +0000 +++ /etc/init.d/hwclock.sh 2008-07-28 11:37:21.533178944 +0100 @@ -96,6 +96,20 @@ # WARNING: If you disable this, any changes to the system # clock will not be carried across reboots. # + # We also check to see if the RTC Alarm has been set and restore + # it if it's applicable (set to a time in the future) + # FIXME: rtc0 => rtcN? + # + for RTCALARMDEV in /sys/class/rtc/rtc0/wakealarm /proc/acpi/alarm; do + if [ -e $RTCALARMDEV ]; then + RTCWAKETIME=`cat $RTCALARMDEV` + if [ `date -d "$RTCWAKETIME" +%s` -le `date +%s` ]; then + RTCWAKETIME="" + fi + + break + fi + done if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Saving the system clock." if [ "$GMT" = "-u" ]; then @@ -106,6 +120,10 @@ else verbose_log_action_msg "Not saving System Clock" fi + if [ "$RTCWAKETIME" != "" ]; then + log_action_msg "Priming RTC Alarm for $RTCWAKETIME" + echo "$RTCWAKETIME" > $RTCALARMDEV + fi ;; show) if [ "$HWCLOCKACCESS" != no ]; then