Re: Switching Airport of in code using SCF
Re: Switching Airport of in code using SCF
- Subject: Re: Switching Airport of in code using SCF
- From: Mike <email@hidden>
- Date: Tue, 19 Feb 2008 12:42:42 -0700
You most certainly can elicit a change in hardware state using SCF.
configd monitors the dynamic and persistent stores for changes
continuously. If you make a change to either via SCF, configd will
automatically notice the changes and update everything in the system.
The difficult part has always been how to properly update the stores
such that the system will get the new information - without corrupting
something. The correct way of doing this depends on which info in the
stores is being modified. For example, if you change something that also
stores data in the preferences file and don't umask the file properly
after you modify it, the settings will be made and configd will pick up
the info but if you try to view settings in System Preferences, you will
find most of the values are corrupted. And of course Apple does not
document everything in one concise place because they want to discourage
hackers. They don't even document all of the allowable settings keys in
the SCF dictionaries.
From your description it sounds like you are updating the persistent
store but the dynamic store is not being updated (or not being noticed).
This would manifest itself in the symptoms you described - it works
after reboot but not immediately upon setting the info. This would
indicate the persistent store is getting updated but the dynamic store
isn't - the next time you reboot, configd re-reads the persistent store
to create a new dynamic store.
I assume you are calling both SCPreferencesCommitChanges and
SCPreferencesApplyChanges? The former updates the persistent store, the
latter applies the changes to the running system. Also note you must
lock the store before making any changes or the changes won't take effect.
SCF was designed to allow dynamic changes to the system without having
drivers get involved. There is no need to have a driver do anything to
change supported settings in a service or services.
Mike
Nathan Duran wrote:
On Feb 18, 2008, at 6:05 AM, Jonathan Guy wrote:
I guessed the clue was in the key kSCPropNetAirPortPowerEnabled so I
whipped up some code but it doesn't appear to work. If anyone can shed
some light on this I'd be very grateful.
I wouldn't really expect a property list modification to elicit a change
in hardware state. If you want the driver to turn the card off you're
probably going to have to tell it directly, otherwise it's doubtful that
it's going to look at that preference again until the next time it's
loaded--as you've observed to be the case when
rebooting._______________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden