# fuchsia.hardware.serialimpl

<br />

Added: HEAD

## **PROTOCOLS**

## Device

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=40)*

### CancelAll

Immediately cancels all outstanding asynchronous I/O

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.serialimpl#Device_CancelAll_Result` |

### Config

Configures the given serial port.
Values of `flags` are defined in the constants above.

- error one of the following values:
-

      `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is

-

                               transitioning to a low-power state.

-

      Other values may be returned for driver- or device-specific errors.

#### Request

| Name | Type |
|---|---|
| `baud_rate` | `uint32` |
| `flags` | `uint32` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.serialimpl#Device_Config_Result` |

### Enable

Enable or disable the device.
If already enabled and `enable` is true, this is a no-op and returns successfully.
If already disabled and `enable` is false, this is a no-op and returns successfully.

- request `enable` true to enable the device, or false to disable it.

<!-- -->

- error one of the following values:
-

      `ZX_ERR_BAD_STATE`: `enable` was false, and a `Read()` or `Write()` call was pending.

-

      `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is

-

                               transitioning to a low-power state.

#### Request

| Name | Type |
|---|---|
| `enable` | `bool` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.serialimpl#Device_Enable_Result` |

### GetInfo

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.serialimpl#Device_GetInfo_Result` |

### Read

Perform a read operation. Returns immediately if data has been received since the last call;
otherwise the request is completed the next time data is received (clients can use the
hanging-get pattern to be notified of new data).

- response `data` the bytes read from the device.

<!-- -->

- error one of the following values:
-

      `ZX_ERR_BAD_STATE`: The device was not enabled.

-

      `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.

-

      `ZX_ERR_ALREADY_BOUND`: Another `Read()` call was already pending.

-

      `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is

-

                               transitioning to a low-power state.

-

      Other values may be returned for driver- or device-specific errors.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.serialimpl#Device_Read_Result` |

### Write

Perform a write operation. Returns when all bytes have been written, or when an error is
encountered.

- request `data` the bytes to write to the device.

<!-- -->

- error one of the following values:
-

      `ZX_ERR_BAD_STATE`: The device was not enabled.

-

      `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.

-

      `ZX_ERR_ALREADY_BOUND`: Another `Write()` call was already pending.

-

      `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is

-

                               transitioning to a low-power state.

-

      Other values may be returned for driver- or device-specific errors.

#### Request

| Name | Type |
|---|---|
| `data` | `vector<uint8>` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.serialimpl#Device_Write_Result` |

## **STRUCTS**

### Device_CancelAll_Response

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=102)*

\<EMPTY\>

### Device_Config_Response

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=55)*

\<EMPTY\>

### Device_Enable_Response

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=68)*

\<EMPTY\>

### Device_GetInfo_Response

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

| Field | Type | Description | Default |
|---|---|---|---|
| `info` | `https://fuchsia.dev/reference/fuchsia.hardware.serial//https://fuchsia.dev/reference/fuchsia.hardware.serial#SerialPortInfo` |   | No default |

### Device_Read_Response

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=82)*

| Field | Type | Description | Default |
|---|---|---|---|
| `data` | `vector<uint8>` |   | No default |

### Device_Write_Response

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=99)*

\<EMPTY\>

## **UNIONS**

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

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=102)*

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

<br />

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

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=55)*

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

<br />

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

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=68)*

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

<br />

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

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

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

<br />

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

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=82)*

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

<br />

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

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=99)*

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

<br />

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [SERIAL_DATA_BITS_5](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=13) | `0` | `uint32` |   |
| [SERIAL_DATA_BITS_6](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=14) | `1` | `uint32` |   |
| [SERIAL_DATA_BITS_7](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=15) | `2` | `uint32` |   |
| [SERIAL_DATA_BITS_8](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=16) | `3` | `uint32` |   |
| [SERIAL_DATA_BITS_MASK](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=17) | `3` | `uint32` |   |
| [SERIAL_FLOW_CTRL_CTS_RTS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=32) | `32` | `uint32` |   |
| [SERIAL_FLOW_CTRL_MASK](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=33) | `32` | `uint32` |   |
| [SERIAL_FLOW_CTRL_NONE](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=31) | `0` | `uint32` |   |
| [SERIAL_PARITY_EVEN](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=26) | `8` | `uint32` |   |
| [SERIAL_PARITY_MASK](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=28) | `24` | `uint32` |   |
| [SERIAL_PARITY_NONE](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=25) | `0` | `uint32` |   |
| [SERIAL_PARITY_ODD](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=27) | `16` | `uint32` |   |
| [SERIAL_SET_BAUD_RATE_ONLY](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=36) | `2147483648` | `uint32` |   |
| [SERIAL_STOP_BITS_1](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=20) | `0` | `uint32` |   |
| [SERIAL_STOP_BITS_2](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=21) | `4` | `uint32` |   |
| [SERIAL_STOP_BITS_MASK](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=22) | `4` | `uint32` |   |

## **SERVICES**

### Service

*Defined in [fuchsia.hardware.serialimpl/serial-impl.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=105)*

| Name | Type | Transport |
|---|---|---|
| [device](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.serialimpl/serial-impl.fidl;l=106) | `fuchsia.hardware.serialimpl/Device` | Driver |

<br />