Suspend: RTC wakeup, sleep
pgf at laptop.org
Wed Jul 28 11:44:24 EDT 2010
> Can somebody give me a pointer to some sample code that will wake up a
> suspended system in 5 minutes? I'm assuming there is some way to do this
> using the alarm interrupt from the RTC.
rtcwake -s 600 -m mem
to wake the system in 600 seconds, after suspending it to S3.
see the man page -- but other -m options work, including "no", i
believe. (although, if someone tries it and it does work, i'll
> Can somebody confirm that sleep does what I expect on suspended systems?
> My expectation is that the sleep timer logically ticks when suspended, but
> that the system won't get woken up when the sleep timer expires.
> For example, suppose my program does a sleep(100), and shortly after that the
> system suspends.
> If the next wakeup is 200 seconds after the start of the sleep, my program
> should run then (along with whatever caused the wakeup).
> Or if the system wakes up after 50 seconds and doesn't suspend again, my
> program should run 100 seconds after it started to sleep.
i'm afraid not. your sleep will be stretched by the duration of
the suspend. see the following. a 30 second sleep starts at
15:42:41. the system suspends for 15 seconds, and wakes (that's
where the "+r" gets printed) at 15:43:01 (2 seconds later than it
expected to, btw). the sleep terminates, and prints "sleep
ended" and the date at 15:43:25. that's roughly 45 seconds after
the 30 second sleep started.
[root at xo-a7-2a-c8 dev]# touch /var/run/powerd-inhibit-suspend/1
[root at xo-a7-2a-c8 dev]# (date; sleep 30; echo sleep ended; date) &
Wed Jul 28 15:42:41 GMT 2010
[root at xo-a7-2a-c8 dev]# rtcwake -s 15 -m mem; date
rtcwake: assuming RTC uses UTC ...
rtcwake: wakeup from "mem" using /dev/rtc0 at Wed Jul 28 15:42:59 2010
+rWed Jul 28 15:43:01 GMT 2010
[root at xo-a7-2a-c8 dev]# sleep ended
Wed Jul 28 15:43:25 GMT 2010
paul fox, pgf at laptop.org
More information about the Devel