FROM : Jean-Daniel Dupas
DATE : Tue Jun 03 21:11:35 2008
BezelServices is not used to control ALS but to display visual
notification like the one you see when you change the audio volume, or
when you press the eject key.
Le 3 juin 08 à 20:58, Gabriel ROUSSEAU a écrit :
> Hi,
>
> There is one thing that should be accessible from UserDefaults or by
> AppleScript, or some kind of CGDisplay or NSScreen methods, but it
> is not the case.
> On MacBooks Pro and PowerBooks (don't know for MacBooks and iBooks),
> there is a feature called ALS (Ambient Light Sensors) in the
> hardware. The computer know the ambint light level.
>
> Thats cool, and it is used to automatically adjust keyboard
> backlight and display brigthness. In System Preferences theses
> features can be enabled or disabled.
>
> I will concentrate on the Display side : In System Preferences, in
> the Display Tab, there is a way to activate or deactivate the
> feature. Great, but wait a minute ! It is the ONLY way to activate
> or deactivate it !
> No way to AppleScript this, no way to do this using defaults, no way
> to change it programatically.
>
> Why ? Because in fact, this feature is managed by a loginwindow
> plugin called BezelServices.loginPlugin that resides in /System/
> Library/LoginPlugins/
> It seems that SystemPreferences is using a PrivateFramework to
> communicate with loginwindow ; this Framework is called
> "BezelServices.Framework".
> Of course, since this is a private Framework, no way to activate or
> deactivate ALS officialy, and it means no support, no
> documentation :-(
>
> I have managed to have some more info using classdump, Instruments
> developer tool, but I am stuck. Here are all the info I have found :
> – The BezelServices.plist preference file is only read and write at
> startup and shutdown, or probably User session starting and
> stopping. Thats means trying to change values in this plist are
> useless.
> – The BezelServices.Framework can be classdumped, here is the dump :
>
> ----------
> /*
> * Generated by class-dump 3.1.2.
> *
> * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by
> Steve Nygard.
> */
> #include "CDStructures.h"
>
> @class NSMutableDictionary;
>
> @interface BSFWClient : NSObject
> {
> NSMutableDictionary *addCall; // 4 = 0x4
> // struct ProcessSerialNumber _process; // 8 = 0x8
> }
>
> - (id)init;
> - (void)dealloc;
> - (short)addCallback:(void *)fp8 ForType:(unsigned long)fp12;
> - (short)removeCallbackForType:(unsigned long)fp8;
> - (int)callbackCount;
> - (BOOL)isValidEventType:(unsigned long)fp8;
> - (unsigned short)handleBSProxyEvent:(CDAnonymousStruct1)fp8;
>
> @end
> ----------
> /*
> * Generated by class-dump 3.1.2.
> *
> * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by
> Steve Nygard.
> */
> /*
> struct ProcessSerialNumber {
> unsigned int highLongOfPSN;
> unsigned int lowLongOfPSN;
> };
> */
> typedef struct {
> unsigned int _field1;
> unsigned int _field2;
> unsigned int _field3;
> unsigned int _field4[6];
> } CDAnonymousStruct1;
> -----------
> /*
> * Generated by class-dump 3.1.2.
> *
> * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by
> Steve Nygard.
> */
>
> @protocol BezelServicesWireProtocol
> - (BOOL)registerProxyClient:(id)fp8 ForProcess:(id)fp12;
> - (BOOL)unregisterProxyClientForProcess:(id)fp8;
> - (id)preference;
> - (int)setPreference:(id)fp8;
> - (id)objectForPrefKey:(id)fp8;
> - (int)setObject:(id)fp8 forPrefKey:(id)fp12;
> - (int)ambientFeatureAvailable;
> - (int)isKeyboardSaturated:(int *)fp8;
> - (void)setKeyboardHold:(int)fp8;
> - (void)setDisplayHold:(int)fp8;
> - (void)setKeyboardValue:(float)fp8;
> - (void)setDisplayValue:(float)fp8;
> - (void)kernelPreferenceChanged:(id)fp8;
> - (void)kernelPreferenceCreate:(id)fp8 ResetToDefaults:(BOOL)fp12;
> - (int)remoteControlFeatureAvailable;
> - (void)remoteUIToggle;
> - (void)handleRemoteEventWithPage:(unsigned short)fp8 usage:
> (unsigned short)fp12 flags:(unsigned short)fp16 value:(long)fp20;
> @end
> -----------
> Interesting, we can see that the BezelServicesWireProtocol is what
> we need ! But wait, what object conforms to this protocol ? How to
> get an instance ? What the hell is a WireProtocol ?
> To have an idea, I have used Instruments to sample SystemPreferences
> exactly when I click the checkbox to change the ALS setting, and I
> have found this :
> Library Symbol Name
> ...
> AppKit -[NSApplication sendAction:to:from:]
> Brightness 0x1667f01a
> BezelServices BSSetPreferenceBool
> CoreFoundation _CF_forwarding_prep_0
> ...
> Very interesting, whe have a BezelServices Framework object using
> BSSetPreferenceBool ! Exactly what I want, but I don't know the
> Class of this object, the way to instantiate it, etc… I am still
> stuck.
> What is this "Brightness" library ? Another Private Framework ? I am
> lost at this point.
>
> So, if someone have an idea, that would be kind. The only tihng I
> want to do is activate or deactivate this ALS setting. I am not
> really insterested in the reverse engineering challenge or anything
> like that, only to find a way to activate or deactivate this ALS
> thing from my code.
>
> Regards._______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
DATE : Tue Jun 03 21:11:35 2008
BezelServices is not used to control ALS but to display visual
notification like the one you see when you change the audio volume, or
when you press the eject key.
Le 3 juin 08 à 20:58, Gabriel ROUSSEAU a écrit :
> Hi,
>
> There is one thing that should be accessible from UserDefaults or by
> AppleScript, or some kind of CGDisplay or NSScreen methods, but it
> is not the case.
> On MacBooks Pro and PowerBooks (don't know for MacBooks and iBooks),
> there is a feature called ALS (Ambient Light Sensors) in the
> hardware. The computer know the ambint light level.
>
> Thats cool, and it is used to automatically adjust keyboard
> backlight and display brigthness. In System Preferences theses
> features can be enabled or disabled.
>
> I will concentrate on the Display side : In System Preferences, in
> the Display Tab, there is a way to activate or deactivate the
> feature. Great, but wait a minute ! It is the ONLY way to activate
> or deactivate it !
> No way to AppleScript this, no way to do this using defaults, no way
> to change it programatically.
>
> Why ? Because in fact, this feature is managed by a loginwindow
> plugin called BezelServices.loginPlugin that resides in /System/
> Library/LoginPlugins/
> It seems that SystemPreferences is using a PrivateFramework to
> communicate with loginwindow ; this Framework is called
> "BezelServices.Framework".
> Of course, since this is a private Framework, no way to activate or
> deactivate ALS officialy, and it means no support, no
> documentation :-(
>
> I have managed to have some more info using classdump, Instruments
> developer tool, but I am stuck. Here are all the info I have found :
> – The BezelServices.plist preference file is only read and write at
> startup and shutdown, or probably User session starting and
> stopping. Thats means trying to change values in this plist are
> useless.
> – The BezelServices.Framework can be classdumped, here is the dump :
>
> ----------
> /*
> * Generated by class-dump 3.1.2.
> *
> * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by
> Steve Nygard.
> */
> #include "CDStructures.h"
>
> @class NSMutableDictionary;
>
> @interface BSFWClient : NSObject
> {
> NSMutableDictionary *addCall; // 4 = 0x4
> // struct ProcessSerialNumber _process; // 8 = 0x8
> }
>
> - (id)init;
> - (void)dealloc;
> - (short)addCallback:(void *)fp8 ForType:(unsigned long)fp12;
> - (short)removeCallbackForType:(unsigned long)fp8;
> - (int)callbackCount;
> - (BOOL)isValidEventType:(unsigned long)fp8;
> - (unsigned short)handleBSProxyEvent:(CDAnonymousStruct1)fp8;
>
> @end
> ----------
> /*
> * Generated by class-dump 3.1.2.
> *
> * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by
> Steve Nygard.
> */
> /*
> struct ProcessSerialNumber {
> unsigned int highLongOfPSN;
> unsigned int lowLongOfPSN;
> };
> */
> typedef struct {
> unsigned int _field1;
> unsigned int _field2;
> unsigned int _field3;
> unsigned int _field4[6];
> } CDAnonymousStruct1;
> -----------
> /*
> * Generated by class-dump 3.1.2.
> *
> * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by
> Steve Nygard.
> */
>
> @protocol BezelServicesWireProtocol
> - (BOOL)registerProxyClient:(id)fp8 ForProcess:(id)fp12;
> - (BOOL)unregisterProxyClientForProcess:(id)fp8;
> - (id)preference;
> - (int)setPreference:(id)fp8;
> - (id)objectForPrefKey:(id)fp8;
> - (int)setObject:(id)fp8 forPrefKey:(id)fp12;
> - (int)ambientFeatureAvailable;
> - (int)isKeyboardSaturated:(int *)fp8;
> - (void)setKeyboardHold:(int)fp8;
> - (void)setDisplayHold:(int)fp8;
> - (void)setKeyboardValue:(float)fp8;
> - (void)setDisplayValue:(float)fp8;
> - (void)kernelPreferenceChanged:(id)fp8;
> - (void)kernelPreferenceCreate:(id)fp8 ResetToDefaults:(BOOL)fp12;
> - (int)remoteControlFeatureAvailable;
> - (void)remoteUIToggle;
> - (void)handleRemoteEventWithPage:(unsigned short)fp8 usage:
> (unsigned short)fp12 flags:(unsigned short)fp16 value:(long)fp20;
> @end
> -----------
> Interesting, we can see that the BezelServicesWireProtocol is what
> we need ! But wait, what object conforms to this protocol ? How to
> get an instance ? What the hell is a WireProtocol ?
> To have an idea, I have used Instruments to sample SystemPreferences
> exactly when I click the checkbox to change the ALS setting, and I
> have found this :
> Library Symbol Name
> ...
> AppKit -[NSApplication sendAction:to:from:]
> Brightness 0x1667f01a
> BezelServices BSSetPreferenceBool
> CoreFoundation _CF_forwarding_prep_0
> ...
> Very interesting, whe have a BezelServices Framework object using
> BSSetPreferenceBool ! Exactly what I want, but I don't know the
> Class of this object, the way to instantiate it, etc… I am still
> stuck.
> What is this "Brightness" library ? Another Private Framework ? I am
> lost at this point.
>
> So, if someone have an idea, that would be kind. The only tihng I
> want to do is activate or deactivate this ALS setting. I am not
> really insterested in the reverse engineering challenge or anything
> like that, only to find a way to activate or deactivate this ALS
> thing from my code.
>
> Regards._______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Gabriel ROUSSEAU | Jun 3, 20:58 | |
| Jean-Daniel Dupas | Jun 3, 21:11 | |
| Gabriel ROUSSEAU | Jun 3, 23:36 |






Cocoa mail archive

