<br />

Added: HEAD

## **PROTOCOLS**

## Device

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=51)*

### ClearFunctions

Tells the device to remove the child devices for the configuration's interfaces
and reset the list of functions to empty.
The caller should wait for the `FunctionsCleared` event.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Device_ClearFunctions_Result` |

### GetConfiguration

Retrieves the current device descriptor and active configuration descriptors.

Returns the active USB device descriptor and all associated configuration
descriptors registered with the peripheral device manager.

- error:
  - `ZX_ERR_BAD_STATE`: The peripheral device has not been configured.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Device_GetConfiguration_Result` |

### SetConfiguration

Sets the device's descriptors, adds the functions and creates the child devices for the
configuration's interfaces.
At least one function descriptor must be provided.

#### Request

| Name | Type |
|---|---|
| `device_desc` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#DeviceDescriptor` |
| `config_descriptors` | `vector<https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#ConfigurationDescriptor>:5` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Device_SetConfiguration_Result` |

### SetStateChangeListener

Adds a state change listener that is invoked when a state change completes.

#### Request

| Name | Type |
|---|---|
| `listener` | `client_end:https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Events` |

## Events

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=44)*

Events protocol that is used as a callback to inform the client
of the completion of various server-side events.
This callback interface can be registered using the SetStateChangeListener
method on the Device protocol.

<br />

### FunctionRegistered

Invoked when a function registers

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Events_FunctionRegistered_Result` |

### FunctionsCleared

Invoked when all functions have been cleared.

#### Request

\<EMPTY\>

## **STRUCTS**

### DeviceDescriptor

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=25)*

The fields in DeviceDescriptor match those in usb_descriptor_t in the USB specification,
except for the string fields.

<br />

| Field | Type | Description | Default |
|---|---|---|---|
| `bcd_usb` | `uint16` |   | No default |
| `b_device_class` | `uint8` |   | No default |
| `b_device_sub_class` | `uint8` |   | No default |
| `b_device_protocol` | `uint8` |   | No default |
| `b_max_packet_size0` | `uint8` |   | No default |
| `id_vendor` | `uint16` |   | No default |
| `id_product` | `uint16` |   | No default |
| `bcd_device` | `uint16` |   | No default |
| `manufacturer` | `string:127` |   | No default |
| `product` | `string:127` |   | No default |
| `serial` | `string:127` |   | No default |
| `b_num_configurations` | `uint8` |   | No default |

### Device_ClearFunctions_Response

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=75)*

\<EMPTY\>

### Device_GetConfiguration_Response

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=59)*

| Field | Type | Description | Default |
|---|---|---|---|
| `device_desc` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#DeviceDescriptor` |   | No default |
| `config_descriptors` | `vector<https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#ConfigurationDescriptor>:5` |   | No default |

### Device_SetConfiguration_Response

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=70)*

\<EMPTY\>

### Events_FunctionRegistered_Response

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=46)*

\<EMPTY\>

### FunctionDescriptor

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=15)*

| Field | Type | Description | Default |
|---|---|---|---|
| `interface_class` | `uint8` |   | No default |
| `interface_subclass` | `uint8` |   | No default |
| `interface_protocol` | `uint8` |   | No default |

## **UNIONS**

### Device_ClearFunctions_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=75)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Device_ClearFunctions_Response` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Device_GetConfiguration_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=59)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Device_GetConfiguration_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Device_SetConfiguration_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=70)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Device_SetConfiguration_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Events_FunctionRegistered_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=46)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#Events_FunctionRegistered_Response` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [MAX_CONFIG_DESCRIPTORS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=10) | `5` | `uint32` |   |
| [MAX_FUNCTION_DESCRIPTORS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=9) | `32` | `uint32` |   |
| [MAX_STRING_DESCRIPTORS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=11) | `255` | `uint32` |   |
| [MAX_STRING_LENGTH](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=13) | `127` | `uint32` |   |

## **ALIASES**

| Name | Value | Description |
|---|---|---|
| [ConfigurationDescriptor](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=21) | `vector`\[`https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.peripheral#MAX_FUNCTION_DESCRIPTORS`\] |   |

## **SERVICES**

### Service

*Defined in [fuchsia.hardware.usb.peripheral/usb-peripheral.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=84)*

| Name | Type | Transport |
|---|---|---|
| [device](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.usb.peripheral/usb-peripheral.fidl;l=85) | `fuchsia.hardware.usb.peripheral/Device` | Channel |

<br />