How does windows map the virtual com port to a device

…衆ロ難τιáo~ 提交于 2020-01-05 05:26:49

问题


I have run a test to verify, that windows (7 and 8) is capable of remembering the configured com port number for each usb port when i insert an usb->serial converter.

My test was simple:

  1. I have 2 similar USB to Serial converters from the same manufacturer and 1 converter from a different manufacturer.
  2. I insert converter no 1 into USB port no 1 and configure it as COM9 in device manager.
  3. I pull it out and insert the converter no 1 into USB port no 2 and configure it as COM10 in device manager.
  4. When moving converter no 1 between USB 1 and 2 i verify that the configured COM port settings are remembered.
  5. Using converter no 2 (From same manufacturer) i verify the same result as with converter no 1.
  6. Using a different converter (from a different manufacturer) i verify that it is assigned to a different COM port (in my case COM4).

Conclusion: It seems like windows is capable of identifying the inserted converter device, and configure the COM port with its previous setting.

Question: How does windows identify the inserted device?. I would assume by Vendor and/or Product ID, but I am not sure.


回答1:


Windows identifies USB devices by Vendor ID (vID), Product ID (pID), and Serial Number.

By default, your computer will give that device the same Serial Port COM number no matter how you plug it in.

Some serial-port-converter devices are configured without serial numbers, or with identical serial numbers, specifically so that they all look identical, and are identically given the same port number.

If the devices have identical serial numbers, Windows may become confused if "one device" is plugged into two USB ports at the same time.

If the device has no serial number, Windows will make one up based on where you connect it (so that it can tell the difference between identical devices connected to different USB ports). Since the virtual serial number is based on location, there will be a different serial port number for each USB socket.

Any identical device (with no serial number) will get that port number in that socket, each identical device will get those port numbers in those sockets.

It is also possible to configure Windows to always ignore serial numbers (GlobalDisableSerNumGen) or to always ignore serial numbers for specific pID/vID combinations (IgnoreHWSerNum). The effect is the same as if the device had no serial number: Windows gives the devices port numbers based on location.



来源:https://stackoverflow.com/questions/26754128/how-does-windows-map-the-virtual-com-port-to-a-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!