
Why doesn't Windows recognize a USB device plugged into another port? (2004) - johnchristopher
http://blogs.msdn.com/b/oldnewthing/archive/2004/11/10/255047.aspx
======
pmontra
The thread is from 2004, it should go into the title.

I've been using Windows XP until January 2009, then I reformatted my laptop
with Ubuntu. One of the first things I noticed was that it instantaneously
recognized pen drives without going through all that found new device dance.
OS X is also fast at mounting USB drives. I just can't understand the
technical reasons that make Windows annoy people with that. Is it still the
same with Windows 8?

~~~
nolok
Win 7/8: the device install process is still there but it's instant, you
wouldn't even know if it weren't for the notification popup in the tray.

My issue on the other hand, is that it keeps asking to "scan and fix errors"
when you plugin thumb drives if you take them out without using "eject" first.

~~~
pmontra
I think that's a good idea. You can lose all the drive by pulling it out
without stopping it first. It happened to me a couple of times. Even if that
scan and fix thing was only a way to scare people into ejecting drives, I
think it's worth it.

~~~
Dylan16807
The entire drive was lost? That's really shameful firmware, even if you
unplugged it mid-write.

Unplugging an idle drive should never lose anything.

But there's a lot of flaky hardware out there.

~~~
justin66
> Unplugging an idle drive should never lose anything.

Users aren't especially great at knowing when their drives are idle. This has
honestly been true since we moved on from loud floppy drives.

~~~
raverbashing
Some have a flashing light to help with it, but I think there are some that
have no led

~~~
justin66
A flashing light tells you when the device is writing or reading. It doesn't
tell you when an important cache on the operating system side has been
completely flushed. Or that the OS will start writing to the device again in a
fraction of a second. Or a dozen other things that are relevant to removing a
storage device on a modern system.

~~~
derekp7
A good UI would be to have the USB's normal state be "ready to pull", and have
the icon in the tray turn red when there is unflushed data in the cache, and
turn green when you can safely pull the drive. That way there is nothing to
remember to click on. Then, in the case where another write starts up just
before you pull the drive, give you the ability to plug the device back in to
let the data flush to it (after the OS check the volume ID of course).

~~~
justin66
> A good UI would be to have the USB's normal state be "ready to pull"

That's completely wrong. If it were workable, that's how these things would
have always been set up. We've got good reasons for not doing things this way.

> have the icon in the tray turn red when there is unflushed data in the cache

There's a lot more to worry about than data in the cache. Open or locked files
are an issue regardless of whether or not the cache is empty.

> turn green when you can safely pull the drive

We have _almost_ got this now, with the icon that indicates whether it's safe
to pull the drive or not. The difference is that you have to unmount the drive
manually to get the friendly "all clear" indication. (a lot of times it won't
really matter if you pull the drive while it's mounted)

You could add a process to automatically unmount the drive, but simultaneously
provide some kind of virtual drive such that applications could seamlessly
remount it and use it. You've then got the possibility that an app will start
using it in the moment between when you look at the screen to verify it is
safe to pull the drive and when you pull the drive. To make THAT error go away
you need to add a request to the user to put the drive back in...

> Then, in the case where another write starts up just before you pull the
> drive, give you the ability to plug the device back in to let the data flush
> to it (after the OS check the volume ID of course).

Of course it's not just writes, there are also reads to be contended with.

Anyway, after seeing a few of the new "Not ready reading drive A Abort, Retry,
Fail?" error messages, people are going to wonder why your new feature is
fucking with them.

~~~
derekp7
I was thinking that at a minimum, have an the indicator be red if the write
cache is dirty or there are open files on the drive. But I see your point,
that in that case green wouldn't really mean that it is safe either. And
having the indicator be green/yellow/read (for unmounted/clean cache, no open
files/open files or dirty cache) might be a bit more confusing.

------
gbl08ma
That, and Windows also seems to create a different network connection profile
for the same wireless adapter, every time I plug it into a different USB port.
I always end up with something like "Local Area Connection 4" just because
that's the fourth different port I've connected it to.

Other operating systems do not seem to suffer from these problems as badly,
and this MSDN post is from 2004 (three major Windows versions, soon four, will
have been released since then), so does anyone know what are the current
roadblocks to getting this behavior changed? As someone else said, these kinds
of annoyances add up (you really notice them better if you frequently use
other OS).

~~~
TazeTSchnitzel
Why would you want the behaviour changed? If the device has no serial number,
acting differently depending on the port is quite important.

~~~
gbl08ma
Unfortunately I don't have two devices with the same ID and no serial number
to test, but assuming Linux et al deal with them correctly, there sure must be
some way? I guess Windows could resort to using the bus/device number
information only when there is no other way of distinguishing between two
devices (serial number, USB PID/VID...).

The impression I get is that when Windows executes the "Found new hardware"
thing, it installs (usually from Windows Update, if the setting is enabled)
the drivers, but it's as if the drivers were installed for that USB port
only... it appears to install the driver again and again as I move the device
to other ports. This is not the way Linux deals with device drivers (once a
driver exists in the kernel or is available as a kernel module, it works
irregardless of the port), and as far as I know on OS X and BSD kernels it's
similar.

~~~
joesmo
Yes. The post might explain why the device is popping up as new, but it
doesn't explain the reinstallation of an already existing, installed driver
that's identical because it was just installed a minute ago when the USB
device was on a different port.

~~~
TazeTSchnitzel
The driver isn't being reinstalled. A second device is being set up.

Remember, due to vendors producing devices which share IDs with different
devices, Windows can't assume that a device on a different port reporting the
same device ID is the same device or works with the same driver.

------
andmarios
Fun story. Once I helped a friend with his Arduino code. I program the Arduino
on his Windows PC and remove it. There were still issues, so we had to program
it once more. “Great” he says, “now we have to reboot”. “Why” I ask and he
replies “these are windows man, they aren't like your linux machine”. In
disbelief I connect the Arduino to the USB port but indeed, Windows fail to
detect it. Trying to be smart, I pull out his usb mouse receiver and swap USB
ports with the Arduino. The PC recognizes it and I feel triumphant. “Now
you've done it” he says, “we have to reboot if we ever expect Windows to
recognize this mouse again, you don't just move things between USB ports in
Windows”.

He still uses Windows to this day, I guess we value different things as
important in our OSes. :)

~~~
pmelendez
Well that's an odd problem and not usual at all (at least not for me and my 4
Windows machines).

However, my main computer in my last job was an Ubuntu machine (A Dell with
hardware linux-friendly components) and the amount of oddities weren't even
funny. (Like having to uninstall your video driver before update to avoid
losing a morning making boot again)

I guess we value different things as important in our OSes.

~~~
andmarios
Well, the problem you describe is an odd problem and not usual at all (at
least not for me and my 4 Linux machines). ;)

~~~
pmelendez
It is not that unusual:

[http://askubuntu.com/questions/477370/ubuntu-14-04-boots-
to-...](http://askubuntu.com/questions/477370/ubuntu-14-04-boots-to-black-
screen-after-upgrade-from-13-10-no-display-proble)

[http://ubuntuforums.org/showthread.php?t=2080918](http://ubuntuforums.org/showthread.php?t=2080918)

[https://bugs.launchpad.net/ubuntu/+source/linux/+bug/399821](https://bugs.launchpad.net/ubuntu/+source/linux/+bug/399821)

We have that problem at the office very frequently, somebody got it first then
lose a morning figuring out a workaround and then that person tells everyone
else.

My point is... this weird things with drivers happens in every OS (OSX
included).

After been working with Windows, OSX and Linux at work in different stages of
my life, my conclusion is that at least for me, any choice of an OS is about
personal taste.

~~~
andmarios
Indeed, there are issues with every OS. I think though, Linux get attacked
most often and usually is because people do not know it as they know Windows.

~~~
pmelendez
Maybe, but at least in my case I have been using Linux exclusively as a
desktop at several jobs for many years and still I found it to be a buggy
experience.

I'm still waiting for the year of linux's desktop. That's not the case with
the server though. I really love the linux's server experience more than
windows and osx. There is one thing that Linux really got it right and it is
the terminal experience.

~~~
andmarios
The Linux desktop has been here for quite a while. If you expect to see high
usage numbers, it's not going to happen. The problem is the entry barrier to a
completely different OS. Most people when sit next to me, admire and are
jealous of the things a Linux desktop can do (as does my friend from the
story), but they can't invest the time needed to learn a new OS; there are
literally hundreds of big and small things they have to forget and re-learn
anew.

This is the funny part too, because for me the same happens with Windows. I
can't invest the time to learn the new Windows (I left at Windows XP). Once I
spent half an hour on Windows 8 trying to find out how I shutdown the machine!
I even opened windows help! Another time I spent as much time on Windows 7
trying to make file extensions visible.

------
raverbashing
". They gave all of their devices serial numbers, that's great, but they all
got the same serial number"

Yes, there are functioning adults that work in technology that don't
understand the concept of a serial number

Source: was very glad of not making 'serial number' of a certain product in a
database the primary key, when repeated serial numbers started to arrive (it
was not our responsibility to generate those numbers)

~~~
jessaustin
ISTM that primary keys should be completely internal to the DB. You can always
add another column with a unique index, if someone lies to you that any
particular datum is unique. Then when dupes roll in like they usually do, you
can just drop the index.

A great frustration of mine in a previous job was that a predecessor had
informed the accounting department of internal keys used for a many-to-many
relation in the configuration of a process that journalled transactions from
the billing system to the accounting system. That meant I could never
reconfigure the janky-ass, inefficient way that journaling was set up, because
the accountants knew how it _should_ be.

------
krig
I have not only this issue with windows, but on my gaming machine, unless I
unplug my Microsoft-made keyboard when booting, the OS blue screens [1]. Of
course if I then don't plug it back into the same USB port as before, it will
reinstall the drivers...

(I also find it amusing that this happens with devices made by Microsoft
themselves; you'd think they would make sure it worked, wouldn't you)

[1]:
[http://www.hanselman.com/blog/FIXEDBlueScreenOfDeathBSOD7EIn...](http://www.hanselman.com/blog/FIXEDBlueScreenOfDeathBSOD7EInHIDCLASSSYSWhileInstallingWindows7.aspx)

~~~
UnoriginalGuy
You may wish to enable kernel dumps, reproduce the BSoD, then install
Debugging Tools for Windows. Now spin up WinDbg and inspect the kernel dump to
see what is really causing this.

Looks like a corrupt Windows install to me, but you'll know more after WinDbg.
Scandisk (with fix bad sectors) and the Windows memory checker might also
reveal how the OS became damaged.

~~~
krig
I could do all that. Or, I can unplug the keyboard while booting. :)

~~~
keithpeter
Each time you boot...

...I'd find that so _annoying_ I'd be trying to find the root cause using the
information in post above yours. Each to his/her own.

~~~
Dylan16807
Some people reboot a lot more than others, too. Daily vs. every other month.

------
SG-
Small things like this is what starts bothering me about Windows (they add
up). The 'Found New Hardware' wizard will also come up each time you plug it
in a different USB port (along with the annoyances that comes with).

~~~
LoSboccacc
and (until recentest version of windows) you will get a copy of the same
printer according to each usb port, with all the others showing up as
disconnected.

~~~
SG-
Yes along with USB network adapters (you lose whatever settings you set). Just
a pain and not what anyone would actually want.

------
zx2c4
Nugget of wisdom from the comments:

"Device manager hides devices that are no longer connected, even when "Show
hidden devices" is on. The workaround is to set an environment variable
DEVMGR_SHOW_NONPRESENT_DEVICES but this is one of those tips thats not widely
know and it can get frustrating trying to fix problems."

~~~
stephengillie
Win7/8 actually stop installing a device driver when the device is removed.
This is especially frustrating when you've got an intermittent connection on a
USB device; Windows begins device discovery, then aborts, begins again,
aborts.

------
Aardwolf
Give it any explanation you want, in Linux I can plug in 3 mice in 3 different
USB ports and they all work immediately without any "recognising and
configuring", so it should be technically possible for Windows to also have it
work immediately.

~~~
smilekzs
Have you actually _tried_ plugging them when running Windows? They might
actually do okay.

------
mclemme
On a related note, I got weird behaviour once I switched to an SSD on my Win7
gaming machine, now it boots so fast into the logon screen that the keyboard
doesn't work until 2-5 seconds after the logon screen appears.

I'm wondering if it has something to do with the OS not recognizing my
keyboard, although I always have it plugged into the same USB port.

~~~
vetinari
I'm using laptop with external keyboard and mouse, connected via hub.

After waking up the laptop from the sleep, the keyboard does not work for a
few seconds (so no entering password at the lock screen). The mouse does work,
though.

------
joosters
Interesting comment in the discussion after the article: Chips with unique
serial numbers cost $0.76 per 1000:

[http://www.maximintegrated.com/en/products/digital/memory-
pr...](http://www.maximintegrated.com/en/products/digital/memory-
products/DS2401.html/tb_tab0)

I never realised they could be so cheap (and in bulk, much cheaper). At those
kind of prices, every device could have a unique ID.

~~~
yitchelle
Looking from the OEM's perspective, if they didn't need to add the Maxim part
to BOM, it gives them a better profit margin. If the OEM manufactures
1,000,000 USB devices, that could result in a extra profit of $760, (Based on
the back of envelope calculations).

Edit: Corrected the maths, thanks Syi.

~~~
Syi
You've added a few too many 0's to that, the savings for 1,000,000 USB devices
would only be $760 which would definitely be worth it for customer
satisfaction.

~~~
yitchelle
You are right! I think I will blame it on Friday-itis.

------
linker3000
...closely followed by "why after 3 days of on/off trying can't I get my
bluetooth headset working under Windows 8.1"

/Got it working once, for an afternoon.

------
tripzilch
So it's because some USB devices might report the same ID and Windows doesn't
want to accidentally confuse one for the other, right?

What would actually need to happen for this to go wrong? You'd need two
different USB devices, that are not only cheap/bad (using a non-unique ID),
but they'd have to just happen to actually _share_ the ID as well.

Isn't that a rather unlikely thing to happen? Unless many devices report a
very common ID such as 0, or something.

Then, I'd have to unplug one device, and plug in the other into a different
port, and what would happen is the OS would try and "talk" to the device using
the wrong driver, yes?

But, given that Windows doesn't go through the whole "installing new device"
spiel if you plug the _same_ device again into the _same_ port ... what if I
would unplug that device, and then plug the _other_ device (that reports the
same ID as the first) into that _same_ USB port. Then Windows would still get
confused right? So the problem isn't even really solved, at all. It just makes
it slightly less likely to happen (by a factor of your number of free USB
ports).

Okay so that is one thing. But then, from what I read in this thread, I get
the idea that Linux in fact _does_ consider devices with the same ID to be the
same device, regardless of port (correct?). So, in Linux you'd run into this
problem? Has anyone ever actually experienced it? Because I certainly haven't.

And then there's the part that, if the problem occurs, you'll figure it out
real quick, because it only happens right after you plug in this new USB toy
that you recently bought, on the cheap. That's not too bad, is it? I bought a
€1.50 USB-hub a while back, noticed my keyboard and mouse started acting
glitchy, didn't take a second to figure out it was probably that cheap thing,
and threw it out.

------
mdip
I noticed this behavior in early versions of the Windows 20xx family, but I
found a consistency to it that wasn't mentioned in the article and now I'm
left wondering if I was completely wrong in my assumption.

In my case any USB version 2 device would be detected as "new" if it was
plugged into any port other than the one it was first plugged into, however,
all of my version 1 devices would work without Windows "forgetting about them"
when they were plugged into another port.

Does anyone have any insight on this? Did manufacturers supply a serial number
more consistently with early version devices or was it just my (somewhat
massive) collection of those devices that was at fault?

------
Dylan16807
Of course this isn't the only way it could have been done. Settings could have
optimistically traveled from port to port until the system saw two at once of
the same device with either no serial number or the same serial number.

------
agumonkey
Sometimes linux usb stack is stateful too. I have some ghost /dev/sd* nodes
hanging. Also some embedded devices usb chipset is bogus, causing duplicate
descriptors and duplicate devices (one being DOA).

------
kabdib
Many USB devices over time also starts to fill the registry with . . . stuff,
leading to more slowness and instability as the system ages. WTF.

I found out that for a few years I sat next to the guy largely responsible for
this behavior. I had no idea. Not that I wanted to slug him, but, but . . .
argh :-)

------
chinathrow
Wow, I wonder if that still is a thing?

~~~
chrisan
I had the unfortunate experience where my Win7 would not recognize ANY new usb
device. I had my keyboard, mouse, and n52 from years of use. I could freely
swap them to all of my usb ports and they would still work. However the moment
I tried any NEW usb device (like a new mouse or game pad) it would never
recognize it. The devices worked on other Win7 computers and my Mac.

I have never been more stumped and ended up reformatting (which I had been
wanting to do anyways to move to a 1TB ssd)

~~~
mdip
I've seen this behavior from time to time.

The fix for it was pretty awful, as well. Under "System Devices", I'd locate
the parts of the chipset associated with USB and PCI, find the driver the OS
was referencing and remove the files associated with that driver from wherever
in the OS they were being grabbed[1]. Then I'd download the chipset drivers
from the chipset (not motherboard) manufacturer and install those. The problem
always went away after that step, but often took several reboots to get
everything exactly right for the new drivers.

It seemed to happen most commonly in Windows XP with motherboards that were
Intel based and had USB 2 controllers with third-party (I want to say
Realtek[2]) USB 3 controllers. At the time, Intel had no chipset that included
a USB 3 controller so motherboard manufacturers would use a non-Intel
controller for the USB 3 ports and the Intel controller for the USB 2 ports.

It's possible my problems were simply an artifact of working with USB 3
devices that were bleeding edge and not implemented exactly right, but in all
cases replacing the chipset drivers with the ones provided by the chipset
folks did the trick. Doing the same with the ones provided by the motherboard
manufacturer (often ASUS for me) would result in the same behavior.

[1] The best way to do this, I've found, is to remove the files associated
with the broken drivers and reboot. Once they came up as "Unknown Devices",
I'd proceed with the installation of the drivers I grabbed from
Intel/Whomever. If the device was detected properly -- in the case of this
specific problem -- the new driver would be skipped in favor of the one
provided by the motherboard or the Windows installation.

[2] I may not have this right. I tend to jump to Realtek when I think about
devices I've had terrible experiences with. Their network adapters that seem
to be included on a lot of lower quality motherboards have given me so many
problems that I no longer purchase boards with them installed and if I have no
other choice, I'll buy an Ethernet adapter from someone else and use up one of
my PCIx slots just to avoid their drivers.

------
valisystem
I don't see why this could not have been done in a invisible fashion for the
user.

------
Learn2win
Not just windows; it acts that way on my Mac as well

------
Jgrubb
Ha, I forgot about that. It was a hundred (thousand?) little things like that
that ran me into Mac's loving arms seven years ago.

~~~
edoloughlin
I'm sure these little niggles accumulate easily when your devs never have the
equivalent of the "Steve's gonna kill/fire/humiliate me if my code ever
inconveniences him" thought at the back of their minds.

~~~
Jgrubb
And god bless him for that.

------
noja
Why does Linux?

------
kristopolous
This is an MS site? Honestly, I'm liking this no-bullshit thing MS has been
doing lately.

~~~
sveiss
Raymond Chen's blog in particular has been well worth reading for insight into
why MS has made some of the crazy-seeming technical decisions it has for well
over a decade now.

A lot of them boil down to "incredible contortions to support applications
written years ago to which the source code, and probably the original
developers, are no longer available."

