Let's say I have a mouse. I plug this mouse into slot 1 out of 4 on a computer. It goes through the new device detected and all of that, which is fine. But if I come back later with the same mouse and plug it into say slot 3, it does the detecting all over again! Why is this?
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.
17One thing I fail to understand is why it needs to reinstall device drivers all over again. Is it gonna maintain separate copies of drivers for the same device on each port now? Apr 7, 2011 at 6:18
1I'll take a wild guess that it's just associating existing drivers with the new port designation. Oct 1, 2014 at 17:26
2@BrianWhite it goes through the whole download and configuration process. You can watch it by clicking on the notification in the task bar Apr 7, 2015 at 4:40
1Oh, I've watched it many times. It's difficult to tell from that dialog, though, if it's actually fetching new data from the Internet or just using local files (but common dialog text) or something in between. Apr 8, 2015 at 0:46
1@BrianWhite in my case(Windows 7) definitely it fetches new data from Internet, because it completes properly only when my laptop is connected to internet Oct 25, 2016 at 10:55
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.
4Close, but not quite. Windows recognizes the same device across different ports, as long as it can track that exact device. To do that, the device has to provide a serial number.– jasonhAug 24, 2009 at 21:25
4Disks tend to actually have a serial number, its on the media itself and put there by format. Even the really cheap keyfob drive thingies are among the best behaved of all USB devices because of this. Mice, keyboards, joysticks, and other cheap devices tend to be the worst offenders. A real annoyance is a USB to RS-232 serial adapter without a serial number. It will get assigned to a new COM port name each time it is accidentally moved to a new port. Not fun.– RBerteigAug 25, 2009 at 6:00
It doesn't do this if the device has a serial number. But why do Windows drivers assign child devices with different instance IDs when they appear on different ports such that when you plug a USB device in on another port, there isn't a registry key for the instance ID, triggering drivers to be reinstalled?
Imagine 2 identical devices were given the same ID on 2 different ports; they'd both use the same registry key, which shouldn't be a problem if the device has identical PID and VID because it's not like they're going to have different drivers, device classes, capabilities. I guess it's possible that they could, and there's no point in relying on that. It's desirable for each device to have its own registry key and DIID (Device Instance ID), and not share them. You may want to change the capabilities value on a device by device basis.
There are settings on group policy to ban certain DIIDs, which bans the device model from being plugged into certain ports. If it had the same DIID everywhere, you would ban the model on all ports.
Also, don't forget ParentIDPrefix. Each USB drive has a ParentIDPrefix that identifies the USBSTOR\ child and hence identifies the volume label in MountedDevices because it is in the data next to the value. If 2 USB drives share the same registry key then it breaks any software that relies on the ParentIDPrefix value. If Windows didn't provide unique instance IDs per port then the 2 USBs would also share the same USBSTOR\ DIID, and partmgr almost certainly uses the name of this key as the disk signature for the volume, and the same disk ID GUID subkey will be used, and this would create an undefined situation for mount manager because it won't see 2 volumes with the same signature but 1 volume asking for a volume letter for a second time but it's actually another volume, this could result in dangerous and undefined behaviour. Windows 7 doesn't support multiple volumes on a USB drive so it uses the DIID instead off a MBR signature and offset.