Lid opened notification?
-
Hi,
Is there any notifications that can detect if the lid of a laptop was
opened? if so where can i get the code for them from? -
On 27/04/07, Andrew James <semaja2...> wrote:
> Hi,
>
> Is there any notifications that can detect if the lid of a laptop was
> opened? if so where can i get the code for them from?
Are you looking for sleep/wake notifications or specifically "lid"
notifications?
-- Finlay -
Hi,
Specifically notifications about the lid
Kind Regards,
Andrew James
MultiAlarm Developer
InsomniaX Developer
WiFiScriptor Developer
Utility Lock Developer
SyncBar Developer
Project Orion Leader
Kings LAN Manager
Custom-X Manager
Skype: semaja2
Google Talk: <semaja2...>
Email: <semaja2...>
AIM: multialarm
ICQ: 483132804
MSN: <semaja2...>
Yahoo: <semaja2...>
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and
may be
privileged. It is intended for the addressee(s) only. Access to this
e-mail by
anyone else is unauthorised and may be unlawful.
If you are not an addressee, please inform the sender immediately.
E-mail messages can be intercepted, corrupted, lost or contain viruses.
The sender does not accept liability for any errors or omissions in the
contents of this message which arise during e-mail transmission.
On 28/04/2007, at 1:38 AM, Finlay Dobbie wrote:
> On 27/04/07, Andrew James <semaja2...> wrote:
>> Hi,
>>
>> Is there any notifications that can detect if the lid of a laptop was
>> opened? if so where can i get the code for them from?
>
> Are you looking for sleep/wake notifications or specifically "lid"
> notifications?
>
> -- Finlay
-
On 28/04/07, Andrew James <semaja2...> wrote:
> Hi,
>
> Specifically notifications about the lid
I am not aware of any supported way to obtain that information,
certainly not through a high-level interface such as Cocoa. I could be
wrong.
-- Finlay -
> 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 -
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
-
On 29/04/07, Andrew James <semaja2...> wrote:
> 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)
As this is an IOKit question, you might get a better response on one
of the Darwin lists.
-- Finlay -
> ... but a bigger goal would be disabling clamshell all together
> (much like Insomnia, which is broken at the moment)
To prevent the Mac to wake-up on lid opening, just enter that in the
Terminal:
sudo pmset lidwake 0
(To turn it on again, replace the 0 with a 1 and)
Regards,
Manfred Schwind
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad. -
On Apr 29, 2007, at 12:40 PM, Manfred Schwind wrote:
>> ... but a bigger goal would be disabling clamshell all together
>> (much like Insomnia, which is broken at the moment)
>
> To prevent the Mac to wake-up on lid opening, just enter that in
> the Terminal:
>
> sudo pmset lidwake 0
>
> (To turn it on again, replace the 0 with a 1 and)
How to do the reverse? I.e., prevent the Mac from sleeping when the
lid is closed?
Roland -
On 30 apr 2007, at 20.27, Roland Torres wrote:
> How to do the reverse? I.e., prevent the Mac from sleeping when the
> lid is closed?
I don't think that you can, and I think that's on purpose. You can
prevent "soft" / "idle" sleep though.
j o a r -
On 30.04.2007, at 20:27, Roland Torres wrote:
> How to do the reverse? I.e., prevent the Mac from sleeping when the
> lid is closed?
Mmmhhh... I smell Sunday roast ... what do you mean that's my iBook
overheating???
Cheers,
-- M. Uli Kusterer
http://www.zathras.de -
On May 2, 2007, at 12:55 PM, Uli Kusterer wrote:
> On 30.04.2007, at 20:27, Roland Torres wrote:
>> How to do the reverse? I.e., prevent the Mac from sleeping when
>> the lid is closed?
>
> Mmmhhh... I smell Sunday roast ... what do you mean that's my
> iBook overheating???
Well, I assumed the screen and backlight would be off, just that the
CPU wouldn't sleep. There used to be a trick for doing this, and it
worked well -- no Sunday roast -- but that hole's been "fixed".
Roland -
Apparently doing this can cause damage to the display if done for
long periods of time - that's from an Apple 'Genius', but I don't
know how true it is.
It used to be that with a powerbook, if you connected an external
display and keyboard, closing the lid simply turned off the internal
display and left you with a tiny workstation.
On 2 May 2007, at 11:50 pm, Roland Torres wrote:
>
> On May 2, 2007, at 12:55 PM, Uli Kusterer wrote:
>
>> On 30.04.2007, at 20:27, Roland Torres wrote:
>>> How to do the reverse? I.e., prevent the Mac from sleeping when
>>> the lid is closed?
>>
>> Mmmhhh... I smell Sunday roast ... what do you mean that's my
>> iBook overheating???
>
> Well, I assumed the screen and backlight would be off, just that
> the CPU wouldn't sleep. There used to be a trick for doing this,
> and it worked well -- no Sunday roast -- but that hole's been "fixed".
>
> Roland
-
This doesn't seem to be specific to Cocoa.



