EN
本內容沒有您的語言版本,但有英文版本。

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 for device builders USB for driver developers USB for app developers USB HCK certification

USB in Windows

Windows 8.1: What's new for USB

Overview of new features and improvements in USB in Windows 8.1.

USB FAQ

Frequently asked questions from driver developers about the USB stack and features that are supported in USB.

Microsoft OS Descriptors for USB Devices

Windows defines MS OS descriptors that allows better enumeration when connected to system running Windows operating system

Microsoft-provided USB drivers

Host controller and hub drivers - USB driver stack

Microsoft provides a core stack of drivers that interoperate with devices that are connected to EHCI and xHCI controllers.

USB-IF device class drivers

Windows provides in-box device class drivers for many USB-IF approvide device classes, audio, mass storage, and so on.

USB generic function driver–WinUSB

Windows provides Winusb.sys that can be loaded as a function driver for a custom device and a function of a composite device.

USB generic parent driver for composite devices–Usbccgp

Parent driver for USB devices with multiple functions. Usbccgp creates physical device objects (PDOs) for each of those functions. Those individual PDOs are managed by their respective USB function drivers, which could be the Winusb.sys driver or a USB device class driver.

Testing USB devices with Windows

Testing USB hardware, drivers, and apps in Windows

Get information about the tools that you can use to test your USB hardware or software, capture traces of operations and other system events, and observe how the USB driver stack responds to a request sent by a client driver or an application.

Read an overview of tests in the Hardware Certification Kit that enable hardware vendors and device manufacturers to prepare their USB devices and host controllers for Windows Hardware Certification submission.

Other Resources for USB

Official USB Specification

Provides complete technical details for the USB protocol.

Microsoft Windows USB Core Team Blog

Check out posts written by the Microsoft USB Team. The blog focuses on the Windows USB driver stack that works with various USB Host controllers and USB hubs found in Windows PC. A useful resource for USB client driver developers and USB hardware designers understand the driver stack implementation, resolve common issues, and explain how to use tools for gathering traces and log files.

OSR Online Lists - ntdev

Discussion list managed by OSR Online for kernel-mode driver developers.

Windows Dev-Center for Hardware Development

Miscellaneous resources based on frequently asked questions from developers who are new to developing USB devices and drivers that work with Windows operating systems.

Get started with USB programming...

Write a USB client driver (KMDF, UMDF)

Introduces you to USB driver development. Provides information about choosing the most appropriate model for providing a USB driver for your device. This section also includes tutorials about writing your first user-mode and kernel-mode USB drivers by using the USB templates included with Microsoft Visual Studio Ultimate 2012.

Talk to USB devices, start to finish (Windows Store app)

Provides step-by-step instructions about implementing USB features in a Windows Store app. To write such an app for a USB device you need Microsoft Visual Studio 2013 and Microsoft Windows Software Development Kit (SDK) for Windows 8.1.

Write a WinUSB application (Windows desktop app)

Describes how an application can call WinUSB Functions to communicate with a USB device.

Common programming scenarios

List of common tasks that a driver or an app performs in order to communicate with a USB device. Get quick info about the programming interfaces you need for each task.

USB programming reference

USB DDIs (Driver development)

Specifications for I/O requests, support routines, structures, and interfaces used by USB client drivers.

Windows.Devices.Usb (Windows Store app)

Specifications for the namespace that defines Windows Runtime classes that a Windows store app can use to communicate with a USB device.

WinUSB Functions (Windows desktop app)

Specifications for WinUsb_Xxx functions and structures used by a Win32 app C/C++ app.

USB samples

Windows Store app samples for USB

Windows driver samples for USB

Development tools

Download Microsoft Visual Studio Professional
Download Visual Studio Ultimate
Download Windows Driver Kit (WDK)
Download Windows SDK
Visual Studio Express 2013 for writing Windows Store device apps

USB-related videos

Windows Store apps for USB devices
Understanding USB 3.0 in Windows 8
Building great USB 3.0 devices
USB Debugging Innovations in Windows 8 (Part I, II, & III)

USB hardware for learning

MUTT devices

MUTT and SuperMUTT devices and the accompanying software package are integrated into the HCK suite of USB tests. They provide automated testing that can be used during the development cycle of USB controllers, devices and systems, especially stress testing.

OSR USB FX2 Learning Kit

If you are new to USB driver development. The kit is the most suitable to study USB samples included in this documentation set. You can get the learning kit from OSR Online Store.

 

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.

 

 

 

Send comments about this topic to Microsoft

顯示:
© 2014 Microsoft