class Configure

Defined at line 252 of file fidling/gen/sdk/fidl/fuchsia.hardware.usb.function/fuchsia.hardware.usb.function/cpp/fidl/fuchsia.hardware.usb.function/cpp/markers.h

Configure the function with the given descriptors.

**Ordering**: This must be called after `AllocResources` has been called to allocate all

interfaces, endpoints, and strings referenced in the descriptors. Calling this when already

configured returns `ZX_ERR_ALREADY_BOUND`.

This binds the [`UsbFunctionInterface`] callback channel (where the protocol client acts as

the server).

`configuration` is a vector of concatenated USB descriptors in standard USB wire format

(Interface -> Endpoint -> Class/Vendor descriptors). A raw byte vector is used to allow

arbitrary class-specific and vendor-specific descriptors that cannot be statically defined

in FIDL.

This byte vector is expected to contain one or more interface descriptors following the

USB specification.

This descriptor block is cached by the peripheral controller and sent *as-is* to the host in

response to standard host `GET_DESCRIPTOR` (Configuration) requests.

**Structure and Validation**:

- Must begin with an Interface or Interface Association descriptor.

- Standard descriptors (Interface, Endpoint) embedded in the vector must follow the standard

USB specification descriptor layouts.

- All interface numbers and endpoint addresses must match the resources allocated in

[`AllocResources`].

- The peripheral controller parses this vector linearly using descriptor length fields.

Mismatched resource IDs or malformed layouts return `ZX_ERR_INVALID_ARGS`.

`iface` is the client end of [`UsbFunctionInterface`] which the protocol server uses to send

events to the protocol client.

The function remains configured until `Deconfigure` is called or the `iface` channel is

closed. If `iface` is closed, the function is automatically deconfigured, which stops the

peripheral controller and disconnects the device from the host.

* error:

* `ZX_ERR_INVALID_ARGS` if the configuration is invalid or references unallocated

resources.

* `ZX_ERR_ALREADY_BOUND` if the function interface is already bound.

* `ZX_ERR_NO_MEMORY` if the protocol server fails to allocate memory to store the

descriptors.

* `ZX_ERR_BAD_STATE` if the peripheral device is stopping or tearing down.

Public Members

static const bool kHasClientToServer
static const bool kHasClientToServerBody
static const bool kHasServerToClient
static const bool kHasServerToClientBody
static const bool kHasNonEmptyUserFacingResponse
static const bool kHasDomainError
static const bool kHasFrameworkError
static const uint64_t kOrdinal