LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Serial Device - Friendly Name and Model

Hello everybody, I'm fighting since days with a problem and I hope you can help me:

In my company we produce devices that are connected to the computer via USB. I can communicate with the devices through Labview as they are seen as Visa devices and everything is fine.

Problem is that when I want to list the devices connected to the computer I use the "Visa find resources" and i get a list of Com devices (Com3, Com7, Com15 and so on). When I look in the Device Manager of Windows I see that each device is identified by a name which is the same that i see when i look at the device property "Friendly Name" and at the "Model" of Windows.

I tried to get this information through the Visa-Serial Interface Information-Interface Description but I get only "Communication Port 3" for example.

 

So I did some research and I found a way through dotNET Management Object Searcher and WMI. I can actually get most of the informations that the device manager shows me but I can't find a property that gives me the device model.

 

In attachment you can find a VI that i created in order to get for example the "Manufacturer" which is the name of my company. In the first loop I use Select * from Win32_SerialPort in order to get the device PID and VID. In the second loop i use Select * from Win32_PnPEntity and then through the PID and VID I list the "Manufacturer" property of my device.

 

Is there a way to get the USB Serial Device Name on Labview? Somewhere I saw once someone doing it through the Windows Registry but I can't find the post anymore. I hope you will help me.

Thanks a lot in advance.

Dario Cassaniti

0 Kudos
Message 1 of 13
(7,225 Views)

Have a look at the Windows executable called 'DevCon' - it's a command-line application (which you can call using System Exec) that you can use to do pretty much everything you can do with Device Manager. It might help to fill in the gaps from your .NET / WMI attempts.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 13
(7,213 Views)

I tried to get the attached vi running but it didn't work out for me, maybe it will for you... 🙂

 

The for-loop inside the vi gets ALL registery settings, maybe you can find the one you are looking for!

 

Good Luck!

0 Kudos
Message 3 of 13
(7,207 Views)

With this VI I get no device listed. I guess because my device is not exactly a USB device (like a USB Stick) but a USB serial device 😞

what is not working for you in my dotNET vi?

0 Kudos
Message 4 of 13
(7,191 Views)

I forgot to mention that I already tried with Devcon (but there might be something I missed).

I run devcon hwids * and I find my device (again through VID and PID) and the name is Communications Port (COM34), exactly what labview is also able to give me. That's the whole section relative to my device:

 

USB\VID_254E&PID_E40B\6&1EE0AE2A&0&2
    Name: Communications Port (COM34)
    Hardware IDs:
        USB\VID_254E&PID_E40B&REV_0000
        USB\VID_254E&PID_E40B
    Compatible IDs:
        USB\Class_02&SubClass_02&Prot_01
        USB\Class_02&SubClass_02
        USB\Class_02

 

maybe I should use another devcon parameter?

0 Kudos
Message 5 of 13
(7,189 Views)

@cassaniti wrote:

I forgot to mention that I already tried with Devcon (but there might be something I missed).

I run devcon hwids * and I find my device (again through VID and PID) and the name is Communications Port (COM34), exactly what labview is also able to give me. That's the whole section relative to my device:

 

USB\VID_254E&PID_E40B\6&1EE0AE2A&0&2
    Name: Communications Port (COM34)
    Hardware IDs:
        USB\VID_254E&PID_E40B&REV_0000
        USB\VID_254E&PID_E40B
    Compatible IDs:
        USB\Class_02&SubClass_02&Prot_01
        USB\Class_02&SubClass_02
        USB\Class_02

 

maybe I should use another devcon parameter?


No, You should not be heading down that rabbit hole.  And there is something very big that you missed!

 

Capture.PNG

Have you tried the System Configuration API found under the Measurment I/O palette?  It will likely do exactly what you want.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 13
(7,175 Views)

never tried that, but I don't really understand how does it work.. I will look for some examples and try

0 Kudos
Message 7 of 13
(7,168 Views)

@cassaniti wrote:

never tried that, but I don't really understand how does it work.. I will look for some examples and try


The "Help" on that  API is usually effective to aid the learning process... some of the "Experts" Parameters that you will need in the "Find Hardware.vi" are more obfuscated than is absolutly necessary but there is a White Paper on that.


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 13
(7,157 Views)

The Vi to read the registery can be used but it needs a little tweaking!

 

You just have to find your device in the registery first.

 

As for me, I look for the key "System\CurrentControlSet\Services\FTDIBUS\Enum"  --> resulting in your device name like "VID_0403+PID_6001+..."  (this is my FTDI USB Serial Port)

 

Then you do a 2nd registery search in  "System\ControlSet001\Enum\FTDIBUS\VID_0403+PID_6001+FTF6JXYMA\0000\" where you insert the one your found in Enum on the first query?

 

and I read all the parameters resulting in:ftdi_params.png

 

I just do not know where your device will be listed, you need to replace the FTDIBUS in above example with yours.

So if you want your 'FriendlyName'... it should be there.

 

(Your vi works fine for me, but mine didn't until I changed it into the attached one.)

Message 9 of 13
(7,116 Views)

Thank you very much for the VI, but could you please save it as LabView 2014 file? Otherwise I cannot open it.. Thank you very much!

0 Kudos
Message 10 of 13
(7,070 Views)