Table of contents
TOC
Collapse the table of content
Expand the table of content

Concepts for all USB developers

Last Updated: 2/15/2017

A Universal Serial Bus (USB) device defines its capabilities and features through configurations, interfaces, alternate settings, and endpoints. This topic provides a high-level overview of those concepts. For details, see the USB specifications at Universal Serial Bus Documents.

In this section

TopicDescription

USB device layout

A USB device defines its capabilities and features through configurations, interfaces, alternate settings, and endpoints. This topic provides a high-level overview of those concepts.

Standard USB descriptors

A USB device provides information about itself in data structures called USB descriptors. This section provides information about device, configuration, interface, and endpoint descriptors and ways to retrieve them from a USB device.

USB endpoints and their pipes

A USB device has endpoints that are used to for data transfers. On the host side, endpoints are represented by pipes. This topic differentiates between those two terms.

USB in Windows - FAQ

This topic presents frequently asked questions for driver developers who are new to developing and integrating USB devices and drivers with Windows operating systems.

Common USB scenarios

1—Get the device handle for communication and use the retrieved handle or object to send data transfers.

Client driverWindows Store appWindows desktop app

KMDF: WdfUsbTargetDeviceCreateWithParameters

UMDF: IWDFUsbTargetDevice

UsbDevice

How to connect to a USB device (Windows Store app).

WinUsb_Initialize

See Write a Windows desktop app based on the WinUSB template.

USB descriptor retrieval to get information about the device's configuration(s), interface(s), setting(s), and their endpoint(s).

Client driverWindows Store appWindows desktop app

KMDF:

WdfUsbTargetDeviceGetDeviceDescriptor

WdfUsbTargetDeviceRetrieveConfigDescriptor

UMDF:

IWDFUsbTargetDevice::RetrieveDescriptor

See USB descriptors.

UsbDevice.DeviceDescriptor

UsbConfiguration.Descriptors

UsbInterface.Descriptors

UsbInterfaceSetting.Descriptors

How to get USB descriptors (Windows Store app).

WinUsb_GetDescriptor

WinUsb_QueryInterfaceSettings

WinUsb_QueryPipe

See Query the Device for USB Descriptors.

2—Configure the device to select an active USB configuration and setting per interface.

Client driverWindows Store appWindows desktop app

KMDF:

WdfUsbTargetDeviceSelectConfig

WdfUsbTargetDeviceCreateUrb

USBD_SelectConfigUrbAllocateAndBuild

WdfUsbInterfaceSelectSetting

See How to select a configuration for a USB device.

See How to select an alternate setting in a USB interface.

UMDF:

Configuration selection is not Supported.

IWDFUsbInterface::SelectSetting

UsbInterfaceSetting.SelectSettingAsync

How to select a USB interface setting (Windows Store app).

WinUsb_SetCurrentAlternateSetting

3—Send control transfers for configuring the device and performing vendor commands that are specific to particular device.

Client driverWindows Store appWindows desktop app

KMDF:

WdfUsbTargetDeviceSendControlTransferSynchronously

WdfUsbTargetDeviceFormatRequestForControlTransfer

USBD_SelectConfigUrbAllocateAndBuild

UMDF:

IWDFUsbTargetDevice::FormatRequestForControlTransfer

See How to send a USB control transfer.

SendControlInTransferAsync

SendControlOutTransferAsync

How to send a USB control transfer (Windows Store app).

WinUsb_ControlTransfer

See Send Control Transfer to the Default Endpoint.

4—Send bulk transfers, typically used by mass storage devices that transfer large amount of data.

Client driverWindows Store appWindows desktop app

KMDF:

WdfUsbTargetPipeReadSynchronously

WdfUsbTargetPipeWriteSynchronously

WdfUsbTargetPipeFormatRequestForRead

WdfUsbTargetPipeFormatRequestForWrite

How to send USB bulk transfer requests

How to use the continuous reader for reading data from a USB pipe.

UMDF:

IUsbTargetPipeContinuousReaderCallbackReadComplete

IWDFUsbTargetPipe

IWDFUsbTargetPipe2

UsbBulkInPipe.InputStream

UsbBulkOutPipe.OutputStream

How to send a USB bulk transfer request (Windows Store app).

WinUsb_WritePipe

WinUsb_ReadPipe

See Issue I/O Requests.

5—Send interrupt transfers. Data is read to retrieve hardware interrupt data.

Client driverWindows Store appWindows desktop app

Same as bulk transfers.

UsbInterruptInPipe.DataReceived

UsbInterruptOutPipe.OutputStream

How to send a USB interrupt transfer request (Windows Store app).

Same as bulk transfers.

6—Send isochronous transfers, mostly used for media streaming devices.

Client driverWindows Store appWindows desktop app

KMDF:

WdfUsbTargetDeviceCreateIsochUrb

See How to transfer data to USB isochronous endpoints.

UMDF: Not supported.

Not supported.

WinUsb_RegisterIsochBuffer

WinUsb_UnregisterIsochBuffer

WinUsb_WriteIsochPipeAsap

WinUsb_ReadIsochPipeAsap

WinUsb_WriteIsochPipe

WinUsb_ReadIsochPipe

WinUsb_GetCurrentFrameNumber

WinUsb_GetAdjustedFrameNumber

See Sending USB isochronous transfers from a WinUSB desktop app.

7—USB selective suspend to allow the device to enter a low power state and bring the device back to working state.

Client driverWindows Store appWindows desktop app

KMDF:

WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS

WdfDeviceAssignS0IdleSettings

UMDF:

IWDFUsbTargetDevice::SetPowerPolicy

IWDFDevice2::AssignS0IdleSettings

IWDFDevice3::AssignS0IdleSettingsEx

See How to send a device to selective suspend.

Not supported.

WinUsb_SetPowerPolicy

See WinUSB Power Management.

Universal Serial Bus (USB)

Send comments about this topic to Microsoft

© 2017 Microsoft