yachli
驱动小牛
驱动小牛
  • 注册日期2004-04-12
  • 最后登录2016-03-08
  • 粉丝1
  • 关注0
  • 积分7分
  • 威望111点
  • 贡献值0点
  • 好评度59点
  • 原创分0分
  • 专家分0分
阅读:2054回复:6

USB设备每换一个新口,就的重新安装驱动,正常吗?

楼主#
更多 发布于:2007-04-24 08:50
  老外说是正常的,有点不相信,但找不到证据。
seaquester
驱动大牛
驱动大牛
  • 注册日期2002-05-22
  • 最后登录2016-06-16
  • 粉丝0
  • 关注0
  • 积分500分
  • 威望115点
  • 贡献值0点
  • 好评度107点
  • 原创分0分
  • 专家分52分
沙发#
发布于:2007-04-24 09:38
这种情况是因为 USB 设备没有 Serial Number(或Serial Number无效)。所以bus driver 就根据它的位置信息来生成 InstanceID。如果 USB device 指定了有效的 SerialNumber,则系统始终将该设备识别成同一个设备(Instance ID就是SerialNumber)。


参考文档:
http://blogs.msdn.com/oldnewthing/archive/2004/11/10/255047.aspx

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.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
What characters or bytes are valid in a USB serial number?

A USB device has two choices for storing serial numbers in the iSerialNumber field (in the USB device descriptor):

(1) iSerialNumber == 0x00 : The USB device has no serial number.
(2) iSerialNumber != 0x00 : The USB device has a serial number and it is stored at the string index indicated in iSerialNumber.

If the device has a serial number, Microsoft requires that the serial number uniquely identify each instance of the same device. For example, if two device descriptors have identical values for the idVendor, idProduct, and bcdDevice fields, the iSerialNumber field will distinguish one from the other.

Windows Plug and Play requires that serial numbers across multiple buses follow specified rules. Every byte in a USB serial number is checked for correctness. If a single invalid byte is found, the serial number is discarded and the device is treated as if it had no serial number.

Invalid bytes in serial numbers are indicated below:

(1) Byte values less than 0x20 are invalid.
(2) Byte values greater than 0x7F are invalid.
(3) Byte value 0x2C is invalid.
八风舞遥翩,九野弄清音。 鸣高常向月,善舞不迎人。
cyliu
论坛版主
论坛版主
  • 注册日期2003-06-13
  • 最后登录2014-04-11
  • 粉丝5
  • 关注0
  • 积分1238分
  • 威望2531点
  • 贡献值0点
  • 好评度577点
  • 原创分14分
  • 专家分10分
板凳#
发布于:2007-04-24 10:58
学习了
走走看看开源好 Solaris vs Linux
yachli
驱动小牛
驱动小牛
  • 注册日期2004-04-12
  • 最后登录2016-03-08
  • 粉丝1
  • 关注0
  • 积分7分
  • 威望111点
  • 贡献值0点
  • 好评度59点
  • 原创分0分
  • 专家分0分
地板#
发布于:2007-04-24 16:36
太好了,seaquester,谢谢您
dzyssssss
驱动牛犊
驱动牛犊
  • 注册日期2006-07-10
  • 最后登录2010-04-08
  • 粉丝0
  • 关注0
  • 积分12分
  • 威望128点
  • 贡献值0点
  • 好评度74点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2007-04-24 16:56
哦原来是这样啊
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2007-05-18 16:39
学习了,原来这样,谢谢
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2007-05-18 17:09
不过我想问的是,这个serial number要烧在固件中么?那不是每个硬件都要烧一个不同的号,生产的时候
游客

返回顶部