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

# IOUSBHostDevice

A provider object that represents the USB device.

```
class IOUSBHostDevice;
```

## Overview

An [`IOUSBHostDevice`](/documentation/USBDriverKit/IOUSBHostDevice) object represents a USB device connected to the user’s Mac. Use this object to retrieve the device’s configuration descriptor and capabilities. You can also iterate over the interfaces that the device uses to communicate.

Typically, you don’t create [`IOUSBHostDevice`](/documentation/USBDriverKit/IOUSBHostDevice) objects directly. Instead, the system creates one during the matching process for the USB device and passes it as the provider object to your custom driver.

To use a host device object, call [`Open`](/documentation/USBDriverKit/IOUSBHostDevice/Open) to create a new session between the device and your driver. After successfully opening your session, you can request information from the device, fetch descriptors, and iterate over the available interfaces. Remember to close the session you opened in the <doc://com.apple.documentation/documentation/DriverKit/IOService/Stop> method of your driver.

## Topics

### Managing the Device Session

[`virtual kern_return_t Open(IOService *forClient, IOOptionBits options, uintptr_t arg);`](/documentation/USBDriverKit/IOUSBHostDevice/Open)

Opens a session to a host device.

[`virtual kern_return_t Close(IOService *forClient, IOOptionBits options);`](/documentation/USBDriverKit/IOUSBHostDevice/Close)

Closes the session to the host device.

[`virtual kern_return_t Reset();`](/documentation/USBDriverKit/IOUSBHostDevice/Reset)

Terminates the device and attempts to reenumerate it.

### Getting the Device Descriptors

[`virtual const IOUSBBOSDescriptor * CopyCapabilityDescriptors();`](/documentation/USBDriverKit/IOUSBHostDevice/CopyCapabilityDescriptors)

Returns the device’s capability descriptors.

[`virtual const IOUSBConfigurationDescriptor * CopyConfigurationDescriptor(uint8_t index);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyConfigurationDescriptor-lej1)

Returns the configuration descriptor with the specified index.

[`virtual const IOUSBConfigurationDescriptor * CopyConfigurationDescriptor(IOService *forClient);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyConfigurationDescriptor-6qgew)

Returns the currently selected configuration descriptor.

[`virtual const IOUSBConfigurationDescriptor * CopyConfigurationDescriptorWithValue(uint8_t bConfigurationValue);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyConfigurationDescriptorWithValue)

Returns the configuration descriptor with the specified configuration value.

[`virtual const IOUSBDeviceDescriptor * CopyDeviceDescriptor();`](/documentation/USBDriverKit/IOUSBHostDevice/CopyDeviceDescriptor)

Returns the device descriptor.

[`virtual const IOUSBStringDescriptor * CopyStringDescriptor(uint8_t index, uint16_t languageID);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyStringDescriptor-28ybo)

Returns a string descriptor from the device.

[`virtual const IOUSBStringDescriptor * CopyStringDescriptor(uint8_t index);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyStringDescriptor-9h8l2)

Returns a string descriptor from the device.

[`virtual kern_return_t CopyDescriptor(uint8_t type, uint16_t *length, uint8_t index, uint16_t languageID, uint8_t requestType, uint8_t requestRecipient, uint8_t *descriptor);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyDescriptor)

Retrieves any type of descriptor from the cache or the device.

[`enum tIOUSBDeviceRequestTypeValue : unsigned int;`](/documentation/USBDriverKit/tIOUSBDeviceRequestTypeValue)

Constants indicating the type of request to make from a device.

[`enum tIOUSBDeviceRequestRecipientValue : unsigned int;`](/documentation/USBDriverKit/tIOUSBDeviceRequestRecipientValue)

Constants indicating the type of object that receives the results of a request.

[Descriptor Utilities](/documentation/USBDriverKit/descriptor-utilities)

Iterate over the descriptors of a USB device and fetch specific values.

### Disposing of Descriptors

[`void IOUSBHostFreeDescriptor(const IOUSBDeviceDescriptor *descriptor);`](/documentation/USBDriverKit/IOUSBHostFreeDescriptor-2hkne)

Releases the specified device descriptor.

[`void IOUSBHostFreeDescriptor(const IOUSBConfigurationDescriptor *descriptor);`](/documentation/USBDriverKit/IOUSBHostFreeDescriptor-2r7k)

Releases the specified configuration descriptor.

[`void IOUSBHostFreeDescriptor(const IOUSBBOSDescriptor *descriptor);`](/documentation/USBDriverKit/IOUSBHostFreeDescriptor-5j4pp)

Releases the specified BOS descriptor.

