Showing results for 
Search instead for 
Did you mean: 

Can I programmatically change my USB Dev assignment?

I have a production test program that uses two USB 6501 DAQs. Currently during development they're assigned Dev1 and Dev2 in MAX and my DAQmx drivers are set up for those addresses. This test fixture, when deployed, will be connected and disconnected from the production equipment, and other USB devices may be plugged into and unplugged from the production test computer in the interim, then these will be plugged in again when it's time to test this product, and the Dev assignments are likely to be different from Dev1 and Dev2. I know I can change them in MAX, but that's not practical. I want this problem and a solution to be transparent to the people using the test program, and I'd like to reassign or change Devs programmatically. Is this possible? If so, how?

0 Kudos
Message 1 of 9

There are two use cases with USB devices in general.


If the device has a unique serial number (As defined in the USB spec) then you can have a per-real-device differentiation like you require.


If the device does NOT have a serial Number (Many don't) then this cannot work because there is no "unique" identifier.


Assuming the device has an identifier, you should have to set the alias only once per host computer to get it working.



0 Kudos
Message 2 of 9

EXCELLENT insight! Thank you. It does have a serial number. Now how do I set the alias as you suggest?

0 Kudos
Message 3 of 9

I'm not sure if you're being sarcastic or not....


Either way, I think if you go into MAX and select the device in your system you should be able to define an Alias there.  If you export the MAX settings, you should be able to import them on another machine.  It's been several years since I've done that but if memory serves correctly, that's how it's done.



0 Kudos
Message 4 of 9

Just tried it ona  simulated device.  Right-click ont he name as it shows up in MAX and choose the option.............


-drum roll-



"Rename" and type in whatever you want to call it.  I like the name "Fred".

0 Kudos
Message 5 of 9

System Configuration VIs will allow you to chance MAX device names




I had a similar problem with 25 identical test sets each with 6 USB power supplies. Power supplies are swapped out for calibration just about weekly. The identifiers in MAX needed to be changed each time based off of their serial number.


Years ago I attempted to modify the setting in MAX and had some success using the now deprecated “MAX Copy Configuration” VI, but opted instead to query the test set to find the power supplies and what their references names where and store the device names. Then the program could care less what MAX had for their device names. There was some extra code to figure out which supply was which (1-6) that depends on how YOU are using your devices.


We have adopted a similar methodology for other test sets for ALL our instrument device references (VISA, DAQmx, GPIB, USB, PXI, LXI). Find what’s there and use whatever name MAX has for and not try to change it.


See the

System Configuration VI

GPIB Find listeners

VISA Find Resource



Depending on the system, I use some combination these to find my instruments.


I also use Mico Soft’s DevCon function to find devices on my test sets.

0 Kudos
Message 6 of 9

The best place to edit aliases in MAX is under 


Software/NI-VISA X.X -> VISA Options tab -> My System/General Settings/Aliases


If you assign 'MyDev1' alias to serial number 123, but then replace unit s/n 123 with unit s/n 456 you will not be able to re-assign 'MyDev1' to s/n 456 until you delete it from s/n 123. If s/n 123 is not plugged in you have to delete the alias here before you can assign the alias to s/n 456.

0 Kudos
Message 7 of 9

Omar and Shane, good information, and I'm not being sarcastic. This is just what I was looking for. I'll try these suggestions.

0 Kudos
Message 8 of 9

@hammer3 wrote:

Omar and Shane, good information, and I'm not being sarcastic. This is just what I was looking for. I'll try these suggestions.

No problem.  Nothing personal.  I haven't "seen" you around much so I don't know how to filter your posts.  There have been a spate of rather rude and overly expectant users in the last years. 


Either way, if I can help I will.  Hope you get it working the way you want.

0 Kudos
Message 9 of 9