Overview

Enumeration is the process by which the host discovers and configures a newly attached USB device. It occurs automatically when a device is plugged in and involves reading descriptors, assigning an address, and loading the appropriate driver.


Enumeration Steps

When a device is connected:

1. Device Attachment and Reset

2. Read Device Descriptor (Partial)

3. Assign Unique Address

4. Read Full Device Descriptor

5. Read Configuration Descriptors

6. Select Configuration

7. Driver Loading


Example: USB Keyboard

Descriptor structure:

Device Descriptor
└── Configuration Descriptor
    └── Interface Descriptor (HID)
        ├── HID Descriptor
        └── Endpoint Descriptor (Interrupt IN)
  1. Host detects the HID class (bInterfaceClass = 0x03)
  2. Loads the built-in HID keyboard driver
  3. Driver sets the idle rate and report protocol via class-specific requests

Device States During Enumeration

State Description
Attached Device is physically connected but not yet powered
Powered Hub supplies VBUS to the device
Default Device has been reset; responds on address 0
Address Device has been assigned a unique address
Configured A configuration has been selected; device is operational

Host Software Responsibilities

After reading descriptors, the host:

Tip

The host must handle enumeration failures gracefully — if a device does not respond correctly during any step, the host may retry or disable the port.