kernel 2.6.23
I want to be able to start one of my machines with RTC Wakeup Alarm but it isn't working and I've just found out why.
If I cd into /sys/class/rtc/rtc0 and set the wakeup time as follows:
echo $(( $(cat since_epoch) + 300 )) > wakealarm
and then look to see what is there:
cat wakealarm
I get something like 2059580189 (which converts to a time in April) whereas from 'cat since_epoch' I get someting like 1204369402 (which converts to the current date/time.
Any ideas as to what may be happening here?
Barry,
On 1 Mar 2008, at 2:28 pm, Barry Samuels wrote:
kernel 2.6.23
I want to be able to start one of my machines with RTC Wakeup Alarm but it isn't working and I've just found out why.
If I cd into /sys/class/rtc/rtc0 and set the wakeup time as follows:
echo $(( $(cat since_epoch) + 300 )) > wakealarm
and then look to see what is there:
cat wakealarm
I get something like 2059580189 (which converts to a time in April) whereas from 'cat since_epoch' I get someting like 1204369402 (which converts to the current date/time.
Any ideas as to what may be happening here?
Did you ever make any progress on this?
I'm having terrible trouble trying to get this to work with my mini- itx board so any tips would be very well received ;)
Cheers,
Dave
On 11/03/08 16:33:37, David Reynolds wrote:
Barry,
On 1 Mar 2008, at 2:28 pm, Barry Samuels wrote:
kernel 2.6.23
I want to be able to start one of my machines with RTC Wakeup Alarm but it isn't working and I've just found out why.
If I cd into /sys/class/rtc/rtc0 and set the wakeup time as follows:
echo $(( $(cat since_epoch) + 300 )) > wakealarm
and then look to see what is there:
cat wakealarm
I get something like 2059580189 (which converts to a time in April) whereas from 'cat since_epoch' I get someting like 1204369402 (which converts to the current date/time).
Any ideas as to what may be happening here?
Did you ever make any progress on this?
I'm having terrible trouble trying to get this to work with my mini- itx board so any tips would be very well received ;)
Cheers,
Dave
Sorry Dave I haven't. I think that my board is described as a mini-atx but I don't know whether that would have any bearing on the matter.
Are you having the same stored 'time' trouble that I'm having or something else?
Barry,
On 11 Mar 2008, at 5:29 pm, Barry Samuels wrote:
Sorry Dave I haven't. I think that my board is described as a mini-atx but I don't know whether that would have any bearing on the matter.
I think it probably more depends on the Bios chipset than the form factor. My Bios chipset are VIA.
Are you having the same stored 'time' trouble that I'm having or something else?
Just basically anything I try putting in doesn't seem to work, I wondered if I was missing something basic.
Also, I'm using /proc/acpi/alarm rather than /sys/class/rtc/rtc0/ wakealarm - I think this was a change between 2 kernel revisions.
Anyone else had any experience of making the ACPI alarm work?
Thanks
On 12/03/2008, David Reynolds david@reynoldsfamily.org.uk wrote:
Anyone else had any experience of making the ACPI alarm work?
I've got the alarm working on my Mini-ITX M10000. I have a script called set_alarm.sh which I wrote which contains:
#/bin/bash
if [ "$1" = "--settime" ]; then # convert from seconds since epoc to string date_with_tz=$(awk "BEGIN {print strftime("%Y-%m-%d %H:%M:%S %Z", $2)}") else # gnu date can't handle the T gnu_friendly_date=$(echo $* | sed 's/T/ /') # add local timezone date_with_tz=$(date -d "$gnu_friendly_date") fi # hw clock is in UTC so convert date to UTC hw_date=$(echo "$date_with_tz" | date -u -f - +%F\ %T) echo "Setting wakeup time to $hw_date UTC" echo "$hw_date" > /proc/acpi/alarm
You can run this like, "set_alarm.sh 11pm" to set the machine to wake up today at 11pm, or you can specify a full time and date. Basically you can specify anything that the date program understands. I also needed to change my shutdown scripts so that when then run hwclock to sync the OS time to the bios it saves and restores the alarm time. e.g.:
ACPITIME=`cat /proc/acpi/alarm` /sbin/hwclock --systohc echo "$ACPITIME" > /procacpi/alarm
This is a known problem with my motherboard and now I've done that it all works for me and I'm using it to shut down my tv machine which runs mythtv and wake it up in time to start recording the next program. I think I originally got the instructions from here http://www.mythtv.org/wiki/index.php/ACPI_Wakeup
HTH,
JD
Jon,
On 12 Mar 2008, at 12:37 pm, Jon Dye wrote:
On 12/03/2008, David Reynolds david@reynoldsfamily.org.uk wrote: Anyone else had any experience of making the ACPI alarm work?
I've got the alarm working on my Mini-ITX M10000. I have a script called set_alarm.sh which I wrote which contains:
#/bin/bash
if [ "$1" = "--settime" ]; then # convert from seconds since epoc to string date_with_tz=$(awk "BEGIN {print strftime("%Y-%m-%d %H:%M:% S %Z", $2)}") else # gnu date can't handle the T gnu_friendly_date=$(echo $* | sed 's/T/ /') # add local timezone date_with_tz=$(date -d "$gnu_friendly_date") fi # hw clock is in UTC so convert date to UTC hw_date=$(echo "$date_with_tz" | date -u -f - +%F\ %T) echo "Setting wakeup time to $hw_date UTC" echo "$hw_date" > /proc/acpi/alarm
You can run this like, "set_alarm.sh 11pm" to set the machine to wake up today at 11pm, or you can specify a full time and date. Basically you can specify anything that the date program understands. I also needed to change my shutdown scripts so that when then run hwclock to sync the OS time to the bios it saves and restores the alarm time. e.g.:
ACPITIME=`cat /proc/acpi/alarm` /sbin/hwclock --systohc echo "$ACPITIME" > /procacpi/alarm
This is a known problem with my motherboard and now I've done that it all works for me and I'm using it to shut down my tv machine which runs mythtv and wake it up in time to start recording the next program. I think I originally got the instructions from here http://www.mythtv.org/wiki/index.php/ACPI_Wakeup
I'm pleased to say that this works perfectly - thanks Jon.
On Wed, 2008-03-12 at 12:03 +0000, David Reynolds wrote:
Anyone else had any experience of making the ACPI alarm work?
Thanks
Yes it worked for me once, I think I modprobed nvram and then used nvram-wakeup. To refresh my memory I just installed it, modprobed nvram and ran nvram-wakeup with no options and it returned the following
WakeUp : Disabled (0x08) Day : 15 (0x78) Hour : 12 (0x2C) Minute : 30 (0x1E) Second : 30 (0x9E) rtcDay : 00 (0x00) rtcHour : 122 rtcMin : 136 rtcSec : 120 Checksum: 0x5A6F
So at least at first glance if I used nvram-wakeup to set the wakeup enabled bit it looks like it might work. But currently I am not in a position to power cycle my box to test that. Bit suspicious that my current day appears to be 0 but that may just be that my rtc only supports hour/min/second for alarm events (at a random guess)
On a side note, the reason last time I did it this way through the nvram module was that someone who should know told me that if you echo stuff straight in, you can stuff the checksum of the nvram (which will force it to load defaults next time you boot) Dunno how much truth there is to that but it sounds almost plausible.
Oh and of course we are all clever enough to think of this, but it might be worth checking that your bios clock isn't set to UTC or something as you would have to figure that in when specifying the wakeup time.
On 12/03/2008, Wayne Stallwood ALUGlist@digimatic.co.uk wrote:
Oh and of course we are all clever enough to think of this, but it might be worth checking that your bios clock isn't set to UTC or something as you would have to figure that in when specifying the wakeup time.
The /proc/acpi/alarm time just needs to be the same timezone as the bios clock AFAIK. i.e. I have my BIOS clock set in UTC and therefore when I set an alarm I need to specify the time in UTC too. The script I (hopefully) just posted to the list does this conversion.
JD
On 12 Mar 13:23, Wayne Stallwood wrote:
Oh and of course we are all clever enough to think of this, but it might be worth checking that your bios clock isn't set to UTC or something as you would have to figure that in when specifying the wakeup time.
NAUGHTY WAYNE. The BIOS clock should *always* be set to UTC. The OS should do localisation. Suggesting anything else deserves wrapped knuckles and no beer for a month.