periodic wakeup during sleep? (thinking ahead)

Owen Williams owen at ywwg.com
Tue Nov 21 19:50:45 EST 2006


One of the activities I plan to write once I get my laptop is a
time-telling / clock activity.  One thing kids need to learn is how to
read a clock, so I thought I'd write a simple activity that would help
kids learn what times look like in analog, digital, and words.  The next
natural step would be to make it a functional clock and add alarm
capability.  There could be a simple alarm that would flash the
backlight as well as play a sound.  (olpc: introducing children to the
snooze button.)

The only problem with this plan is that it would require the laptop to
be on and unsuspended to allow the clock application to check the time.
This is not a reasonable use of resources.

Palm OS also has this problem, and their solution (AFAIK) is that every
minute the OS awakes into light sleep and basically asks if anyone wants
the OS to wake up all the way.  At this point the clock applet checks
the time, and if there's < 1 minute left on the alarm, it wakes the OS
up all the way.  Then it counts down the last seconds and triggers the
alarm.

Would it be possible to have similar behavior in the olpc?  I'm
imagining an API like gobject.timeout_add that I could hook up to.
Then, during sleep, my callback would get pinged once every minute.  If
I return True, the laptop stays asleep.  But if I return False, the
laptop wakes up and the rest of my code executes.

Or is there maybe a way to hook into the wake-on-lan features to
accomplish this?

thanks, 
owen williams




More information about the Devel mailing list