USBD_GET_DESCRIPTORS

Purpose

Gets standard the USB descriptors for a logical device.

Syntax

int ioctl (file, USBD_GET_DESCRIPTORS, arg)

Parameter

Item Description
file File descriptor that is obtained when the USBD special file was opened.
arg Address of the USBDGD structure that is aligned on a 4-byte boundary (see USBDGD structure that is defined in the /usr/include/sys/usbdi.h file).
ext Not used and should be set to zero.

Description

Upon successful return from the ioctl, a DESCIDX structure is placed at the start of the specified buffer followed by the standard device descriptor, configuration descriptor, interface descriptor, endpoint descriptors, HID descriptor (if HID device), hub descriptor (if hub device), and string descriptors of the specified logical USB device. The DESCIDX structure provides direct addressability to the individual descriptors. String descriptors are reformed to NULL terminated ASCII strings for ease of use; all other descriptors adhere to the standard USB format. Because the size of the returned data is typically unknown, it is recommended that the ioctl be called twice. The first-time set bufferLength field equal to zero and buffer field to NULL. The ioctl fails with errno of ENOSPC; however minBuffLength field is returned indicating the required size of the buffer. The caller can then allocate the buffer and call the ioctl a second time with bufferLength field set to the correct value.

Execution Environment

This function can be called from the user process environment only.

Return Values

Value Description
0 Indicates successful completion.
ENODEV Indicates that there is no host controller that is associated with the passed in device number.
ENOSPC Indicates that the allocated buffer length is too small to fit the descriptor data.