Jump to main content

##

# 3.2.4.9 USB_HOST_DeviceGetFirst Function

## C

    USB_HOST_RESULT USB_HOST_DeviceGetFirst(
        USB_HOST_BUS bus,
        USB_HOST_DEVICE_INFO * deviceInfo
    );

## Summary

This function returns information about the first attached device on the specified bus. The USB_HOST_DeviceGetNext() function can be used to get the reference to the next attached device on the bus. The USB_HOST_DEVICE_INFO object is provided by the application. The device information will be populated into this object. If there are no devices attached on the bus, the function will set the deviceObjHandle parameter, in the USB_HOST_DEVICE_INFO object, to USB_HOST_DEVICE_OBJ_HANDLE INVALID.

## Description

Description of the function.

## Precondition

The USB_HOST_BusEnable function should have been called to enable detection of attached devices.

## Parameters

Parameters | Description
bus | the bus to be queried for attached devices.
deviceInfo | output parameter. Will contain device information when the function returns. If the deviceObjHandle member of the structure contains USB_HOST_DEVICE_OBJ_HANDLE INVALID, then there are no attached devices on the bus and the deviceAddress and the bus member of the info object will contain indeterminate values.

## Returns

USB_HOST_RESULT_SUCCESS - The function executed successfully.

USB_HOST_RESULT_END_OF_DEVICE_LIST - There are no attached devices on the bus.

USB_HOST_RESULT_BUS_UNKNOWN - The specified bus does not exist in the system.

USB_HOST_RESULT_BUS_NOT_ENABLED - The specified bus is not enabled.

USB_HOST_RESULT_PARAMETER_INVALID - the deviceInfo parameter is NULL.

USB_HOST_RESULT_FAILURE - an unknown failure occurred.

## Remarks

None.