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: Tue, 12 Dec 2006 14:55:10 -0800
Hi Sean-
To be clear, the kIOMessageCanSystemSleep message only allows you to
prevent IDLE sleep. If you close the clamshell or sleep via the Apple
menu, your callback will never receive the kIOMessageCanSystemSleep
message. There is no way to prevent non-idle sleeps.
That said, yes, this code should work in 10.3.9, 10.4.8, and 9A303. I
use it all the time.
* Are you getting any error returns from any of the IOKit or CF calls
in main()?
* Where are your breaks/printfs/asserts - are you breaking on the
invocation of your callback function itself? Or only in the
kIOMessageCanSystemSleep code (which will not get called on a force
sleep)?
Yep. I'm stumped.
-Ethan
On Dec 12, 2006, at 1:42 PM, Sean McBride wrote:
Hi all,
QA1340 "Registering and unregistering for sleep notifications" is just
what I was looking for.
<http://developer.apple.com/qa/qa2004/qa1340.html>
I copy and pasted the code from 'listing 1' and put it in a brand new
Xcode 'CoreFoundation tool' project. But the callback function
specified to IORegisterForSystemPower() is never called! I've put a
breakpoint, printf, and assert(0).
Is anyone using this code? I've tried in 10.3.9, 10.4.8, and 9a303
and
it just doesn't seem to work at all.
(PS: yes, I have a good reason to deny sleep: firmware update over
RS-232.)
Thanks,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
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