USB FAQ - IntermediateUpdated: October 20, 2008 This paper answers frequently asked questions from developers about developing USB devices and drivers for Microsoft Windows. IntroductionWindows 98 and later versions of Windows include native support for Universal Serial Bus (USB) devices. This article provides answers to frequently asked questions from driver developers who need intermediate-level details about the USB stack and the USB features supported by Windows. Additional documentation for USB device and driver support is available in an introductory level FAQ, the current version of the Windows Driver Kit (WDK), and on the USB Architecture and Driver Support webpage at http://msdn.microsoft.com/en-us/windows/hardware/gg463155.aspx. Note: Unless otherwise specified, the information in this paper applies to Windows 2000 and later operating systems. Windows Support and USBThis section of the FAQ answers general questions about how Windows supports USB. Is my USB 2.0 hub single-TT or multi-TT?A USB 2.0 hub can have one transaction translator (TT) for all downstream-facing ports on the hub (single TT), or it can have one TT for each downstream-facing port on the hub (multiple TT). The value of the bDeviceProtocol field of the USB device descriptor and the bInterfaceProtocol field of the USB interface descriptor indicate whether a hub is single-TT or multi-TT:
Usbhub.sys uses this setting to enable multi-TT mode or single-TT mode. On Windows XP and later, Usbhub.sys always enables multi-TT mode on a multi-TT hub. For additional details about TT layout, see sections 11.14.1.3 and 11.23.1 of the USB 2.0 specification, which is available from the USB website at
http://www.usb.org/developers/docs
What characters or bytes are valid in a USB serial number?The USB device descriptor's iSerialNumber field indicates whether the device has a serial number and where the number is stored, as follows:
If the device has a serial number, the serial number must uniquely identify each instance of the same device. For example, if two device descriptors have identical values for the idVendor, idProduct, and bcdDevice fields, the iSerialNumber field must be different, to distinguish one device from the other. Plug and Play requires that every byte in a USB serial number be valid. If a single byte is invalid, Windows discards the serial number and treats the device as if it had no serial number. The following byte values are not valid for USB serial numbers:
For additional details on the iSerialNumber value, see section 9.6.1 of the USB 2.0 specification. What LANGID is used in a string request on localized builds of Windows?A USB device indicates the presence of a serial number by setting the iSerialNumber field of the USB device descriptor to the serial number's string index. To retrieve the serial number, Windows issues a string request with the language identifier (LANGID) set to 0x0409 (U.S. English). Windows always uses this LANGID to retrieve USB serial numbers, even for versions of Windows that are localized for other languages. What LANGID is used to extract a device's serial number?A USB device indicates the presence of a serial number by setting the iSerialNumber field of the USB device descriptor to the serial number's string index. To retrieve the serial number, Windows issues a string request with the language identifier (LANGID) set to 0x0409 (U.S. English). Windows always uses this LANGID to retrieve USB serial numbers, even for versions of Windows that are localized for other languages. What does the IsDeviceHighSpeed function indicate?The IsDeviceHighSpeed bus driver interface function returns the actual operational mode of the device in its current tree topology. If a device that supports high speed is connected to a USB 1.1 hub or a full-speed host controller, the function will indicate that the device is working at full speed. For more details, see the function's reference page in the WDK. What is the maximum USB transfer size for different Windows versions?See " Maximum size of USB transfers on various operating systems". How should numbers be assigned to multiple interfaces on a composite device?Windows treats USB devices with more than one interface on the first configuration as composite devices.
For additional information about interface numbers, see "Composite USB devices whose interfaces are not sequentially numbered do not work in Windows XP" listed in the Resources section below. Alternate settings for an interface should be assigned as follows for all versions of Windows:
For additional information on alternate settings, see Section 9.6.5 of the USB 2.0 specification. Which parent driver should a USB composite device load?Windows has supported USB composite devices since Windows 98. Usbhub.sys supports composite devices for:
A new driver for composite devices, Usbccgp.sys, was released with Windows Millennium Edition (Me). Usbccgp.sys supports composite devices for:
Although it might still be possible to load Usbhub.sys as the parent driver for the composite device on these versions of Windows, Microsoft does not recommend it. You should instead use Usbccgp.sys. To ensure that you load the correct driver for your composite device, use the Include and Needs directives in your INF files, as follows: Include = USB.INF Important: An INF that refers to Usbhub.sys as the composite device driver might, in the future, fail hardware compatibility testing. If you have a composite device, it should be referring to Usbccgp.sys instead of Usbhub.sys. For additional information, see "USB Generic Parent Driver (Usbccgp.sys)" in the WDK. What are the major restrictions imposed by Usbccgp.sys?The major restrictions imposed on hardware devices and drivers by Usbccgp.sys are:
How do I enable debug tracing for USB core binaries?To enable kernel debugging:
Table 1. Kernel debug settings, Windows 2000
Table 2. Kernel debug settings, Windows XP and Windows Server 2003
For additional information about USB core stack debugging, see "How to enable verbose debug tracing in various drivers and subsystems". What does bugcheck code 0xFE mean on Windows XP and later versions of Windows?See Bug Check 0xFE: BUGCODE_USB_DRIVER. For additional information about USB core stack debugging, see the latest WDK and the documentation included with Debugging Tools for Windows. What features of the EHCI specification are not yet implemented?Windows XP supports a number of features in the Enhanced Host Controller Interface (EHCI) specification, but a few features have not been not implemented, as follows.
These features might be supported in future versions of Windows. Does Windows support Interface Association Descriptors?Yes. The USB 2.0 Interface Association Descriptor (IAD) Engineering Change Notification (ECN) introduced a new standard method for describing a grouping of interfaces and their alternate settings within a function. IAD can be used to identify two or more consecutive interfaces and alternate settings within one function. Microsoft is currently working with IHVs to develop devices that support IAD. The following operating systems have support for IAD:
For additional information on IAD, see "Support for USB Interface Association Descriptor in Windows" in the Resources section below. Does the USB stack handle chained MDLs in a URB?No. This functionality is not supported by the USB stack included with Windows. Can a driver have more than one URB in an IRP?No. This functionality is not supported by the USB stack included with Windows. Does Windows Support USB Composite Hubs?A composite USB device - also referred to as a multifunction USB device - exposes multiple functions, each of which can be treated as an independent device. The system loads the USB generic parent driver, Usbccgp.sys, to serve as the parent driver for eaech of the device's functions. The USB generic parent driver enumerates the composite device's functions as though they were separate USB devices and then creates a PDO and constructs a device stack for each function. A composite USB device cannot expose a function that serves as a hub. Windows does not enumerate such hubs properly and attempting to install the device might cause a system crash. Using a USB 2.0 Connection for Kernel DebuggingUSB 2.0 provides an alternative to serial and 1394 communication links for connecting a debugging host to a target computer. This section of the FAQ answers questions about USB 2.0 kernel debugging. Which versions of Windows support USB 2.0 kernel debugging?USB 2.0 kernel debugging is currently supported by Windows Vista and later versions of Windows. What system support is required for USB 2.0 kernel debugging?USB 2.0 kernel debugging requires the following system support:
Note: Usbview.exe is a utility that is included in Debugging Tools for Windows that allows you to view the USB controllers in a computer as well as what devices are connected to each port of the controller. How do I determine whether an EHCI controller supports kernel debugging?USB controllers that implement a debug port are supposed to report that they support this feature in the PCI configuration space of the controller. Unfortunately, there is no software available at this time that reports this information to the user. All Intel EHCI controllers support USB kernel debugging on PORT1. What if there is more than one EHCI controller in the target computer?If there is more than one EHCI controller in the target computer, you should specify the controller that should be used for kernel debugging. Otherwise, you could have a situation where your USB debug cable is plugged into the debug port connector of one controller when the operating system on the target computer is attempting to use the debug port of a different EHCI controller. Failure to specify the controller to use for kernel debugging when there is more than one EHCI controller in the test computer typically results in USB kernel debugging not working. To specify the EHCI controller to use for kernel debugging, type the following in a command prompt window with elevated privileges on the target computer: bcdedit -set {current} loadoptions busparams=x.y.z The x, y, and z values are computed from the bus, device, and function numbers for the EHCI controller that is to be used for kernel debugging. This information can be obtained from Device Manager as follows:
This will cause the operating system on the target computer to use the EHCI controller at that specific location in the computer for kernel debugging. For example, if the location of the EHCI controller that is to be used for kernel debugging is shown in Device Manager as PCI bus 0, device 29, function 7, then the corresponding bcdedit command would be: bcdedit -set {current} loadoptions busparams=0.1D.7 What cables can be used for USB 2.0 kernel debugging?You must use a specially designed debug device for a USB 2.0 debugging connection. This device allows a standard USB cable to be connected between the host computer and the debug device, and another standard USB cable to be connected between the target computer and the debug device. It is not possible to do USB kernel debugging without this debug device installed between the host and target computers. PLX Technology manufactures a USB debug device called the Net20DC. A link to their Web site is in the Resources section of this FAQ. Compatible devices may be available from other vendors, but Microsoft has not tested any debug devices other than the PLX Net20DC. Where can I obtain the PLX debug device?
http://www.semiconductorstore.com/pages/search/searchinventory.asp?query=net20dc
Which debugging tools support USB 2.0 kernel debugging?You must use an up-to-date version of the Debugging Tools for Windows package (version 6.10.3 or later). The driver that supports USB 2.0 debugging on the host machine, usb2dbg.sys, is installed with the debugging tools. The driver package can be found in the Program Files\Debugging Tools for Windows\Usb folder. The debugger will load the USB debug driver on the host computer when USB kernel debugging is specified. No additional USB debug driver needs to be installed on the target computer, as the necessary support is built into Windows Vista and later versions of Windows. Microsoft Operating System DescriptorsMicrosoft operating system (OS) descriptors provide a way for IHVs to store a variety of vendor-specific information in device firmware. This section of the FAQ answers questions about Microsoft OS descriptors. For more information on Microsoft OS descriptors, see "Microsoft OS Descriptors Documentation". What is a Microsoft OS Descriptor?Microsoft OS descriptors provide a way for IHVs to store a variety of vendor-specific information in device firmware as OS feature descriptors, rather than distributing it to users separately from the device. Versions of Windows or Windows applications that are aware of Microsoft OS descriptors can use control requests to retrieve the descriptors from the device without requiring any user interaction. In particular, Windows can automatically retrieve the descriptors when the device is initially plugged in and use the information to give the user a smoother Plug and Play experience. What types of OS feature descriptors are supported by Windows?Any information to be stored as a feature descriptor must comply with one of the standard formats that Microsoft has defined. Additional feature descriptors cannot be defined or implemented without Microsoft consent. Microsoft has defined the following feature descriptors. Extended Compat ID Extended Properties Genre Which Windows versions support Microsoft OS descriptors?The following table shows which versions of Windows support the various descriptors: Microsoft OS Descriptor Support
Why must the OS string descriptor be stored at index 0xEE?A device that supports Microsoft OS descriptors must contain an OS string descriptor, stored at string index 0xEE. The OS string descriptor is a standard USB string descriptor that serves several purposes:
If there is no string descriptor at 0xEE, or the string descriptor at that index is not a valid OS string descriptor, Windows assumes that the device does not contain any OS feature descriptors. Where can I find more information about Microsoft OS descriptors?See http://msdn.microsoft.com/en-us/windows/hardware/gg463179.aspx. ResourcesThe following resources provide additional information on Windows support for USB devices. Composite USB devices whose interfaces are not sequentially numbered do not work in Windows XP Debugging Tools for Windows How to enable verbose debug tracing in various drivers and subsystems IsDeviceHighSpeed Maximum size of USB transfers on various operating systems Microsoft OS Descriptors Documentation PLX Technology USB Debugging Cable USB resources on WHDC USB 2.0 Specification Windows Hardware Developer Central |