We are developing a desktop application under Windows 10 x64 v2004 to control virtual USB COM ports where the devices will be connected/disconnected several times during operation:
- While connecting to a virtual COM port, we get sporadic access denied errors due to more than one virtual COM port being assigned the same port number
- Device Manager shows two USB serial devices with the same COM port number:
- Properties of the two USB serial devices simultaneously assigned the same
COM4
port:
This leads me to believe this is a bug in the OS:
- What is the reason that one device is listed as USB Serial Port, while the other is listed as USB Serial Device?
- Is one of the two driver manufacturers not following Microsoft's device driver rules?
- Can that difference explain the root cause of this issue or is there still a general issue in the virtual port addressing?
To automatically correct this, is it possible to cause the OS to re-assign the port number of an affected virtual COM port?
- In a case like this, the only thing I can currently do is the lousy workaround of asking the user to unplug/plug back in the second connected device
Best Answer
Because the two involved device drivers announced different names for their devices.
Not necessarily, Windows can make this mistake by itself.
Devices having serial numbers are recognized by Windows no matter which USB port you plug them into. I would guess that one of the devices was plugged-in previously on COM4, where the other is now plugged-in, so Windows just remembered it from before.
This is perhaps a racing condition, which as you say is cleared by one device disconnecting and re-connecting. I don't know of a solution, beside ensuring that you are using the right drivers.