callout on property change
Robert Love
rml at ximian.com
Tue Apr 20 09:56:13 PDT 2004
Hello, guys.
I added callout-on-property-change, because we need it to do lots of
things, such as a replacement for ifplugd (take action on link change).
See attached patch.
Couple of design decisions:
- I only invoke the callout when the property is _modified_, not
when it is first added or removed. I don't see the need for
added or removed property callouts, do you? This gets rid of a
few spurious callouts during HAL init, too. What people want, I
think, is to catch the modification and do something based on
the new vs. old value.
- Despite the above, I pass "modified" as the first parameter to
the callout. This is in case we ever want to change the above
assumption - also, it remains compatible with the parameters of
the other callouts.
- I added an environment variables PROPERTY (the key that
changed) and VALUE (the key's current value). It is too much to
expect the callouts to translate the PROPERTY into the right
format (dots to underscores, all uppercase, etc.) and then
invoke the result as a variable. So I pass them.
- However, VALUE is currently hardcoded to foo until I write
hal_property_to_string().
I know there were some concerns about properties changing too often for
a callout to remain sane. In my testing, however, there were
surprisingly few property-modified callouts occurring - perhaps since I
only report when a property changes (as opposed to add/remove)? During
my testing, the only property change callouts I saw were me pulling out
my ethernet cable to test. So who knows.
Comments, thoughts?
Robert Love
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-add-property-changed-callout.patch
Type: text/x-patch
Size: 3988 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20040420/61bcfd47/hal-add-property-changed-callout.bin
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list