What's New for USB Client Drivers
This topic summarizes the new features and improvements for Universal Serial Bus (USB) client drivers in Windows 8.
- New Driver Stack for USB 3.0 Devices
- Features Supported by the New Stack
- Client contract version for USB client drivers
- New Routines for Allocating and Building URBs
- New User Mode I/O Control Requests for USB 3.0 Hubs
- New Compatible ID for WinUSB
- New Visual Studio templates for USB client drivers (*New for Beta)
For information about new features in USB in general, see New for USB Drivers.
Windows 8 provides a new USB driver stack to support USB 3.0 devices. The new stack includes drivers that are loaded by Windows when a USB 3.0 device is attached to an xHCI host controller. The new drivers are based on Kernel Mode Driver Framework (KMDF) and implement features defined in the USB 3.0 specification. The new drivers are as follows:
The new driver stack maintains compatibility with the existing client drivers that were built and tested on earlier versions of the Windows operating system.
To see an architectural block diagram of the USB driver stack and a brief description of the new drivers, see USB 3.0 Driver Stack Architecture.
The USB driver stack for USB 3.0 devices supports many new features. Some of features are configurable by the client driver. Those features are as follows:
- Static streams for bulk endpoints.
Streams provide the client driver with the ability to perform multiple data transfers to a single bulk endpoint. The Windows Driver Kit (WDK) for Windows 8 provides new device driver interfaces (DDIs) that allow a client driver to can open up to 255 streams in a bulk endpoint. After streams have been opened, the client driver can perform data transfers to and from specific streams. For more information, see How to Open and Close Static Streams in a USB Bulk Endpoint.
- Chained MDLs
A client driver can specify the payload in a chain of MDLs instead of a contiguous buffer. This allows the transfer buffer to be segmented in physical memory hence removing restrictions on the number, size, and alignment of buffers. Using chained MDLs can boost performance during data transfers because it avoids double buffering. For more information, see How to Send Chained MDL.
- Function suspend and remote wake-up for composite devices.
The feature enables a function of a composite device to enter and exit a low-power state, independently of other functions. The function driver can also request a device-initiated remote wake-up. Such a request must be handled by the parent driver of the composite device. The Microsoft-provided parent driver (Usbccgp.sys) supports function suspend and remote wake-up features. The WDK for Windows 8 provides DDIs that allow replacement parent drivers to implement those features. For more information, see How to Implement Function Suspend in a Composite Driver.
A client contract version identifies a set of rules that the client driver when sending requests to the USB driver stack. Failure to do so might result in an unexpected behavior. For information about those rules, see Best Practices: Using URBs.
A client driver that intends to use the capabilities of the USB driver stack for 3.0 devices, must identify itself with the client contract version of USBD_CLIENT_CONTRACT_VERSION_602. Such a client driver is required to register with the USB driver stack. After registration, the client driver must query the underlying USB driver stack to determine whether the stack supports the required capability. To facilitate those operations, the following KMDF-specific methods and WDM routines have been included in the WDK for Windows 8:
|Use case||A KMDF-based driver should ...||A WDM driver must ...|
|To specify a client contract version and with the USB driver stack||Call the WdfUsbTargetDeviceCreateWithParameters method.||Call the USBD_CreateHandle routine.|
|To query for a particular capability||Call WdfUsbTargetDeviceQueryUsbCapability and specify the GUID of the capability to query.||Call USBD_QueryUsbCapability and specify the GUID of the capability to query.|
Windows 8 provides new routines for allocating, formatting, and releasing URBs. The URB structure is allocated by the USB driver stack. If the underlying stack is the new USB driver stack, the URB is paired with an opaque URB context. The USB driver stack uses the URB context to improve URB tracking and processing. For more information about the routines, see Allocating and Building URBs.
The new routines are as follows:
- USBD_AssignUrbToIoStackLocation routine to associate an URB with an IRP. This routine only applies to WDM client drivers.
In addition to the routines in the preceding list, there are new KMDF-specific methods for URB allocation. For KMDF-based client drivers, we recommend that you call,
- The WdfUsbTargetDeviceCreateUrb method (instead of USBD_UrbAllocate) to allocate an URB.
- The WdfUsbTargetDeviceCreateIsochUrb method (instead of USBD_IsochUrbAllocate)to allocate an URB for an isochronous transfer. Those calls allocate a variable-sized URB that is based on the number of isochronous packets required for the transfer. For more information about isochronous transfers, see How to Transfer Data to USB Isochronous Endpoints.
Windows 8 provides the new IOCTLs that applications can use to retrieve information about USB 3.0 hubs and their ports. The new IOCTLs are as follows:
By sending the preceding I/O requests to the USB driver stack an application retrieve the following set of information:
- Hub descriptors
- Properties of all ports and companion ports
- Operating speed of a device that is attached to a port
Device manufacturers can add "WINUSB" in the firmware (Microsoft OS feature descriptor) so that Windows recognizes the device as a WinUSB device. In Windows 8, Winusb.inf has been modified to include USB\MS_COMP_WINUSB as a device identifier string. That modification enables Windows to automatically load Winusb.sys, as the function driver for the device, as soon as the device is detected. For more information, see WinUSB Device.
Microsoft Visual Studio 2012 includes USB User-Mode Driver and USB Kernel-Mode Driver templates that generate starter code for a UMDF and KMDF USB client driver, respectively. The template code initializes the USB target device object to enable communication with the hardware. For more information, see the following topics:
For more information, see Getting started with USB client driver development. Extend your driver by performing Common tasks for USB client drivers.
For information about how to implement UMDF and KMDF drivers, see the Microsoft Press book Developing Drivers with the Windows Driver Foundation or the WHDC Web site.
Build date: 1/21/2013