site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Hello- Instead call: IOService::PMinit() IOService::joinPMtree() IOService::registerPowerDriver() And you can receive your sleep/wake notifications by overriding: IOService::setPowerState() http://darwinsource.opendarwin.org/Current/IOPCIFamily-34/IOPCIDevice.cpp static IOPMPowerState powerStates[ kIOPCIDevicePowerStateCount ] = { { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, IOPMPowerOn, IOPMPowerOn, 0, 0, 0, 0, 0, 0, 0, 0 } }; -Ethan On Sep 13, 2006, at 10:12 AM, rohit dhamija wrote: Hi All, // OReturn MyDriver::handlePowerEvent(void *target,void *refCon, UInt32 messageType,IOService *provider, void *messageArgument,vm_size_t argSize) { IOReturn err = kIOReturnUnsupported; MyDriver *tmpSntl = OSDynamicCast(MyDriver, (OSObject*)target); if(!tmpSntl) { DBLog(("\nMyDriver::handlePowerEvent, ERROR! provider invalid.\n")); return err; } switch (messageType) { case kIOMessageCanSystemSleep: break; case kIOMessageSystemWillSleep: MYLOGIC_FOR_SAVING_CONTEXT(); err = kIOReturnSuccess; break; case kIOMessageSystemWillNotSleep: break; default: err = kIOReturnUnsupported; break; } return(err); } Thanks and Regards, Rohit Dhamija -- Rohit Dhamija(M) 9818446545 _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/ebold%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This is not the optimal API-set to use to power manage your driver. For one thing, this API does not guarantee proper sleep/wake ordering between you and your provider. I just quickly googeld for "setPowerState" and found this IOPCIDevice.cpp example of signing up for power management. Your code will look very similar to that, except you only need two power states (0 == off; 1 == on): I have developed kext for my USB bulk device for Mac OS X 10.4.7 ppc G5/Intel. I need to save some context information before the system goes to sleep mode. The user can either do a manual sleep (going top left , click apple button and then sleep) or automatic sleep ( it will sleep as per the settings done in Energysaver ) Is there any difference b/w these two types of sleep ? Are there various types of sleep that we need to handle ? Below is the peice of code for handling sleep notification. But I am not sure if it will cater all types of sleep - sleep manual as well automatic. Please suggest. // register sleep notification _powerEventNotifier = registerPrioritySleepWakeInterest(MyDriver::handlePowerEvent,this); if (_powerEventNotifier) { retain(); This email sent to ebold@apple.com This email sent to site_archiver@lists.apple.com