Retrieving USB-Serial Converter Information

I hope you help me with this. I have a serial device, this device will be connected to the USB-Serial converter, and then the converter will be connected to the USB port. The system will add another COM port to the device manager. My question is: how can I match the COM port number with the converter in C #? I can successfully list the available COM port on the system by doing SerialPort.GetPortNames (), but I'm not sure what COM port this converter has.

thanks ar

+4
source share
5 answers

You can usually get some information from a WMI request, although this requires a device driver. Most do afayk. Run the query in the Win32_SerialPort class. You can use the WMI Code Creator tool to experiment with the request and automatically generate the C # code that you need.

Do not count on the ability to automatically select a device. You will need a configuration option that allows the user to select a port. You can display the information received from the request to help her choose the right one. Or ask her to disconnect the device and reconnect it, the added COM port must be correct.

+3
source

We solved it in different ways for different applications. We used the explicit configuration for the instance where we had exactly one device of a certain type, but it was not clear which COM port it would be assigned until the system was configured. In another case, we had one USB cable that burst in the hub with a bunch of converters on it, so we examined all the COM ports that we could open to look for the devices we were interested in.

A couple of warnings with USB / serial converters in Windows - if your device looks like a GPS device that sends data when it is turned on, Windows may detect it as an old serial mouse if it is connected at boot time. In addition, connecting to another USB port is likely to chew on an additional COM port number (and also overrides any explicit configuration you made).

+1
source

You will have to look for it somewhere in the registry.

I can only assume that this is an FTDI chip. If so, you can get information about using your public API, which is part of the drivers.

If there are no other answers, I will check later tonite at home, since my JTAG debugger has the same chip.

Update:

Here is the registry key for my device assigned to a COM port (under PortName )

 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_0483&PID_5740\498C54823932\Device Parameters 

I think you can simply list the usbser driver via USB devices.

0
source

When I had the same problem (RFID reader), I checked every port if there was any data. This would probably be something in COM4: COM9. I know that this is not the best solution, but I used it on a mobile device, where I am confident in my COM connections ...

Perhaps your driver * .ini file has some information about the COM number.

0
source

If you are using an FTDI-based solution for serial conversion of USB and ">, you can use the FT_PROG utility that is available on the FTDI website to assign custom VID: PID to converter pairs, which you can then query to determine which adapter assigned to which virtual port.

Alternatively, you can use FTDIChip-ID , which is unique for each chip, code examples are described in detail here: http://ftdichip.com/Support/SoftwareExamples/FTDIChip-ID.htm

0
source

All Articles