Why does my computer go "New USB device" every time I plug one into a different port?

According to Raymond Chen:

Why does Windows not recognize my USB device as the same device if I plug it into a different port?

You may have noticed that if you take a USB device and plug it into your computer, Windows recognizes it and configures it. Then if you unplug it and replug it into a different USB port, Windows gets a bout of amnesia and thinks that it's a completely different device instead of using the settings that applied when you plugged it in last time. Why is that?

The USB device people explained that this happens when the device lacks a USB serial number.

Serial numbers are optional on USB devices. If the device has one, then Windows recognizes the device no matter which USB port you plug it into. But if it doesn't have a serial number, then Windows treats each appearance on a different USB port as if it were a new device.

(I remember that one major manufacturer of USB devices didn't quite understand how serial numbers worked. They gave all of their devices serial numbers, that's great, but they all got the same serial number. Exciting things happened if you plugged two of their devices into a computer at the same time.)

But why does Windows treat it as a different device if it lacks a serial number and shows up on a different port? Why can't it just say, "Oh, there you are, over there on another port."

Because that creates random behavior once you plug in two such devices. Depending on the order in which the devices get enumerated by Plug and Play, the two sets of settings would get assigned seemingly randomly at each boot. Today the settings match up one way, but tomorrow when the devices are enumerated in the other order, the settings are swapped. (You get similarly baffling behavior if you plug in the devices in different order.)

In other words: Things suck because (1) things were already in bad shape—this would not have been a problem if the device had a proper serial number—and (2) once you're in this bad state, the alternative sucks more. The USB stack is just trying to make the best of a bad situation without making it any worse.


Windows (as you don't state you OS I assume this is what you are using) associates a device with the port it is plugged into, so it considered "USB DISK A in port X" to be different from "USB DISK A in port Y" and it links up the drivers and registry entries accordingly.

If you use the "show unattached devices" option when viewing Device Manager, you will see the device attached to all the ports it has ever been plugged into but greyed out as it isn't currently in them. When you plug the device into one of these ports Windows will just activate that driver instance, when you plug it into another port it will need to define a new driver instance for that port before activating it (which is the process you see as a user displayed as "adding new device".

This allows you to have to identical devices plugged into different ports working at the same time. There are other ways to achieve this, with little or no practical difference to the end user which technique the OS uses, but that is how Windows chooses to arrange it.

Tags:

Windows

Usb