<br />

State of a physical USB connector (receptacle), as reported by the port controller that
manages it, such as a USB Type-C port controller (TCPC).

The port controller decides how the USB data side should behave from what is attached (for
example, Type-C CC state and BC1.2 charger detection), and USB drivers such as the PHY and
controller follow it. Power-related state (presence, current limits) is reported separately
through `fuchsia.hardware.power.usb`.
Added: HEAD

## **PROTOCOLS**

## Connector

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

Protocol for querying static capabilities and watching dynamic state changes of a physical USB
connector.

<br />

### GetSpec

Returns static hardware characteristics of the USB connector that do not change during
operation.

#### Request

\<EMPTY\>

#### Response

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

### Watch

Hanging get for the connector state. Returns immediately on the first call, then when the
state has changed since the last returned value. State transitions are delivered in order
and not coalesced across calls (for example, `DEVICE -> NONE -> DEVICE` delivers `NONE` on
the next call and `DEVICE` on the following call).

If present, `setup_wake_lease` keeps the system awake while the server processes the call.
If the call is answered immediately, as the first call always is, the server hands it back
as `wake_lease` unless it returns a wake lease of its own. If the call is parked, the server
drops it.

If present, `wake_lease` is a wake lease that the client should hold while it handles the
returned state. On a suspend-capable system, the server must return a wake lease on every
transition of a field in `Spec.wake_on` (which must include `data_role`, including
transitions to `NONE` so downstream drivers can drain transfers and power down before
suspend), or hand back `setup_wake_lease` on an immediate reply when no server lease is
attached.

Returns:

- `ZX_ERR_BAD_STATE`: A `Watch` call is already pending on this channel; the existing pending call remains intact.

#### Request

| Name | Type |
|---|---|
| `setup_wake_lease` | `https://fuchsia.dev/reference/fuchsia.power.system//https://fuchsia.dev/reference/fuchsia.power.system#LeaseToken` |

#### Response

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

## **STRUCTS**

### Connector_GetSpec_Response

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

| Field | Type | Description | Default |
|---|---|---|---|
| `spec` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.connector#Spec` |   | No default |

### Connector_Watch_Response [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#value-vs-resource)

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

| Field | Type | Description | Default |
|---|---|---|---|
| `state` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.connector#ConnectorState` |   | No default |
| `wake_lease` | `https://fuchsia.dev/reference/fuchsia.power.system//https://fuchsia.dev/reference/fuchsia.power.system#LeaseToken` |   | No default |

## **ENUMS**

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

Type: `uint32`

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

The USB data role the controller behind a connector should operate in.

<br />

| Name | Value | Description |
|---|---|---|
| ### NONE | `0` | No USB data: nothing is attached, the partner provides no USB data (for example a dedicated charger), or data is not yet allowed (for example charger detection is still running on the port controller's own data switch; platforms whose charger detector borrows the SoC PHY require a future `DETECTING` role or side channel rather than `NONE`). |
| ### DEVICE | `1` | Peripheral: the data lines are connected to a USB host. |
| ### HOST | `2` | Host: the data lines are connected to a USB device. |

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

Type: `uint32`

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

Orientation of the plug in a USB Type-C receptacle, indicating which CC pin the partner is
attached on so a Type-C mux can route lanes according to the active mode.

<br />

| Name | Value | Description |
|---|---|---|
| ### NORMAL | `1` | The partner is attached on CC1. |
| ### REVERSE | `2` | The partner is attached on CC2 (the plug is flipped). |

## **TABLES**

### ConnectorState

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

Dynamic state of a USB connector.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `data_role` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.connector#DataRole` | The data role the USB controller should operate in. Always set by the server. |
| ### 2 | `orientation` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.connector#Orientation` | The Type-C plug orientation, set whenever a partner's CC orientation is resolved (independently of `data_role`) and omitted when unattached, unknown, or non-Type-C. |

### Spec

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

Static hardware characteristics and driver capabilities of a physical USB connector.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `supported_data_roles` | `vector<https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.connector#DataRole>` | Data roles supported by this connector (for example `[DEVICE]` or `[DEVICE, HOST]`). |
| ### 2 | `wake_on` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.usb.connector#ConnectorState` | `ConnectorState` fields whose changes actively wake the system from suspend and return a `wake_lease` on `Watch` (must include `data_role`). Only field presence (set vs. unset) is significant; the actual values in the table are ignored. |

## **UNIONS**

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

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

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

<br />

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

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

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

<br />

## **SERVICES**

### Service

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

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

<br />