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

48

8

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?

RCIX

Posted 2009-08-24T20:57:11.470

Reputation: 5 415

3And what can we do to fix it? – Colonel Panic – 2013-05-22T11:02:16.733

Answers

62

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.

jasonh

Posted 2009-08-24T20:57:11.470

Reputation: 2 967

1I'll take a wild guess that it's just associating existing drivers with the new port designation. – Brian White – 2014-10-01T17:26:26.710

1@BrianWhite it goes through the whole download and configuration process. You can watch it by clicking on the notification in the task bar – Cool Blue – 2015-04-07T04:40:01.297

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. – Brian White – 2015-04-08T00:46:29.860

Is there anyway to give a USB device a serial number yourself? Or is that something that can only be done on the manufacturing level? – TMH – 2015-10-12T09:42:01.207

@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 – Shirish Herwade – 2016-10-25T10:55:02.733

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? – Agnel Kurian – 2011-04-07T06:18:31.510

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.

David Spillett

Posted 2009-08-24T20:57:11.470

Reputation: 22 424

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. – jasonh – 2009-08-24T21:25:11.697

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. – RBerteig – 2009-08-25T06:00:54.593