Jump to content

Need to find all Virtual Comports with VID 403 and PID 6001


Trax
 Share

Go to solution Solved by jguinch,

Recommended Posts

  This is kind of a continuation of a thread I started the other day but I need to start from ground zero in hopes of a radically different solution. I am sorry if it is somewhat redundant. In a nutshell I need to find the Comport Number (not parsed from the FriendlyName and will explain) for all Virtual Serial Ports having VID 403 and PID 6001. It is a FTDI Virtual Serial Port.

   I was using the WMI call to Win32_PnPEntity and excluding ports not having  DeviceID "FTDIBUSVID_0403+PID_6001". The $oItem.name would than yield something like "USB Serial Port (COM17)". This is the Device Manage description. I could then parse out the "COM17" and start communicatin with that port via RS232. The problem....COM17 is the FriendlyName and the actual port was 25. Yes that is correct. Device Manager shows "USB Serial Port (COM17)" but if you right click on it and go to properties the actual port number is 25. I verified it by using putty and indeed it was COM25. So the "FriendlyName" does reflect the true Comport Number.

   I found a little utility by uwe-sieber ComPortMan which comes with a little utility called listports.exe. Here is the output:

PortName           : COM25
KernelName       : DeviceVCP0
DeviceID            : FTDIBUSVID_0403+PID_6001+A901R735A0000
ParentDeviceID  : USBVID_0403&PID_6001A901R735
DriverKeyName  : {4D36E978-E325-11CE-BFC1-08002BE10318}0088
FriendlyName     : USB Serial Port (COM17)
 

   As you can see the true Comport is 25 yet the firendly name is "USB Serial Port (COM17)". So... I need to find a way to retrieve the actual "PortName" and not parse the "FriendlyName". As mentioned the WMI call to Win32_PnPEntity returns the FriendlyName. A WMI call to Win32_SerialPort wont work with Virtial ComPorts. I am at a loss. I know it can be done because the listports utility does it. I have no idea where to start at this point. Help!

Link to comment
Share on other sites

   A million thanks for the effort jguinch but no joy. I put a couple consolewrites in to simply show the raw data and there was nothing that even resembled a comport number.

   It looks like people are avoiding this one like the plague :)

Link to comment
Share on other sites

  • Solution

Did you search in the registry ?

I looked at my COM1 device in the registry, so maybe you could have a HKLMSYSTEMCurrentControlSetEnumFTDIBUSVID_0403+PID_6001+A901R735A0000 key with its FriendlyName, and then the Device Parameters subkey containing the PortName value ?

Link to comment
Share on other sites

   You are dancing all around it and so close. Even though I do not have comports in my computer those entries are there because at one time I did have comports. So those entires are not necessarily ports that are currently in my computer they are ports that at one time were in my computer.

   Ports that are currently in a computer are at HKLMHARDWAREDEVICEMAPSERIALCOM and the Data Value of those entries is the actual PortName, not the friendly name. But these entries don't have the VID/PID.

   It is almost like a 2 step process. First you have to find ports that are currently in the system then you have to work it backwards to somehow find the VID/PID. I am really suprised someone hasn't done this before. It is a killer!

Link to comment
Share on other sites

You nailed it jguinch. Thanks for beating on me about the "HKLMSYSTEMCurrentControlSetEnumFTDIBUSVID_0403+PID_6001+A901R735A0000 and then the Device Parameters subkey containing the PortName value"

That was the silver bullet. Once I got the ColItem.DeviceID from the WIn32_PnPEntity call all I had to do was:

 $KeyName = "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetEnum" & $colItem.DeviceID & "Device Parameters"
 $PortName = RegRead($KeyName, "PortName")

So now all I have to do is figure out how to mark the question as answered :) Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...