onBatteryPower
David Zeuthen
david at fubar.dk
Wed Oct 26 09:36:01 PDT 2005
On Wed, 2005-10-26 at 17:23 +0100, Richard Hughes wrote:
> > 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
Suggest to use
/* Find devices with a given capability. */
char **libhal_find_device_by_capability (LibHalContext *ctx,
const char *capability,
int *num_devices,
DBusError *error);
instead.
> Okay, that would work too. How can we use this in a shell script tho?
What about
[davidz at daxter ~]$ hal-find-by-capability --help
usage : hal-find-by-capability --capability <capability>
[--help] [--verbose] [--version]
--capability HAL Device Capability to search for
--verbose Be verbose
--version Show version and exit
--help Show this information and exit
This program prints the Unique Device Identifiers for HAL device
objects of a given capability on stdout and exits with exit code
0
If there is an error, the program exits with an exit code
different
from 0.
[davidz at daxter ~]$ hal-find-by-capability --capability
ac_adapter
/org/freedesktop/Hal/devices/acpi_AC
This should work.
Cheers,
David
More information about the hal
mailing list