Manual sleep vs automatic sleep
Manual sleep vs automatic sleep
- Subject: Manual sleep vs automatic sleep
- From: "rohit dhamija" <email@hidden>
- Date: Wed, 13 Sep 2006 22:42:26 +0530
Hi All,
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();
//
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden