Why does my computer go "New USB device" every time I plug one into a different port?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Meadow
--
Chapters
00:00 Why Does My Computer Go &Quot;New Usb Device&Quot; Every Time I Plug One Into A Different Port?
00:29 Accepted Answer Score 65
02:38 Answer 2 Score 2
03:33 Answer 3 Score 0
05:35 Thank you
--
Full question
https://superuser.com/questions/29021/wh...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #usb
#avk47
ACCEPTED ANSWER
Score 65
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.
ANSWER 2
Score 2
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.
ANSWER 3
Score 0
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.