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);

> 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
        If there is an error, the program exits with an exit code
        from 0.
        [davidz at daxter ~]$ hal-find-by-capability --capability
This should work.

More information about the hal mailing list