0
votes

I'm a little stuck with some piece of code I wrote and successfully tested on several PCs.

I have a generic usb device using the windows virual com port driver. This works as expected (2 drivers; one for the generic usb device and one for the virutal com port).

I wrote some code to scan the pc for all installed virtual com port devices. Under "friendly name" i read out the com port. The corresponding USB Device and virutal com port may be identified by the 'ContainerID'.

USB-Devices may be found under: Computer\HKEY_LOCAL_MACHINE_SYSTEM\CurrentControlSet\Enum\USB\VID_xxx&PID_xxx. The corresponding COM Device may be found under: Computer\HKEY_LOCAL_MACHINE_SYSTEM\CurrentControlSet\Enum\USB\VID_xxx&PID_xxx&MI_00 and VID_xxx&PID_xxx&MI_01

As you might expect the COM-Port, that is defined under 'FriendlyName' is not always the COM-Port, where you'll find the device in the Windows Device Manager.

So that's my question: If I have a virutal com port device - where can I read out, which com port is set up from windows for this specific device?

Have a nice weekend, AllDayPiano

1

1 Answers

0
votes

As you might expect the COM-Port, that is defined under 'FriendlyName' is not always the COM-Port, where you'll find the device in the Windows Device Manager.

No, in my experience with usbser.sys devices, the Device Manager always shows what is in the FriendlyName fields.

In the same key/folder where you found the FriendlyName, there is a key/folder named "Device Parameters", and the "PortName" value in there might be what you are looking for.

By the way, the lsport example from libusbp supports printing COM port numbers and USB identifiers for the virtual COM ports on your system.