LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading information from Device Manager

We are using a prolific USB to Serial device to communicate with a custom device.

I need to be able to determine what com port windows has assigned to this device as it changes with each different computer configuration.

I can do this manually by checking the port assingments in windows device manager.

I am looking for a way to read this information from within the application.
0 Kudos
Message 1 of 12
(6,273 Views)
In principle I think that you need to look up the following in the machine registry: -
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM

From here you will find, or not a number of keys: -
The value of the key will indicate the COM device and the key name will be the device name.

That should work nicely....
0 Kudos
Message 2 of 12
(6,264 Views)
Thanks Conseils;
Now one more question. How do I view the Registry Keys from within LabView?
Would you happen to have an example of the coding.
0 Kudos
Message 3 of 12
(6,259 Views)
Conseils;
I looked into the registry keys, but it doesn't show me which device I want.

When I look at device manager there is a listing under ports labeled prolific USB to Serial Bridge (COM3).

However when I look at the registry Keys it just shows Device\Serial0 COM1, Device\Serial1 COM2, Device\Serial2 COM3. It does not show which is the prolific device.

I need some means of identifying the COM port for the prolific device. Some of the systems we are going to install these devices into have as many as 9 COM ports, and the COM port assignments are different on each one.
Sometimes the Prolific USB is assigned COM3 sometimes COM8, or 9 etc. Seems to be different on each system. Has something to do with the order in which the different devices power up.

Thanks for your help, if you can think of anyway to get the info programaticly let me know.

Keith
0 Kudos
Message 4 of 12
(6,257 Views)
Check out the Windows Registry VI's
They are on the Advanced Palette.

"Use the Windows Registry Access VIs located on the Functions»Advanced»Windows Registry Access VIs palette to create, open, query, enumerate, close, and delete Windows Registry keys. You also can enumerate, read, write, and delete the value of Windows Registry keys."

I assume this is on a Windows machine......
0 Kudos
Message 5 of 12
(6,254 Views)
From memory it has to do with the order in which the USB devices are enumerated by Windows.

I will chech this out later today for you as I want to be able to do something very similar.

I checkd a machine out with a modem on it and the key names were enumerated with a device identifier. Thus it could be that your driver or USB device is sloppy and not properly identifying itself.

I will return with more later.
0 Kudos
Message 6 of 12
(6,252 Views)
Another place to look for the information is in visaconf.ini. I can't verify this since I don't have any USB to Serial adapters. First open MAX and under Devices and Interfaces>Ports and see if the information you need is there. The file is located in VXIpnp\WinNT\NIvisa
0 Kudos
Message 7 of 12
(6,252 Views)
Well I would have attached a picture of my MAX config with one USB serial port re. Dennis Knutson's excellent comments. But there is a 5K message limit so I attacht the ini file.

Further to my comments, the USB enumeration can be discovered at :-
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB
By 'walking the tree' you could then discover 'where' a USB to serial port adaptor has been plugged into the system.
From here I was able to discover the manufacturer name and other information as displayed on the 'Hardware properties tab'

This is what I wanted to be able to acheive.
Does this get you where you wanted to be?
0 Kudos
Message 8 of 12
(6,236 Views)

Not sure if I can revive this or not, but I'm having similiar issues in the sense that I have a

16 port  USB Virtual COM PORT Hub that assigns non sequential com ports when plugged in.    When I look at the device manager General Tab it shows the physical location of the assigned port next to the Location description. 

Is there way to retrieve this property using the property node of the visa resource??  I can retrieve all the com ports and filter by the manufacuter so I get  all 16 com ports,  the problem is I don't know what physical port is talking to the virtual port..    I can manually edit the com ports in device manager and re-arrange the orders so that they are sequential, but would rather do programmatically  if possible..

 

Thanks much!

0 Kudos
Message 9 of 12
(5,521 Views)

@Fudde wrote:

I can manually edit the com ports in device manager and re-arrange the orders so that they are sequential, but would rather do programmatically  if possible..


That's the way I've always done it.  It sucks the first time but Windows should keep the new COM assignments once saved.

 

But now that I think about it I don't think it is crazy to get this information.  I think Devcon could get this information but I haven't tried.

 

http://digital.ni.com/public.nsf/allkb/1D120A90884C25AF862573A700602459

0 Kudos
Message 10 of 12
(5,512 Views)