Universal Serial Bus (USB)
Universal Serial Bus (USB) provides an expandable, hot-pluggable Plug and Play serial interface that ensures a standard, low-cost connection for peripheral devices such as keyboards, mice, joysticks, printers, scanners, storage devices, modems, and video conferencing cameras. Migration to USB is recommended for all peripheral devices that use legacy ports such as PS/2, serial, and parallel ports.
The USB-IF is a Special Interest Groups (SIGs) that maintains the Official USB Specification, test specifications and tools.
Windows operating systems include native support for USB host controllers, hubs, and devices and systems that comply with the official USB specification. Windows also provides programming interfaces that you can use to develop device drivers and applications that communicate with a USB device.
USB in Windows
Other Resources for USB
|
Get started with USB programming...
USB programming reference
USB samples Development tools
USB-related videos
USB hardware for learning
|
Common USB scenarios
1—Get the device handle for communication and use the retrieved handle or object to send data transfers.
Client driver | Windows Store app | Windows desktop app |
---|---|---|
KMDF: WdfUsbTargetDeviceCreateWithParameters UMDF: IWDFUsbTargetDevice |
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 driver | Windows Store app | Windows desktop app |
---|---|---|
KMDF: WdfUsbTargetDeviceGetDeviceDescriptor WdfUsbTargetDeviceRetrieveConfigDescriptor UMDF: IWDFUsbTargetDevice::RetrieveDescriptor See USB descriptors. |
2—Configure the device to select an active USB configuration and setting per interface.
Client driver | Windows Store app | Windows desktop app |
---|---|---|
KMDF: WdfUsbTargetDeviceSelectConfig USBD_SelectConfigUrbAllocateAndBuild 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. | WinUsb_SetCurrentAlternateSetting |
3—Send control transfers for configuring the device and performing vendor commands that are specific to particular device.
Client driver | Windows Store app | Windows desktop app |
---|---|---|
KMDF: WdfUsbTargetDeviceSendControlTransferSynchronously WdfUsbTargetDeviceFormatRequestForControlTransfer USBD_SelectConfigUrbAllocateAndBuild UMDF: |
4—Send bulk transfers, typically used by mass storage devices that transfer large amount of data.
5—Send interrupt transfers. Data is read to retrieve hardware interrupt data.
Client driver | Windows Store app | Windows 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 driver | Windows Store app | Windows desktop app |
---|---|---|
KMDF: WdfUsbTargetDeviceCreateIsochUrb See How to transfer data to USB isochronous endpoints. UMDF: Not supported. |
Not supported. |
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 driver | Windows Store app | Windows desktop app |
---|---|---|
KMDF: WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS UMDF: IWDFUsbTargetDevice::SetPowerPolicy IWDFDevice2::AssignS0IdleSettings |
Not supported. |