Device enumeration

On this page 7

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.

StageWhat the system doesResult
DetectionBus driver notices a device by probing or by a hot-plug signalPresence is known
IdentificationReads vendor ID, device ID, class and revisionDevice identity
Resource assignmentAllocates address ranges, interrupts and bus numbersDevice can be accessed
Driver matchingCompares IDs with driver match tables or INF filesBest driver selected
Driver bindingLoads the driver and calls its probe or start routineDevice is operational
PublicationCreates device nodes and notifies user spaceApplications can use it
Generic stages of enumerating one device

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.

BusHow devices are discoveredIdentity sourceHot-plug support
PCI and PCI ExpressReads configuration space of each bus, device and functionVendor and device ID registersYes, with hot-plug capable slots
USBHub reports port change, host assigns an address and reads descriptorsDevice and interface descriptorsYes, by design
ACPI platform devicesFirmware tables describe built-in devicesHardware IDs such as ACPI0003Limited
Device tree (ARM, RISC-V)Boot loader passes a static hardware descriptionCompatible stringsMostly no
I2C and SPIUsually declared in firmware, rarely probedFirmware descriptionNo
Enumeration mechanisms by bus type

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.

SystemCoordinating componentDriver matchingVisible result
WindowsPlug and Play managerHardware IDs and compatible IDs in INF filesDevice Manager, device instance paths
LinuxDriver core with bus driversID tables and modalias stringssysfs tree, udev events, /dev nodes
macOSI/O Kit registryMatching dictionaries in driver bundlesIORegistry, visible with ioreg
Enumeration components in desktop operating systems

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.

SymptomLikely causeTypical fix
Device descriptor request failedFaulty cable, weak power or bad firmwareDifferent port or cable, powered hub
Unknown device with valid IDsNo matching driver installedInstall the vendor or class driver
Resource conflict or code 12Not enough address space or interruptsFirmware update, disable unused devices
Device appears and disappearsUnstable link or power savingDisable selective suspend, check power
Missing after resumeDevice fails to re-enumerateDriver update or port reset
Symptoms, causes and fixes

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.