Re: Preventing system sleep, QA1340 code does not seem to work
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Organization: Rogue Research On 2006-12-14 11:04, Ethan Bold said:
On Dec 13, 2006, at 1:41 PM, Sean McBride wrote:
But does 'idle sleep' include the display? That is, if in the callback I refuse idle sleep will both the display and cpu stay awake?
No, idle sleep does not include the display. Using the API's per QA1340 will prevent system sleep, but will allow the display to sleep
Thanks for this info. I also need to stop the display sleeping so the QA1340 technique is no good anyway (phew! since I can't get it to work).
normally. It sounds like this might be what you're seeing - the display sleeping while the system remains awake.
I don't think so, because I don't even hit the callback at all. And both my display and system sleep settings are at 1 minute.
So you want to keep the display awake? The short answer is that it's pretty ugly API to do so; the even shorter answer is that all you have to do is call the Carbon.framework call UpdateSystemActivity() every 25 seconds. This generates a fake HID UI event, like a mouse move, frequently enough to prevent idle display sleep AND idle system sleep.
Is 25 seconds better? QA1160 uses 30 seconds. I hate magic numbers. :)
Note that the display must idle sleep before the system can idle sleep. This is a restriction of PM's idle sleep behavior; so if you prevent disply sleep with NULL HID activity (via UpdateSystemActivity()), the system will never idle sleep either.
Perfect. The UpdateSystemActivity() is working exactly as I need. Thanks! -- ____________________________________________________________ Sean McBride, B. Eng sean@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Sean McBride