hwi_find_compatible()

Find a specific instance of an device by its compatible string

Synopsis:

#include <drvr/hwinfo.h>

unsigned hwi_find_compatible( const char *compatible,
                              int unit,
                              unsigned hwi_off );

Arguments:

compatible
The name of the item.
unit
The instance of compatible that you want to find, or -1 to find the first instance.
hwi_off
The offset into the hwinfo section of the system page for the parent, which you can get by calling hwi_find_device(), or HWI_NULL_OFF, if you don't want to specify a parent.

Library:

libdrvr

Use the -l drvr option to qcc to link against this library.

Description:

The hwi_find_compatible() function lets you find a specific instance of an item, based on its “compatible” string. If the unit instance of compatible has been added to the hwinfo section of the system page after hwi_off, then hwi_find_compatible() returns its offset.

If hwi_off is HWI_NULL_OFF, indicating no parent specified, the function searches from the beginning.

If unit is -1, indicating that you aren't searching for a specific instance, the first occurrence of compatible is returned. Setting unit to -1 is most useful when you're searching for all devices with a matching compatible.

Returns:

The hwinfo section offset or HWI_NULL_OFF if the bus or device instance doesn't exist.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes