• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Lid opened notification?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lid opened notification?


  • Subject: Re: Lid opened notification?
  • From: Andrew James <email@hidden>
  • Date: Sun, 29 Apr 2007 21:31:58 +0930

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Lid opened notification?
      • From: Manfred Schwind <email@hidden>
    • Re: Lid opened notification?
      • From: "Finlay Dobbie" <email@hidden>
References: 
 >Lid opened notification? (From: Andrew James <email@hidden>)
 >Re: Lid opened notification? (From: "Finlay Dobbie" <email@hidden>)
 >Re: Lid opened notification? (From: Andrew James <email@hidden>)
 >Re: Lid opened notification? (From: Keith Duncan <email@hidden>)

  • Prev by Date: Hide baseline separator in toolbar
  • Next by Date: Re: Monitor opened files
  • Previous by thread: Re: Lid opened notification?
  • Next by thread: Re: Lid opened notification?
  • Index(es):
    • Date
    • Thread