USB Enumeration Explained

Introduction

This article explains the USB Enumeration process as seen by USBTrace. For a more general explanation see USB Complete : Enumeration. USBTrace is a software only USB Protocol Analyzer which can be used to debug the entire enumeration process. Unlike some other software analyzers USBTrace does not use any filter drivers to capture USB bus activity. The limitation with using a filter driver is that you cannot start logging until the driver for the device is loaded. So such monitoring software will miss the USB requests exchanged between the host and the device before the driver for the device is loaded.

How to setup USBTrace to monitor enumeration ?

After starting USBTrace, click the Capture Hot Plugged Devices menu or toolbar button and start capture. Plug in the device and USBTrace will start capturing all requests exchanged between host and the newly plugged in device. Click Stop Capture to end the capture session.

Enumeration Log Walkthrough

The enumeration process can be divided into 2 phases: Phase #1, where the host learns about the newly arrived device by reading the descriptors and loads the appropriate device driver & Phase #2, where the device driver configures the device and makes it ready for data transfer.

Fig Phase #1

As shown above, in the first phase the host learns about the device by reading its device, configuration and string descriptors. With USBTrace, detailed information regarding each of these requests can be obtained.

Fig Phase #2

The second phase starts with the loaded driver of the device getting an IRP_MN_START_DEVICE PNP IRP. After this, the driver reads the device, configuration and string descriptors and configures the device by selecting a configuration. The device is now ready for data transfer.

If you want to see the requests exchanged between the host and the hub during phase #1 of device enumeration, check the hub (root hub or external hub) to which the device is plugged in before starting capture. This includes the host reading the port status and resetting the port.

Related Links

1. Handling the IRP_MN_START_DEVICE PnP IRP
2. USB Complete: Enumeration
3. USB in a Nutshell: Enumeration