Open Device Daemon, Progress Resport 3 [GSoC]

andrzej zaborowski balrogg at gmail.com
Wed Jun 11 01:21:09 CEST 2008


On 10/06/2008, Sudharshan S <sudharsh at gmail.com> wrote:
>  The folks at #openmoko suggested inotify, which seems to be perfect
>  given the task at hand, notification from the OS itself when some file
>  changes (In this case, battery_status), Based on this I could emit a
>  signal with status as the payload.
>
>  But it seems that the kernel needs some special patches. It would be
>  cool if someone confirms the presence of inotify in the default kernel
>  of OM. If yes, wonderful. If no, is there a better method than polling
>  every n seconds?
>  I bet I am missing something very trivial here..:)

If battery_status is a sysfs file then inotify won't work on it.
Inotify is in all recent kernels but it only makes sense for physical
files because the files in sysfs don't have any content except in the
very moment they are read, they're generated on the fly (those that
support reading).  A write as well as a read from such files can have
side effects.  Plus, the only way to implement inotify for the
battery_state would be by polling in the kernel, so no difference
really.

I'm afraid it's pretty normal for battery level to be polled, with the
exception of some critical events that generate signals in PMU. PalmOS
had a 1s interval hardcoded.

Cheers
-- 
Please do not print this email unless absolutely necessary. Spread
environmental awareness.



More information about the openmoko-devel mailing list