Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Cleaning up at sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cleaning up at sleep



Is your driver already power managed? Do you call PMinit() and registerPowerDriver() in your start routine?

If you've done that correctly you will get a IOService::setPowerState() call telling you to power down your hardware at sleep time. Of course this doesn't give you a lot of time to flush data to disk. You can also implement IOService::powerStateWillChangeTo() to get notified when the state is about to change but before any drivers have been told to power down. If I were you I'd poke around in the kernel sleep code for all the nitty gritty. Then again, poking around in there is my job. You might not enjoy it so much...
xnu/iokit/Kernel/IOServicePM.cpp
xnu/iokit/IOKit/IOService.h

If you have a user app that's running parallel to your driver you might consider subscribing to impending sleep notifications from user space and taking your pre-sleep action there. See Wayne's code example on 2-15 for this route.

-ethan

On Thursday, February 14, 2002, at 06:28 PM, Andre John Mas wrote:

Is there any way to know when the computer is going to sleep so that
my driver can put the device in the right state. For example flushing
all data to a disk, so that no data is lost if it is unplugged after
sleep, but before being properly unmounted?

Andre

--
mailto:email@hidden
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.

References: 
 >Cleaning up at sleep (From: Andre John Mas <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.