hughsient at gmail.com
Wed Oct 26 09:23:34 PDT 2005
On Wed, 2005-10-26 at 18:13 +0200, Danny Kukawka wrote:
> On Wednesday 26 October 2005 17:38, Richard Hughes wrote:
> > > We have already a key for this: ac_adapter.present.
> > Could we just copy this key to a computer node so we don't have to find
> > all devices with capability "ac_adapter"?
> What do you try to do with capability "ac_adapter"?
> I would use:
> char **libhal_manager_find_device_string_match (LibHalContext *ctx,
> const char *key,
> const char *value,
> int *num_devices,
> DBusError *error);
> with key=ac_adapter.present, value=false and check if num_devices >= 1
Okay, that would work too. How can we use this in a shell script tho?
Just something like:
[ `hal-get-property foo bar` == "true" ] && exit
> Btw: I don't see the case where we have more than one device with this
For the ac_adapter you are right, apologies.
> > We want to make the "glue" bit that queries hal as simple as possibly,
> > hopefully just reading one key.
> It's easy as you can see.
> > > At least you could also check
> > > battery.rechargeable.is_discharging to detect if run on battery.
> > What about multiple batteries? We would have to check each one.
> Same as above with key=battery.rechargeable.is_discharging and value=true and
> check for num_devices >= 1.
(Richard scurries to update the g-p-m code...)
On a related note, is libhal depreciated or is it still okay to use?
I've written glib bindings, but am considering just using libhal.
I wrote the glib bindings as an exercise for myself (to teach me glib
dbus), but libhal can do more stuff than my (somewhat incomplete)
wrappers. Should I revert back to libhal?
More information about the hal