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


#include <drvr/hwinfo.h>

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


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



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


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.


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


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes