<!--
{
  "availability" : [
    "DriverKit: 19.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "USBSerialDriverKit",
  "identifier" : "/documentation/USBSerialDriverKit/IOUserUSBSerial",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "USBSerialDriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOUserUSBSerial"
  },
  "title" : "IOUserUSBSerial"
}
-->

# IOUserUSBSerial

A service that manages a serial connection to a USB device.

```
class IOUserUSBSerial;
```

## Overview

Subclass `IOUserUSBSerial` to implement a driver that communicates with a USB device serially. After matching your driver to the appropriate device, the system starts your driver and calls its [`HwActivate`](/documentation/USBSerialDriverKit/IOUserUSBSerial/HwActivate) method, which you use to open and configure the communications channel for your device. Configure other hardware-related settings by overriding the appropriate methods defined in the <doc://com.apple.documentation/documentation/SerialDriverKit/IOUserSerial> parent class.

This class automatically manages the serial communications with the device, buffering data received from it. The class creates the buffers for holding data, and initiates asynchronous operations to the USB device to transmit and receive data. Use the methods of this class to modify the data, as needed.

## Topics

### Configuring the Service

[`virtual bool init();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/init)

Handles the basic initialization of the service.

[`virtual kern_return_t Start(IOService *provider);`](/documentation/USBSerialDriverKit/IOUserUSBSerial/Start)

Starts the service for the specified provider.

[`virtual kern_return_t Stop(IOService *provider);`](/documentation/USBSerialDriverKit/IOUserUSBSerial/Stop)

Stops the service that matches the specified provider.

[`virtual void free();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/free)

Performs any final cleanup for the service.

[`virtual bool initWith(IOBufferMemoryDescriptor *ifmd);`](/documentation/USBSerialDriverKit/IOUserUSBSerial/initWith)

Initializes the private data structures associated with this class.

### Activating and Deactivating the Service

[`virtual kern_return_t HwActivate();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/HwActivate)

Opens the communication channel to the device.

[`virtual kern_return_t HwDeactivate();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/HwDeactivate)

Closes the communication channel to the device.

### Transmitting and Receiving Data

[`virtual void handleRxPacket(uint8_t * & packet, uint32_t & size);`](/documentation/USBSerialDriverKit/IOUserUSBSerial/handleRxPacket)

Processes the data received from the USB device.

[`virtual void RxFreeSpaceAvailable();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/RxFreeSpaceAvailable)

Notifies your driver that buffer space is available for your device’s data.

[`virtual void TxDataAvailable();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/TxDataAvailable)

Notifies your driver that the system has data for you to transmit to the device.

[`virtual void handleInterruptPacket(const uint8_t *packet, uint32_t size);`](/documentation/USBSerialDriverKit/IOUserUSBSerial/handleInterruptPacket)

Processes an interrupt packet that originated from the device.

### Configuring the Serial Data Queues

[`virtual kern_return_t ConnectQueues(IOBufferMemoryDescriptor **ifmd, IOMemoryDescriptor **rxqmd, IOMemoryDescriptor **txqmd, IOMemoryDescriptor *in_rxqmd, IOMemoryDescriptor *in_txqmd, uint32_t in_rxqoffset, uint32_t in_txqoffset, uint8_t in_rxqlogsz, uint8_t in_txqlogsz);`](/documentation/USBSerialDriverKit/IOUserUSBSerial/ConnectQueues)

Creates and configures the buffers that store the data moving to and from the device.

[`virtual kern_return_t DisconnectQueues();`](/documentation/USBSerialDriverKit/IOUserUSBSerial/DisconnectQueues)

Releases the buffers that manage data moving to and from the device.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)