Skip navigation.
 
mlRe: Lid opened notification?
FROM : Andrew James
DATE : Sun Apr 29 14:01:58 2007

I looked through there and found a few things that might help but ive 
never used with this kind of stuff, anyone able to shed light on 
these? Im happy if i have to code a small kext to do what im trying 
to achieve which at the moment is detect the lid opening and run a 
set of commands, but a bigger goal would be disabling clamshell all 
together (much like Insomnia, which is broken at the moment)

/
************************************************************************
*******
  *
  * Power commands issued to root domain
  *
  * These commands are issued from system drivers only:
  *      ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
  *
 
************************************************************************
******/
enum {
  kIOPMSleepNow                = (1<<0),  // put machine to sleep now
  kIOPMAllowSleep              = (1<<1),  // allow idle sleep
  kIOPMPreventSleep            = (1<<2),  // do not allow idle sleep
  kIOPMPowerButton              = (1<<3),  // power button was pressed
  kIOPMClamshellClosed          = (1<<4),  // clamshell was closed
  kIOPMPowerEmergency          = (1<<5),  // battery dangerously low
  kIOPMDisableClamshell        = (1<<6),  // do not sleep on 
clamshell closure
  kIOPMEnableClamshell          = (1<<7),  // sleep on clamshell 
closure
  kIOPMProcessorSpeedChange    = (1<<8),  // change the processor 
speed
  kIOPMOverTemp                = (1<<9),  // system dangerously hot
  kIOPMClamshellOpened          = (1<<10)  // clamshell was opened
};

/
************************************************************************
*******
  *
  * Root Domain property keys of interest
  *
 
************************************************************************
******/

/* AppleClamshellState
  * reflects the state of the clamshell (lid) on a portable.
  * It has a boolean value.
  *  true        == clamshell is closed
  *  false      == clamshell is open
  *  not present == no clamshell on this hardware
  */
#define kAppleClamshellStateKey            "AppleClamshellState"

/* AppleClamshellCausesSleep
  * reflects the clamshell close behavior on a portable.
  * It has a boolean value.
  *  true        == system will sleep when clamshell is closed
  *  false      == system will not sleep on clamshell close
  *                  (typically external display mode)
  *  not present == no clamshell on this hardware
  */
#define kAppleClamshellCausesSleepKey      "AppleClamshellCausesSleep"




On 28/04/2007, at 9:30 PM, Keith Duncan wrote:

>> Specifically notifications about the lid

>
> It might be possible, look at the IOPM.h header file in the IOKit 
> framework. More specifically look for the key kAppleClamshellStateKey.
>
> Unfortunately I've never used this so I can help you out in that 
> regard - I only know about it from when I was rummaging through the 
> IOKit for some basic sleep/wake notifications.
>
> - Keith

Related mailsAuthorDate
mlLid opened notification? Andrew James Apr 27, 14:22
mlRe: Lid opened notification? Finlay Dobbie Apr 27, 18:08
mlRe: Lid opened notification? Andrew James Apr 28, 02:33
mlRe: Lid opened notification? Finlay Dobbie Apr 28, 12:15
mlRe: Lid opened notification? Keith Duncan Apr 28, 14:00
mlRe: Lid opened notification? Andrew James Apr 29, 14:01
mlRe: Lid opened notification? Finlay Dobbie Apr 29, 19:49
mlRe: Lid opened notification? Manfred Schwind Apr 29, 21:40
mlRe: Lid opened notification? Roland Torres Apr 30, 20:27
mlRe: Lid opened notification? j o a r Apr 30, 21:55
mlRe: Lid opened notification? Uli Kusterer May 2, 21:55
mlRe: Lid opened notification? Roland Torres May 3, 00:50
mlRe: Lid opened notification? Drarok Ithaqua May 3, 02:05
ml[Moderator] EOT Re: Lid opened notification? cocoa-dev-admins May 3, 02:53