Hi,
I found this in IOKit, im working on a kext *my first one* and im trying to be notified when the systems lid (clamshell) is opened, how do i register to receive the notification?
/******************************************************************************* * * Root Domain general interest messages * ******************************************************************************/
/* kIOPMMessageClamshellStateChange * Delivered as a general interest notification on the IOPMrootDomain * IOPMrootDomain sends this message when state of either AppleClamshellState * or AppleClamshellCausesSleep changes. If this clamshell change results in * a sleep, the sleep will initiate soon AFTER delivery of this message. * The state of both variables is encoded in a bitfield argument sent with * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit */ enum { kClamshellStateBit = (1 << 0), kClamshellSleepBit = (1 << 1) };
#define kIOPMMessageClamshellStateChange \ iokit_family_msg(sub_iokit_powermanagement, 0x100)
/* kIOPMMessageFeatureChange * Delivered when the set of supported features ("Supported Features" dictionary * under IOPMrootDomain registry) changes in some way. Typically addition or * removal of a supported feature. * RootDomain passes no argument with this message. */ #define kIOPMMessageFeatureChange \ iokit_family_msg(sub_iokit_powermanagement, 0x110)
/* kIOPMMessageInflowDisableCancelled * The battery has drained completely to its "Fully Discharged" state. * If a user process has disabled battery inflow for battery * calibration, we forcibly re-enable Inflow at this point. * If inflow HAS been forcibly re-enabled, bit 0 * (kInflowForciblyEnabledBit) will be set. */ enum { kInflowForciblyEnabledBit = (1 << 0) };
#define kIOPMMessageInternalBatteryFullyDischarged \ iokit_family_msg(sub_iokit_powermanagement, 0x120) |