+void IOPMPowerSource::setPSProperty(const OSSymbol *key, OSObject *val)
+{
+ OSObject *lastVal;
+
+ if(!key || !val) return;
+
+ // Compare new setting with existing setting; update
+ // 'settingsChangedSinceUpdate' if the setting has changed.
+ // If values are OSNumbers, do equality comparison.
+ // Otherwise, just compare pointers.
+
+ if( (lastVal = properties->getObject(key)) ) {
+ if(val->isEqualTo(lastVal)) {
+ // settings didn't change
+ } else {
+ // num val is not equal to last val
+ settingsChangedSinceUpdate = true;
+ }
+ } else {
+ // new setting; no last value
+ settingsChangedSinceUpdate = true;
+ }
+
+ // here's the part where we go crazy.
+ properties->setObject(key, val);
+}
+
+
+