hwi_find()

Find a specific item instance owned by a specific parent, resolving all synonym names

Synopsis:

#include <drvr/hwinfo.h>

unsigned hwi_find( const char *device_name,
                   int unit,
                   unsigned hwi_off);

Arguments:

device_name
The name of the device.
unit
The instance of the device that you're looking for, or -1 if you aren't looking for a specific instance.
hwi_off
The offset of the parent, or HWI_NULL_OFF to specify no parent.

Library:

libdrvr

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

Description:

The hwi_find() function lets you find a specific item instance owned by a specific parent, resolving (all) synonym names (aliases) to a real device or bus. If the unit instance of device_name has been added to the hwinfo section of the system page and belongs to parent hwi_off, the function returns its hwi offset.

If hwi_off is HWI_NULL_OFF, indicating no parent specified, then hwi_find() does a system-wide search and returns the results regardless of the owning parent. If unit is -1, indicating that you aren't looking for a specific instance, hwi_find() returns the offset of the first occurrence of device_name. Setting unit to -1 is most useful when you're searching for a device on a specific bus (i.e., hwi_off != HWI_NULL_OFF).

Note that the search can be directed from a specific item hwi_off. Therefore, if a certain device is expected to be found attached to a certain bus, you can set hwi_off to the results of hwi_find_bus(). For example, if you have multiple instances of the same device attached to two different buses, the hwi_off parameter allows you to find the instance connected to one of the buses only.

Returns:

The offset of the device found, or HWI_NULL_OFF if no device was found.

Classification:

QNX Neutrino

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