Device enumeration is the process by which an operating system discovers the hardware attached to each bus, reads every device’s identity and resource needs, assigns resources and loads a matching driver. In the field of drivers & devices, it is the step that turns an unknown electrical connection into a named, usable device in the operating system.
Enumeration runs at boot and again whenever hardware changes, for example when a USB stick is plugged in or a Thunderbolt dock is connected. It is the foundation of plug and play: without it, administrators would still configure interrupt lines and I/O addresses by hand, as they did with ISA expansion cards.
How device enumeration works step by step
Enumeration follows a tree-shaped walk of the hardware. The kernel starts at a root bus, asks each bus driver which children are present, and repeats the process for every child that is itself a bus or hub. The result is a device tree in memory that mirrors the physical topology.
For each device found, the bus driver performs a similar sequence of steps, which the table below summarizes.
| Stage | What the system does | Result |
|---|---|---|
| Detection | Bus driver notices a device by probing or by a hot-plug signal | Presence is known |
| Identification | Reads vendor ID, device ID, class and revision | Device identity |
| Resource assignment | Allocates address ranges, interrupts and bus numbers | Device can be accessed |
| Driver matching | Compares IDs with driver match tables or INF files | Best driver selected |
| Driver binding | Loads the driver and calls its probe or start routine | Device is operational |
| Publication | Creates device nodes and notifies user space | Applications can use it |
Matching usually prefers the most specific identifier. A driver that names an exact vendor and device pair wins over a generic class driver, such as the standard USB mass storage driver, which serves any device that reports the matching class code.
Enumeration on the main hardware buses
Each bus defines its own discovery protocol, so enumeration differs considerably between PCI Express, USB and on-chip buses. The operating system hides these differences behind bus drivers that report children in a uniform way.
| Bus | How devices are discovered | Identity source | Hot-plug support |
|---|---|---|---|
| PCI and PCI Express | Reads configuration space of each bus, device and function | Vendor and device ID registers | Yes, with hot-plug capable slots |
| USB | Hub reports port change, host assigns an address and reads descriptors | Device and interface descriptors | Yes, by design |
| ACPI platform devices | Firmware tables describe built-in devices | Hardware IDs such as ACPI0003 | Limited |
| Device tree (ARM, RISC-V) | Boot loader passes a static hardware description | Compatible strings | Mostly no |
| I2C and SPI | Usually declared in firmware, rarely probed | Firmware description | No |
On PCI Express, the kernel reads a vendor ID at each possible address; a value of 0xFFFF means no function is present. It then sizes each base address register (BAR) by writing all ones and reading back the mask, which reveals how much memory-mapped I/O space the device needs.
On USB, a new device starts at address 0. The host controller resets the port, reads the first eight bytes of the device descriptor to learn the maximum packet size, assigns a unique address from 1 to 127, and then reads the full descriptors and selects a configuration.
Device enumeration in Windows, Linux and macOS
All three major desktop systems follow the same principles, but they name the components differently and store the results in different places.
| System | Coordinating component | Driver matching | Visible result |
|---|---|---|---|
| Windows | Plug and Play manager | Hardware IDs and compatible IDs in INF files | Device Manager, device instance paths |
| Linux | Driver core with bus drivers | ID tables and modalias strings | sysfs tree, udev events, /dev nodes |
| macOS | I/O Kit registry | Matching dictionaries in driver bundles | IORegistry, visible with ioreg |
In Windows, bus drivers report children to the Plug and Play manager, which builds device nodes and the driver stack, including any filter drivers. In Linux, the kernel emits uevents after enumeration, and the udev daemon creates device files, sets permissions and loads modules by alias.
Boot-time and runtime enumeration
Enumeration happens in two distinct phases. Firmware performs an initial pass to find a boot device, and the operating system performs a full pass during startup, then continues to handle hot-plug events at runtime.
- Firmware enumeration: UEFI or BIOS scans PCI buses and USB ports to find keyboards, displays and boot disks, often assigning initial resources.
- Kernel enumeration: the operating system rescans, may reassign resources, and binds its own drivers instead of firmware services.
- Runtime enumeration: hot-plug interrupts trigger a partial rescan of the affected branch only, which keeps the rest of the tree stable.
- Surprise removal: when a device disappears without warning, the bus driver reports it missing and the stack must tear down safely.
Boot time depends heavily on enumeration. Modern kernels probe devices in parallel and defer slow ones, because a single unresponsive USB device or a long PCIe link training delay can otherwise hold up the entire startup sequence.
Common enumeration failures and their causes
Most problems that users describe as a device not recognized are enumeration failures, and the stage at which enumeration stops points to the cause.
| Symptom | Likely cause | Typical fix |
|---|---|---|
| Device descriptor request failed | Faulty cable, weak power or bad firmware | Different port or cable, powered hub |
| Unknown device with valid IDs | No matching driver installed | Install the vendor or class driver |
| Resource conflict or code 12 | Not enough address space or interrupts | Firmware update, disable unused devices |
| Device appears and disappears | Unstable link or power saving | Disable selective suspend, check power |
| Missing after resume | Device fails to re-enumerate | Driver update or port reset |
Enumeration is also a security boundary. A malicious USB device can claim to be a keyboard and type commands, and external PCIe devices can attempt direct memory access, which is why systems combine enumeration with IOMMU protection and device authorization policies.
Explained without jargon
Imagine a new employee arriving at an office. Reception asks for a name and job title. It gives the person a desk and a phone number. Then it introduces the right manager.
Device enumeration does the same for hardware. The computer notices something new. It asks what it is. It gives it the resources it needs. Then it finds the right driver to work with it.
This is why a mouse works seconds after you plug it in. The whole introduction happens automatically, every time the computer starts and every time something is connected.
A typical use case
A support technician connects a Thunderbolt docking station to a laptop. The dock contains a PCIe switch, a USB hub, an Ethernet controller and an audio chip. Within about two seconds, the operating system enumerates the new branch of the tree: it assigns bus numbers and memory windows to the PCIe switch, reads the IDs of the Ethernet controller, and walks the USB hub to find the keyboard and webcam attached behind it.
One device, the webcam, shows up as an unknown device with a descriptor error. The technician moves it to a powered port on the dock, the host resets the port, and enumeration completes with the generic video class driver. The result is every dock peripheral working without a reboot or manual configuration.