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. 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. The USB mouse client driver supports the attachment of multiple USB mouse devices. Each device is enumerated in the Object Data Manager (ODM) and marked available. The client driver treats all the mouse devices as a single logical device. Input events from all the devices are sent to a single input ring. Original title: Slow Device Installation I am using Win7-Ultimate (32-bit) on my compaq laptop. Whenever I connect a device/USB drive through USB port or a Bluetooth device, device driver installation takes a very long time. USB Mass Storage Device - Driver Download. Vendor:. Product: USB Mass Storage Device. Hardware Class: hdc. Search For More Drivers.: Go!
For information about new features in USB in general, see New for USB Drivers.
New Driver Stack for USB 3.0 Devices
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.
Features Supported by the New Stack
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.
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.
Client contract version for USB client drivers
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.|
New Routines for Allocating and Building URBs
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.
New User Mode I/O Control Requests for USB 3.0 Hubs
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
New Compatible ID for WinUSB
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 USBMS_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.
New Visual Studio templates for USB client drivers (*New for Beta)
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.
Windows 8 includes a new USB storage driver that implements the USB Attached SCSI Protocol (UASP). The new driver uses static streams for bulk endpoints, as per the official USB 3.0 specification.
The Windows to Go feature allows Windows to boot from a flash drive or an external drive. You can boot with your copy of Windows from those drives on various machines.
Enhanced debugging and diagnostic capabilities
Windows 8 provides new USB 3.0 debugging tools to improve diagnosing USB issues faster. There are new USB 3.0 kernel debugger extensions that examine USB 3.0 host controller and device states. You can use USB WPP and event tracing to analyze USB interactions and troubleshoot USB device issues more easily. Windows 8 supports debugging over USB 3.0. For more information, see Setting Up a USB 3.0 Connection Manually.
New USB-specific failure messages in Device Manager
At times, Windows can fail to enumerate an attached USB device. Typically, enumeration failures occur when requests sent to the USB device fail or the device returns incorrect descriptors.
In Windows 8, when such failures occur, the General tab in Device Manager displays a USB-specific error message that indicates the reason for failure.
Selectwireless USB Devices Driver
The error strings are as follows:
- A request for the USB device descriptor failed.
- The USB set address request failed.
- A USB port reset request failed.
- A previous instance of the USB device was not removed.
- The USB device returned an invalid USB configuration descriptor.
- The USB device returned an invalid USB device descriptor.
- Unable to access the registry.
- A request for the USB configuration descriptor failed.
- A request for the USB device's port status failed.
- The USB device returned an invalid serial number string.
- The USB set SEL request failed.
- A request for the USB BOS descriptor failed.
- A request for the USB device qualifier descriptor failed.
- A request for the USB serial number string descriptor failed.
- A request for the USB language ID string descriptor failed.
- A request for the USB product description string descriptor failed.
- A request for the Microsoft OS extended configuration descriptor failed.
- A request for the Microsoft OS container ID descriptor failed.
- The USB device returned an invalid USB BOS descriptor.
- The USB device returned an invalid USB device qualifier descriptor.
- The USB device returned an invalid USB language ID string descriptor.
- The USB device returned an invalid Microsoft OS container ID descriptor.
- The USB device returned an invalid Microsoft OS extended configuration descriptor.
- The USB device returned an invalid product description string descriptor.
- The USB device returned an invalid serial number string descriptor.
New for USB Drivers
Universal Serial Bus (USB) Drivers
Select Wireless Usb Devices Drivers
- End-to-end walkthrough for creating a UWP app that talks to a USB device
- Companion sample: Custom USB device access sample
Use the Windows Runtime APIs, introduced in Windows 8.1, to write UWP apps that gives users access to their peripheral USB device. Such apps can connect to a device based on user-specified criteria, get information about the device, send data to the device and conversely get data streams from the device, and poll the device for interrupt data.
Here we describe, how your UWP app using C++, C#, or Visual Basic app can implement those tasks, and link to examples that demonstrate the use of classes included in Windows.Devices.Usb. We'll go over the device capabilities required in the app manifest and how to launching the app when the device is connected. And we'll show how to run a data transfer task in the background even when the app is suspended to conserve battery life.
Follow the steps in this section or, skip directly to the Custom USB device access sample. The companion sample implements all the steps here, but to keep things moving we won't walk through the code. Certain steps have a Find it in the sample section to help you find the code quickly. The structure of the sample's source files is simple and flat so you can easily find code without having to drill down through multiple layers of source files. But you may prefer to break up and organize your own project differently.
In this section
Walkthrough—Writing UWP app for USB devices
Step 1—Install the Microsoft-provided WinUSB driver as function driver for your device.
QuickStart:WinUSB (Winusb.sys) Installation
You can install Winusb.sys in these ways:
Step 2—Get the device interface GUID, hardware ID, and device class information about your device.
You can obtain that information from the device manufacturer.
Step 3—Determine whether the device class, subclass, and protocol allowed by the Windows Runtime USB API set.
You can write a UWP app, if device class, subclass, and protocol code of the device is one of the following:
Step 4—Create a basic Visual Studio 2013 project that you can extend in this tutorial.
|For more information, see Getting started with UWP apps.|
Step 5—Add USB device capabilities to the app manifest.
QuickStart:How to add USB device capabilities to the app manifest
Open your Package.appxmanifest file in a text editor and add the DeviceCapability](/uwp/schemas/appxpackage/appxmanifestschema/element-devicecapability)'>DeviceCapability element with Name attribute set to 'usb' as shown in this example.
Note You cannot modify the USB device capability in Visual Studio 2013. You must select and hold (or right-click) the Package.appxmanifest file in Solution Explorer and select Open With..., and then XML (Text) Editor. The file opens in plain XML.
Find it in the sample: The USB device capabilities are added in the Package.appxmanifest file.
Step 6— Extend the app to open the device for communication.
Quickstart:How to connect to a USB device (UWP app)
Find it in the sample: See files named Scenario1_DeviceConnect.
Step 7(Recommended)—Study your USB device layout.
Review basic USB concepts about configuring the device and performing data transfers: Concepts for all USB developers.
View the device configuration descriptor, interface descriptors for each supported alternate settings, and their endpoint descriptors. By using USBView, you can browse all USB controllers and the USB devices connected to them, and also inspect the device configuration.
Step 8— Extend the app to get and show USB descriptors in the UI.
Quickstart:How to get USB descriptors (UWP app)
Find it in the sample: See files named Scenario5_UsbDescriptors.
Step 9— Extend the app to send vendor-defined USB control transfers.
Quickstart:How to send a USB control transfer request (UWP app)
Find it in the sample: See files named Scenario2_ControlTransfer.
Step 10— Extend the app to read or write bulk data.
Quickstart:How to send a USB bulk transfer request (UWP app)
Find it in the sample: See files named Scenario4_BulkPipes.
Step 11— Extend the app to get hardware interrupt data.
Quickstart:How to send a USB interrupt transfer request (UWP app)
Find it in the sample: See files named Scenario3_InterruptPipes.
Step 12— Extend the app to select an interface setting that is not currently active.
Quickstart:How to select a USB interface setting (UWP app)
When the device is opened for communication, the default interface and its first setting is selected. If you want to change that setting, follow these steps:
Step 13— Close the device.
Quickstart:How to connect to a USB device (UWP app)
After you are finished using the UsbDevice object, close the device.
Find it in the sample: See files named Scenario1_DeviceConnect.
Step 14—Create a device metadata package for the app.
|Tool:Device Metadata Authoring Wizard|
Associate your app with the device by following the steps in the wizard. Enter this information about your device:
To declare the app as a privileged app for your device, follow these instructions:
Find it in the sample: See the DeviceMetadata folder.
Step 15—Extend the app to implement AutoPlay activation so that the app is launched when the device is connected to the system.
Quickstart:Register an app for an AutoPlay device
You can add AutoPlay capabilities so that app is launched when the device is connected to the system. You can enable Autoplay for all UWP apps (privileged or otherwise).
Step 16—Extend the app to implement a background task that can perform length transfers to the device, such as firmware update without the app getting suspended.
To implement background task, you need two classes.
The background task class implements the IBackgroundTask](/uwp/api/Windows.ApplicationModel.Background.IBackgroundTask)'>IBackgroundTask interface and contains the actual code you create to either sync or update your peripheral device. The background task class is executed when the background task is triggered and from the entry point provided in your app’s application manifest.
Note The device background tasks infrastructure provided by Windows 8.1. For more information about Windows background tasks see Supporting your app with background tasks.
Background task class
The UWP app registers and triggers a DeviceUseTrigger background task. The app register, trigger, and handle progress on a background task.
Note The example code that follows can be applied to the DeviceServicingTrigger background task by use the corresponding objects. The only difference between the two trigger objects and their corresponding APIs are the policy checks made by Windows.
Find it in the sample: See files named Scenario7_Sync files. Background class is implemented in IoSyncBackgroundTask.
Step 17—Run Windows App Certification Kit.
Recommended. Running Windows App Certification Kit helps you make sure your app fulfills Microsoft Store requirements, so you should do this when you've added major functionality to your app.
Want to know more?
Learn more from related samples.
Learn more about designing UWP app UI.
Roadmap for UWP apps using C# and Visual Basic and Roadmap for UWP apps using C++
Learn more about creating UWP apps using C++, C#, or Visual Basic in general.
Learn about how to make your apps stay responsive when they do work that might take an extended amount of time.