Google is committed to advancing racial equity for Black communities. See how.

fuchsia.hardware.usb.device

PROTOCOLS

Device

Defined in fuchsia.hardware.usb.device/usb-device.fidl

GetConfiguration

Returns the device's current configuration.

Request

NameType

Response

NameType
configuration uint8

GetConfigurationDescriptor

Returns the device's USB configuration descriptor for the given configuration.

Request

NameType
config uint8

Response

NameType
s zx/status
desc vector<uint8>[65536]

GetConfigurationDescriptorSize

Returns the total size of the USB configuration descriptor for the given configuration.

Request

NameType
config uint8

Response

NameType
s zx/status
size uint16

GetDeviceDescriptor

Returns the device's USB device descriptor.

Request

NameType

Response

NameType
desc uint8[18]

GetDeviceId

Returns an implementation specific device ID for a USB device. For informational purposes only.

Request

NameType

Response

NameType
device_id uint32

GetDeviceSpeed

Returns the speed of the USB device as a usb_speed_t value.

Request

NameType

Response

NameType
speed uint32

GetHubDeviceId

Returns the implementation specific device ID for the hub that a USB device is connected to. For informational purposes only.

Request

NameType

Response

NameType
hub_device_id uint32

GetStringDescriptor

Fetches a string descriptor from the USB device.

desc_id : The ID of the string descriptor to fetch, or 0 to fetch the language table instead.

lang_id : The language ID of the string descriptor to fetch. If no matching language ID is present in the device's language ID table, the first entry of the language ID table will be substituted. actual_lang_id : The actual language ID of the string fetched, or 0 for the language ID table.

The worst case size for the payload of a language ID table should be 252 bytes, meaning that a 256 byte buffer should always be enough to hold any language ID table.

The worst case size for a UTF-8 encoded string descriptor payload should be 378 bytes (126 UTF-16 code units with a worst case expansion factor of 3)

Request

NameType
desc_id uint8
lang_id uint16

Response

NameType
s zx/status
desc string[384]
actual_lang_id uint16

SetConfiguration

Sets the device's current configuration.

Request

NameType
configuration uint8

Response

NameType
s zx/status

SetInterface

Selects an alternate setting for an interface on a USB device.

Request

NameType
interface_number uint8
alt_setting uint8

Response

NameType
s zx/status

STRUCTS

CONSTANTS

NameValueTypeDescription
DEVICE_DESC_SIZE 18 uint32

sizeof(usb_device_descriptor_t)

MAX_CONFIG_DESC_SIZE 65536 uint32

UINT16_MAX

MAX_STRING_DESC_SIZE 384 uint32

See GetStringDescriptor description below