How Windows 98 Handled USB Hot-Swapping Events

Microsoft Windows 98 introduced comprehensive consumer support for the Universal Serial Bus (USB), utilizing a newly integrated Windows Driver Model (WDM) and an enhanced Plug and Play (PnP) architecture. When a hot-swappable USB device was connected, the operating system coordinated physical bus detection, driver stack enumeration, kernel-level device tree updates, and user-space event broadcasts to dynamically configure the hardware without requiring a system reboot.

Physical Detection at the Hardware Layer

The hot-swap process began at the electrical layer. When a user connected a USB device to a port, pull-up resistors on the device's data lines (\(D+\) or \(D-\)) signaled whether it was a full-speed or low-speed peripheral. The downstream port on the host controller or hub detected this change in voltage.

The USB Host Controller hardware—operating on either the Universal Host Controller Interface (UHCI) or Open Host Controller Interface (OHCI) standard—generated an interrupt to alert the host system. The host controller driver (UHCD.SYS or OHCI.SYS) received this interrupt and identified which downstream port experienced a state change.

Hub Driver Enumeration and Descriptors

Once the host controller driver acknowledged the interrupt, it passed control to the USB hub driver (USBHUB.SYS). The hub driver managed the enumeration process through the following sequence:

  1. Port Reset: The hub issued a reset signal to the specific port to put the connected peripheral into its default state.
  2. Address Assignment: The device initially listened on default USB address 0. The hub assigned it a unique bus address between 1 and 127 using a SET_ADDRESS control request via Endpoint 0.
  3. Descriptor Retrieval: The hub driver queried the device for its Device Descriptor, which contained critical metadata including the Vendor ID (VID), Product ID (PID), device class, and supported interfaces.

Kernel-Level Plug and Play Coordination

After compiling the hardware descriptors, the USB bus driver notified the Windows 98 Configuration Manager (the core of the Plug and Play subsystem).

The USB stack utilized I/O Request Packets (IRPs) to communicate state changes to the kernel:

  • The hub driver reported a change in the device topology by invalidating the device relations (IRP_MN_QUERY_DEVICE_RELATIONS).
  • The PnP Manager then sent queries to the hub driver to retrieve the hardware IDs and compatible IDs derived from the device's VID, PID, and revision numbers.
  • The Configuration Manager verified these identifiers against the Windows Registry under HKEY_LOCAL_MACHINE\Enum\USB.

If a matching driver had previously been installed, the system immediately loaded the appropriate function driver (such as HIDCLASS.SYS for input devices or USBMOUSE.SYS). If the peripheral was recognized for the first time, Windows 98 launched the "New Hardware Found" wizard to prompt for INF files and locate the required drivers.

Driver Stack Attachment and Device Activation

Once the Configuration Manager matched the hardware ID to an INF file, it built the devnode (device node) in the system's hardware tree:

  1. The PnP Manager created a Functional Device Object (FDO) and attached it on top of the Physical Device Object (PDO) generated by the USB bus driver.
  2. The system issued an IRP_MN_START_DEVICE request down the driver stack.
  3. The newly loaded driver initialized the device endpoints, allocated required system resources, and configured power states via the Advanced Power Management (APM) or Advanced Configuration and Power Interface (ACPI) subsystems.

User-Mode Notification

To alert running software and shell components, the system broadcast the standard Win32 window message WM_DEVICECHANGE to all top-level application windows.

When the device successfully initialized, the message carried the DBT_DEVICEARRIVAL event parameter along with a DEV_BROADCAST_HDR structure identifying the device type and path. This allowed user-mode components—such as Windows Explorer, system tray utilities, and multimedia applications—to immediately interact with the newly mounted peripheral.