From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI how to find usb resource name

Specifically, how to find active Visa Resource name of USB device (USB-4065).  Each time 4065 is pluggedinto different port, or PC, 'Devx" name changes.

0 Kudos
Message 1 of 5
(4,381 Views)

You can use NISysCfgFindHardware function to return a pointer to a 'NISysCfgEnumResourceHandle * ' item that lists all of the hardware on your target. Use the NISysCfgInitializeSession function to obtain a sessionHandle to your target - this is used as an input to the FindHardware function to declare which target you are referring to.


Once you have your NISysCfgEnumResourceHandle list, you can iterate over it using the NISysCfgNextResource function, which will return an individual resource. From here, use the NISysCfgGetResourceProperty function in conjunction with the Resource Property Decriptions list. To identify your 'USB- 4065' you will want to look for the property 'NISysCfgResourcePropertyProductName'. 

 

Here is a link to the top-level NISysCfg Function list that I have been referencing: http://zone.ni.com/reference/en-XX/help/373242E-01/TOC2.htm

 

Regards,

Sam

0 Kudos
Message 2 of 5
(4,343 Views)

Sam,

Thanks for the feedback.
This is what I implemneted late Sun. afternoon.  (You also need to check if the device is active)

Only drawback is ~14 seconds execute.  And this is required every time you run program.............. 

A bit frustrating when you are debugging...

 

K.O. smith

0 Kudos
Message 3 of 5
(4,334 Views)

I wonder if you can try to be "smart": save infos for the device connected when you exit and simply try reconnecting directly on the next start. If connection fails, then you can go the search route, but at least in debugging you should be able to save some time if you haven't disconnected the device between runs.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(4,319 Views)

Roberto,

Again, thanks for the suggestion,  Again, this is sort of what I have implemented.

I attempt to niDMM_InitWithOptions(),

  upon failure, NISysCfgFindHardware(),

  if still failed, throw error.

 

Just really messy.  I am buiding multple Portable Test Systems.  Laptop, USB-DAQ-6363, USB-DMM-4065, monster PWB, FPGA, 4 port Hub etc.

In the field, users will mix Test Sets, Laptops, and plug Test Set into any USB port.

The DAQmxGetSystemInfoAttribute() works so well............

 

0 Kudos
Message 5 of 5
(4,303 Views)