USBD_GET_DESCRIPTORS
Purpose
Gets standard Universal Serial Bus (USB) descriptors for a logical device.
Syntax
int ioctl (file, USBD_GET_DESCRIPTORS, arg)
Parameters
| Item | Description |
|---|---|
| file | File descriptor that is obtained when the USB system driver (USBD) special file was opened. |
| arg | Address of the USBDGD structure
that is aligned on a 4-byte boundary. |
Description
After a successful return from
the ioctl operation, a DESCIDX structure
is placed at the start of the specified buffer that is followed by
the standard device descriptor, configuration descriptor, interface
descriptor, endpoint descriptors, human interface device (HID) descriptor
(if an HID device is used), hub descriptor (if hub device is used),
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 American Standard Code
for Information Interchange (ASCII) strings for ease of use. All other
descriptors adhere to the standard USB format. Since the size of the
returned data is typically unknown, the ioctl operation
must be called twice. The first time that you call the ioctl operation,
set the bufferLength field equal to zero and the
buffer field to null. The ioctl operation might fail
with the ENOSPC error, however the minBuffLength value
is returned that indicates the required size of the buffer. The caller
can then allocate the buffer and call the ioctl operation
again with the 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 | Success. |
| -1 | Failure. Check the errno value for specific failure causes. |