Plug and play

Also known as: PnP

On this page 7

Plug and play (PnP) is the set of hardware and operating system mechanisms that let a computer detect a device, assign its resources and load a suitable driver automatically, without jumpers, manual configuration or a restart. In drivers & devices, PnP covers the whole life cycle of a device, from discovery and enumeration through configuration to safe removal.

The concept became mainstream with Windows 95 and the ISA Plug and Play specification, and it now rests on self-describing buses such as PCI Express, USB and Thunderbolt, on firmware tables provided by ACPI or a device tree, and on a PnP manager inside the kernel that coordinates drivers.

How plug and play configures a new device

Plug and play works because every compliant device can identify itself in a standard way. When a device appears, the bus driver reads its identifiers, the operating system matches them against installed driver packages, and the kernel allocates the resources the device needs before starting it.

The process follows a predictable sequence that is similar across Windows, Linux and macOS, even though the internal components carry different names.

StageResponsible componentResult
DetectionBus controller and bus driverA connection or hot-plug event is noticed
EnumerationBus driverVendor, device and class identifiers are read
Driver matchingPnP manager or device managerThe best matching driver is selected
Resource assignmentKernel and firmwareMemory ranges, interrupts and DMA access are allocated
Driver startFunction driverDevice is initialized and exposed to applications
NotificationUser-space servicesApplications and the desktop learn about the new device
Stages of plug and play device setup

On Windows, the PnP manager builds a device tree of device nodes and loads the driver stack for each node. On Linux, the kernel creates a device entry and sends a uevent, and the udev or systemd-udevd service creates device files and applies rules. On macOS, the I/O Kit performs driver matching through personality dictionaries.

Identifiers and resources behind plug and play

Driver matching relies on hardware identifiers stored in the device itself. These identifiers range from very specific, naming one product revision, to generic class codes that allow a standard class driver to take over.

The table below lists the identifiers that the main buses provide for plug and play.

Bus or sourceIdentifierUsed for
PCI ExpressVendor ID, device ID, subsystem ID, class codeExact or class-based driver matching
USBVendor ID, product ID, device and interface classSpecific drivers or generic class drivers
ACPIHardware ID and compatible ID stringsPlatform devices built into the motherboard
Device treeCompatible property stringsDevices on embedded and ARM systems
BluetoothProfiles and service UUIDsSelecting the right profile driver
Device identification on common buses

Once the device is identified, the system assigns its hardware resources. Modern PCI Express devices request memory windows through base address registers and usually use message signaled interrupts, which removes the interrupt conflicts that plagued legacy ISA cards.

Hot plugging, power and removal

Plug and play also covers devices that appear or disappear while the system runs. Hot plugging requires electrical support from the bus, notification from the controller and drivers that can release resources cleanly when the device leaves.

The PnP manager works closely with power management. A device can be suspended, resumed or stopped for resource rebalancing, and the driver must handle each of these transitions without losing data.

  • Surprise removal happens when a user unplugs a device without warning, so drivers must fail outstanding requests safely.
  • Orderly removal through an eject command lets the system flush caches and close handles first.
  • Resource rebalancing may temporarily stop a device so that resources can be reassigned for a new one.
  • Wake events allow a device such as a keyboard or network adapter to resume a sleeping system.

Plug and play is often confused with hot plugging and with driver installation, but it is broader than both. The following comparison shows how PnP relates to older and neighboring approaches.

ApproachHow configuration happensTypical era or setting
Manual configurationJumpers, DIP switches and driver settings chosen by the userLegacy ISA hardware
Plug and playAutomatic identification, resource assignment and driver loadingAll modern desktop systems
Hot pluggingElectrical ability to connect and disconnect while poweredUSB, Thunderbolt, hot-swap drive bays
Static device treeFirmware describes fixed devices that cannot enumerate themselvesEmbedded and ARM boards
Universal Plug and PlayNetwork protocol for discovering devices and servicesHome networks, unrelated to drivers
Plug and play and related concepts

Despite its name, Universal Plug and Play (UPnP) is a networking protocol family, not a driver model. It shares the idea of automatic discovery, but it has nothing to do with resource assignment inside a single computer.

Common problems and how to resolve them

Plug and play reduces configuration effort, but it does not eliminate driver problems. Most failures come from missing drivers, wrong matches, firmware errors or security policies that block a device.

SymptomLikely causeTypical fix
Unknown device in the device listNo driver matches the hardware identifierInstall the vendor driver package
Device works with limited featuresGeneric class driver loaded instead of a specific oneInstall the specific driver
Device not detected at allFaulty cable, port or disabled controllerCheck firmware settings and hardware
Device blocked by policyDevice installation restrictions or security rulesApprove the device through administration tools
Plug and play troubleshooting

Automatic device acceptance is also an attack surface. Malicious USB devices can pose as keyboards, and external PCI Express devices could use DMA, which is why modern systems combine PnP with the IOMMU, kernel DMA protection and device control policies.

In simple terms

Plug and play is what happens when you connect a mouse, a printer or a USB stick and it simply starts working. The computer recognizes the device by its built-in identity, finds the right software for it and sets everything up in the background.

Before plug and play, people often had to set small switches on expansion cards and type technical numbers into setup programs. Today the operating system handles that work, and the user only needs to connect the device.

A practical example

An office technician connects a new USB-C docking station to a company laptop running Windows. Within a few seconds, the PnP manager enumerates six new devices behind the dock: a USB hub, an Ethernet adapter, an audio interface, two display outputs and a card reader. Generic class drivers start the hub, audio and card reader at once, and the operating system downloads a specific driver for the Ethernet chip from the update service.

When the employee later unplugs the dock without ejecting it, the drivers handle the surprise removal and the laptop switches back to Wi-Fi and its internal screen. One card reader remains listed as an unknown device on a few older laptops, and the technician resolves it by approving the vendor driver package, so the whole rollout requires no manual configuration of resources.