Re: Preventing system sleep, QA1340 code does not seem to work
Re: Preventing system sleep, QA1340 code does not seem to work
- Subject: Re: Preventing system sleep, QA1340 code does not seem to work
- From: Ethan Bold <email@hidden>
- Date: Thu, 14 Dec 2006 15:13:35 -0800
On Dec 14, 2006, at 11:20 AM, Sean McBride wrote: 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.
If you have display sleep and system sleep set to 1 minute, system sleep may not kick in for a whole 'nother minute, until you hit the 2 minute mark. Or even longer if there's disk activity. Disk activity keeps the system awake indefinitely, and also makes the actual sleep time non-deterministic.
Hence, you gotta wait at least a couple of minutes past the scheduled 1 minute time to check for system sleep. If the system still has not fully slept (e.g. if the power light has not started throbbing yet), then you have stray activity (or a sleep-preventing application) that hasn't allowed sleep yet. 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. :)
Magic numbers they are. 25 or 30 should work fine; 30 seconds is the minimum amount of time that a display can dim in, so I pick 25 to make sure the timers are always cleared well before they try to dim the display, preventing any flickering. It's all voodoo, your pick.
-Ethan |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden