This is a mirror of official site: http://jasper-net.blogspot.com/

How to Generate a Container ID for a USB Device

| Tuesday, December 7, 2010
Hi, I’m Kristina Hotz, a Program Manager on the USB team.  In this post, I’ll explain how you can create a container ID for a USB device by using the same mechanism as Windows 7.

You will find the information useful if you are developing a USB driver stack that replaces the Microsoft-provided USB driver stack or if you are a USB device manufacturer and would like to know how your device is recognized by the Windows 7 version of the operating system.

A container ID is an identification string that is generated by the USB driver stack. The string is unique to a physical device. To view all physical devices connected to your computer, from Start, select Devices and Printers. A physical device can expose one or more functional devices. For a single function device, the icon in Devices and Printers represents the physical device and its functional device. If you have a multi-function device (for example, a printer/scanner/fax machine), you will notice an icon that represents the physical device (for example, the printer/scanner/fax machine appears as a printer). That is because Windows uses container IDs to group all functional devices associated with the physical device.

After a USB device is connected to the computer, the USB driver stack (specifically, the bus driver) starts enumerating device nodes (devnode) for each functional device associated with the physical device. The bus driver then assigns a container ID for each devnode. The container ID is a property of a devnode, and is specified through a globally unique identifier (GUID). That GUID is set as a string property on a devnode.  All devnodes originating from a physical device must have the same container ID.  

For an external device’s devnode, the bus driver obtains the container ID by one of the following ways:

·         Reading the Microsoft OS ContainerID descriptor supplied by the device.  For more information, see Using Microsoft OS ContainerID Descriptors.
·         Generating a container ID by hashing certain device information. (See How to Generate a Container ID String)
·         Generating a random GUID for the container ID.
·         Inheriting the container ID of the parent devnode.

Note: Windows uses ACPI to determine whether the physical device is an external device or internal device.  An internal device’s devnode always inherits the container ID of the computer, i.e. its parent devnode.


Read more: Microsoft Windows USB Core Team Blog

Posted via email from .NET Info

0 comments: