hn-classics/_stories/2004/9783382.md

60 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
created_at: '2015-06-26T10:31:56.000Z'
title: Why doesn't Windows recognize a USB device plugged into another port? (2004)
url: http://blogs.msdn.com/b/oldnewthing/archive/2004/11/10/255047.aspx
author: johnchristopher
points: 131
story_text:
comment_text:
num_comments: 152
story_id:
story_title:
story_url:
parent_id:
created_at_i: 1435314716
_tags:
- story
- author_johnchristopher
- story_9783382
objectID: '9783382'
year: 2004
---
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.