fuchsia.usb.policy

The fuchsia.usb.policy interfaces provide mechanisms for clients to query and monitor the overall state of USB devices and the USB subsystem, independent of the underlying hardware driver implementations.

Added: HEAD

PROTOCOLS

Configuration

Defined in fuchsia.usb.policy/policy.fidl

Protocol for querying and dynamically reconfiguring USB peripheral functions.

Enables policy managers and system command-line tools to inspect active USB peripheral configurations and reconfigure the peripheral device function stack at runtime.

GetConfiguration

Retrieves the current USB device descriptor and active configuration descriptors.

Errors

  • ZX_ERR_NOT_SUPPORTED: Peripheral function querying is not supported on the target hardware.

Request

<EMPTY>

Response

NameType
payload Configuration_GetConfiguration_Result

SetConfiguration

Sets and activates a new USB peripheral function configuration.

Teardown of the previous peripheral function stack occurs before initializing and binding the newly specified functions. The call completes once the peripheral controller and underlying function drivers are registered and ready.

Errors

  • ZX_ERR_INVALID_ARGS: Configuration parameters are invalid.
  • ZX_ERR_ALREADY_BOUND: An existing peripheral configuration is locked or undergoing transition.
  • ZX_ERR_NOT_SUPPORTED: The requested combination of functions cannot be supported simultaneously.

Request

NameType
device_desc fuchsia.hardware.usb.peripheral/DeviceDescriptor
config_descriptors vector<fuchsia.hardware.usb.peripheral/ConfigurationDescriptor>:5

Response

NameType
payload Configuration_SetConfiguration_Result

Health

Defined in fuchsia.usb.policy/policy.fidl

Protocol for retrieving diagnostic and health information from the USB system.

GetReport

Returns a snapshot of the current USB health and device state.

Request

<EMPTY>

Response

NameType
payload Health_GetReport_Result

PolicyProvider

Defined in fuchsia.usb.policy/policy.fidl

An interface to monitor dynamic changes to the USB device state.

WatchDeviceState

Notify a client of an updated device state value via a hanging get. The first time this is called, it will return right away with the current state. Subsequent calls will hang until there is a change to report. Returns a table containing the updated device state.

Request

<EMPTY>

Response

NameType
payload fuchsia.hardware.usb.policy/DeviceStateWatcher_WatchDeviceState_Result

STRUCTS

Configuration_GetConfiguration_Response

Defined in fuchsia.usb.policy/policy.fidl

FieldTypeDescriptionDefault
device_desc fuchsia.hardware.usb.peripheral/DeviceDescriptor No default
config_descriptors vector<fuchsia.hardware.usb.peripheral/ConfigurationDescriptor>:5 No default

Configuration_SetConfiguration_Response

Defined in fuchsia.usb.policy/policy.fidl

<EMPTY>

ENUMS

CableStatus flexible

Type: uint32

Defined in fuchsia.usb.policy/policy.fidl

Status of the physical USB cable connection.

NameValueDescription
0
1

FunctionStatus flexible

Type: uint32

Defined in fuchsia.usb.policy/policy.fidl

Health status of a USB function driver or connection.

NameValueDescription
0
1
2
3

TABLES

AdbHealth

Defined in fuchsia.usb.policy/policy.fidl

Health information for the USB ADB function subsystem.

OrdinalFieldTypeDescription
status FunctionStatus

Describes the high-level policy and configuration state of the ADB function.

details string:128

Provides additional diagnostic details or state description.

online bool

Indicates whether the underlying ADB daemon connection and transport are actively online and communicating with the host. In contrast to status == CONNECTED (which indicates the USB peripheral function descriptor is configured and bound), online indicates that end-to-end ADB transport is active.

driver_state string:32

Describes the runtime execution state reported by the ADB function driver (e.g. "kAwaitingUsbConnection", "kOnline", "kStoppingForReconnect", "kStoppingForUnbind").

CdcEthernetHealth

Defined in fuchsia.usb.policy/policy.fidl

Health information for the USB CDC Ethernet function subsystem.

OrdinalFieldTypeDescription
status FunctionStatus

Describes the high-level policy and configuration state of the CDC Ethernet function.

details string:128

Provides additional diagnostic details or state description.

online bool

Indicates whether the underlying Ethernet network interface and link are actively online and ready for network traffic. In contrast to status == CONNECTED (which indicates the USB CDC interface is configured on the bus), online indicates that the link state is up.

HealthReport

Defined in fuchsia.usb.policy/policy.fidl

A snapshot of the USB controller's current status and health.

OrdinalFieldTypeDescription
state fuchsia.hardware.usb.policy/DeviceState

Describes the current state of the device as defined by the USB 2.0 spec.

address uint8

The address assigned to the USB device.

cable_status CableStatus

Indicates whether the USB physical cable / VBUS is attached ([CableStatus]).

adb AdbHealth

Describes the health status of the ADB function subsystem ([AdbHealth]).

cdc_ethernet CdcEthernetHealth

Describes the health status of the CDC Ethernet function subsystem ([CdcEthernetHealth]).

vsock VsockHealth

Describes the health status of the VSOCK function subsystem ([VsockHealth]).

VsockHealth

Defined in fuchsia.usb.policy/policy.fidl

Health information for the USB VSOCK function subsystem.

OrdinalFieldTypeDescription
status FunctionStatus

Describes the high-level policy and configuration state of the VSOCK function.

active_channels uint32

The number of currently active or open multiplexed VSOCK socket channels. If unknown or unsupported by the function driver, this field is absent (None).

details string:128

Provides additional diagnostic details or state description.

online bool

Indicates whether the underlying VSOCK transport driver is actively online and ready for traffic. In contrast to status == CONNECTED (which indicates the USB function is configured on the bus), online indicates that the VSOCK service is bound and ready to accept connections.

driver_state string:32

Describes the runtime execution state reported by the VSOCK function driver (e.g. "Unconfigured", "Running").

UNIONS

Configuration_GetConfiguration_Result strict

Defined in fuchsia.usb.policy/policy.fidl

OrdinalVariantTypeDescription
response Configuration_GetConfiguration_Response
err zx/Status
framework_err internal

Configuration_SetConfiguration_Result strict

Defined in fuchsia.usb.policy/policy.fidl

OrdinalVariantTypeDescription
response Configuration_SetConfiguration_Response
err zx/Status
framework_err internal

Health_GetReport_Result strict

Defined in fuchsia.usb.policy/policy.fidl

OrdinalVariantTypeDescription
response HealthReport
err zx/Status
framework_err internal

CONSTANTS

NameValueTypeDescription
MAX_DETAILS_LENGTH 128 uint32