[`void IOUSBHostFreeDescriptor(const IOUSBStringDescriptor *descriptor);`](/documentation/USBDriverKit/IOUSBHostFreeDescriptor-3fve6)

Releases the specified string descriptor.

### Requesting Information from the Device

[`virtual kern_return_t DeviceRequest(IOService *forClient, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, IOMemoryDescriptor *dataBuffer, uint16_t *bytesTransferred, uint32_t completionTimeoutMs);`](/documentation/USBDriverKit/IOUSBHostDevice/DeviceRequest)

Sends a synchronous request to the device on the default control endpoint.

[`virtual kern_return_t AsyncDeviceRequest(IOService *forClient, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength, IOMemoryDescriptor *dataBuffer, OSAction *completion, uint32_t completionTimeoutMs);`](/documentation/USBDriverKit/IOUSBHostDevice/AsyncDeviceRequest)

Enqueues a request on the default control endpoint of the device.

[`virtual void CompleteAsyncDeviceRequest(OSAction *action, IOReturn status, uint32_t bytesTransferred);`](/documentation/USBDriverKit/IOUSBHostDevice/CompleteAsyncDeviceRequest)

The type definition for an asynchronous device request completion routine.

[`virtual kern_return_t AbortDeviceRequests(IOService *forClient, IOOptionBits options, IOReturn withError);`](/documentation/USBDriverKit/IOUSBHostDevice/AbortDeviceRequests)

Aborts device requests that you made previously from the current device client.

### Creating Memory Buffers

[`virtual kern_return_t CreateIOBuffer(IOOptionBits options, uint64_t capacity, IOBufferMemoryDescriptor **buffer);`](/documentation/USBDriverKit/IOUSBHostDevice/CreateIOBuffer)

Allocates a buffer for use during I/O operations.

### Iterating Over the Device Interfaces

[`virtual kern_return_t CreateInterfaceIterator(uintptr_t *ref);`](/documentation/USBDriverKit/IOUSBHostDevice/CreateInterfaceIterator)

Creates an iterator to get the list of interfaces from the device.

[`virtual kern_return_t CopyInterface(uintptr_t ref, IOUSBHostInterface **interface);`](/documentation/USBDriverKit/IOUSBHostDevice/CopyInterface)

Gets the next host interface child associated with this device.

[`virtual kern_return_t DestroyInterfaceIterator(uintptr_t ref);`](/documentation/USBDriverKit/IOUSBHostDevice/DestroyInterfaceIterator)

Destroys an interface iterator that you created.

### Getting Device Information

[`virtual kern_return_t GetAddress(uint8_t *address) const;`](/documentation/USBDriverKit/IOUSBHostDevice/GetAddress)

Returns the address of the device.

[`virtual kern_return_t GetSpeed(uint8_t *speed) const;`](/documentation/USBDriverKit/IOUSBHostDevice/GetSpeed)

Retrieves the device’s operational speed.

[`virtual kern_return_t GetFrameNumber(uint64_t *frameNumber, uint64_t *theTime);`](/documentation/USBDriverKit/IOUSBHostDevice/GetFrameNumber)

Gets the current frame number of the USB controller.

[`virtual kern_return_t GetPortStatus(uint32_t *portStatus);`](/documentation/USBDriverKit/IOUSBHostDevice/GetPortStatus)

Returns the current port status of the device.

[`enum tIOUSBHostConnectionSpeed : unsigned int;`](/documentation/USBDriverKit/tIOUSBHostConnectionSpeed)

Constants indicating the connection speed of the device.

[`enum tIOUSBHostPortStatus : unsigned int;`](/documentation/USBDriverKit/tIOUSBHostPortStatus)

Constants indicating the state of a port.

[`enum tIOUSBHostPortType : unsigned int;`](/documentation/USBDriverKit/tIOUSBHostPortType)

Constants indicating a port’s type.

### Configuring the Device

[`virtual kern_return_t SetConfiguration(uint8_t bConfigurationValue, bool matchInterfaces);`](/documentation/USBDriverKit/IOUSBHostDevice/SetConfiguration)

Selects a new configuration for the device.

### Instance Methods

[`virtual kern_return_t CurrentMicroframe(uint64_t *microframeNumber, uint64_t *theTime);`](/documentation/USBDriverKit/IOUSBHostDevice/CurrentMicroframe)

[`virtual kern_return_t ReferenceMicroframe(uint64_t *microframeNumber, uint64_t *theTime);`](/documentation/USBDriverKit/IOUSBHostDevice/ReferenceMicroframe)

## Relationships

### Inherits From

[`IOService`](/documentation/DriverKit/IOService)

---

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)