Bug 5833
Summary: | Add the support for alarm relative time in sysfs | ||
---|---|---|---|
Product: | ACPI | Reporter: | Christian Lupien (lupien) |
Component: | Power-Sleep-Wake | Assignee: | ykzhao (yakui.zhao) |
Status: | CLOSED PATCH_ALREADY_AVAILABLE | ||
Severity: | normal | CC: | acpi-bugzilla |
Priority: | P2 | ||
Hardware: | i386 | ||
OS: | Linux | ||
Kernel Version: | 2.6.14 | Subsystem: | |
Regression: | --- | Bisected commit-id: | |
Attachments: | patch of drivers/acpi/sleep/proc.c to fix/improve alarm |
Description
Christian Lupien
2006-01-05 08:09:08 UTC
Created attachment 6966 [details]
patch of drivers/acpi/sleep/proc.c to fix/improve alarm
I changed the drivers/acpi/sleep/proc.c code related to the alarm to
fix/improve what I described in the bug report.
With this patch, cat /proc/acpi/alarm prints (on my machine)
****-**-00 01:04:00 -int (2006-01-07 23:08:52)
On my machine only the day is setable not the month for the alarm. Anything not
setable is replaced by *. The -int says the interupt is currently disabled.
When an alarm is set it shows +int. In parathensis it shows the rtc current
date/time (including correct century).
To set the alarm, it works as before:
echo "0000-00-02 1:0:0" >/proc/acpi/alarm
sets the alarm for the second of the month at 1am.
echo "+0000-00-00 1:0:0" >/proc/acpi/alarm
sets the alarm in 1 hour.
And I added the following:
echo "-" >/proc/acpi/alarm
which disables the currently set alarm.
BTW setting a day or month of 0 is valid, the RTC clock uses that to skip month
or day detection. Therefore an alarm of 0000-00-00 1:0:0 will be activated any
day of the month at 1 am. It is possible to have a similar effect for
hour/min/sec but I did not implement it (need to write something like 0xff to
cmos).
I tested the patch, but not fully since my machine does not have month.
Looks great! Thanks for the patch! One minor comment: why did you not show/set the centry alarm if the system supports the feature? I show the century in the current date between parenthesis. I do not set the century because it is not an alarm (there is no year alarm and some machine, like mine, don't even have month alarm). It is the century part of the rtc date. It could be set in the main kernel rtc clock or it could be set in an acpi interface to set the current rtc date/time. I almost added a /proc/acpi/date that would show/set the current date/time including the century but that meant repeating the code already in the main kernel rtc so I did not. Eventually it could be a good idea (maybe when full handlers to the cmos extensions are added). haha, I understand. Great! I'll mark this one as resolved, so Len Brown will merge this patch. Thanks! Upon 2.6.21, the rtc-sysfs creates /sys/class/rtc which is going to replace /proc/acpi/alarm. So we should not enhance the parsing for /proc/acpi/alarm, as is is going to be deleted in the forseeable future. Instead, any efforts here should be focused on the new generic rtc code. closed. Len, why is this bug reopened? thanks, rui we allowed some fixes to /proc/acpi/ recently, and shaohua suggested if we did that then we should re-examine this one. I think this bug can be closed if Yakui's patch hits linus tree. The following commit is added to linus tree.
>commit c116bc2ae516e9949d645bc75b1ee294ff15db23
>Author: Zhao Yakui <yakui.zhao@intel.com>
>Date: Mon Apr 28 02:11:58 2008 -0700
> rtc: add the support for alarm time relative to current time in sysfs
So the bug will be marked as the resovled.
|