Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an embedded USB device (ie LPC15xx) with Descriptor and supporting code (at the endpoints) that is based on CDC/Communication protocol (which is working fine).

When plugged, it enumerate the descriptor and identified as communication device or CDC as defined in USB standard. The Window OS implement Virtual Com which the COM Port if generated. In this case for example COM6.

I wish to establish link between COM6 and USB device that contain (PID/VID/Description), so far what I seen in google search, I only code that take out the PID/VID/Description but no association with COM6.

I'm using Serial.Port from .NET framework in C# to communicate with USB device under COM6.

How to link between them in C# code example?
Posted
Comments
George Jonsson 2-Dec-15 23:00pm    
Link between what? The COM port number and the VID/PID?
It is not really clear what it is you want to achieve.
riscy 3-Dec-15 1:14am    
Thank George

There are several embedded device of same PID and VID as communication device. Window OS enumerate them and established several COM, ie COM6, COM7 and so on.

I have several terminal (Putty) with COM6 and COM7 so Window OS must know which USB device that connect to to avoid mix up in message data transfer between putty term and device.

I have investigated WMI properties under Win32_SerialPort, Win32_PnPEntity and Win32_USBHub, I found it difficult to establish association between them as done by putty terminal, so I missing something there. I asking if anyone know what is the missing link.
Ralf Meier 3-Dec-15 3:40am    
You want to detect, which Com-Port is assigned to which USB-Device ?
riscy 3-Dec-15 4:09am    
Yes Ralf that right.
Ralf Meier 3-Dec-15 4:46am    
Perhaps you take a look to here :
http://www.codeproject.com/Tips/349002/Select-a-USB-Serial-Device-via-its-VID-PID

I am still not sure what the problems is you are trying to solve, but I remember that we used to use USB View to trouble shoot problems with USB-RS232 converters on Windows XP.
It shows detailed info about to which port a specific device is connected and much more.

It seems that it is available for Windows 7 too, see Map and troubleshoot your USB ports with Microsoft USB View[^]

You can also get the source code for this software from MSDN. It is in C++, though, but maybe you can some idea about the missing link.

Not sure if this is what you are looking for.
 
Share this answer
 
George...thank again for the reply and apologise for difficulties in expressing my question.

I wish to send you image but not sure how,

I discovered the LibUSBDotNet which provide USB descriptor and WMI details where COM number is exposed, how the window OS or LibUSBDotNet link between them, I don't know.....

The serial number of the embedded device can be accessed via descriptor which is not exposed in WMI under Win32_SerialPort, Win32_PnPEntity and Win32_USBHub. However it MSDN website did mentioned GetDescriptor within Win32_USBHub but not sure how to use it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900