LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice to store hardware ids

Solved!
Go to solution

Hey,

I would like to ask for some suggestions on my problem:

I have a system in which I use USB-6211's on multiple computers and it might happen that more than one of them is connected to a single computer, yet simultaneously only one is used on a machine. I have found a way to read serial number and I can attribute this number to a name. However at design time I do not know the serial numbers, so what would be the best to store them?

I am thinking of a way to store these values somewhere, read it, check devices, if there is no entry, then ask for a name to store, if found, return the name and get the dev identifier of the selected device.  The actual data format does not really matter, it can be a simple array, a variant attribute list or whatever, since a computer won't have more than ~10 devices listed. The actual problem is where to store them safe.

Some of the users might have administrator rights, while most of them definitely won't and have Windows XP, 7, 8 and 10 installed (something I can't really control).

 

Thanks

 

__________________
Engage! using LV2015
0 Kudos
Message 1 of 12
(4,005 Views)

I'm going to assume you're using DAQmx to access these?

 

If so, try using the DAQmx System node to get all available devices, then scan through them to find the types and serial numbers available.

 

DAQmx DevNames.png

0 Kudos
Message 2 of 12
(3,995 Views)

my problem is not how to obtain these values (actually I do use the same daqmx property node), but where to store that the device with a serial number of let's say "0x2102102" should be called "work card 1", and "0x34532432" should be called "fancy box"

as I do not know these at design time, I cannot store them inside the program, that's why I am looking for some way to store it permanently

__________________
Engage! using LV2015
0 Kudos
Message 3 of 12
(3,987 Views)

In an  Init File? It is where I store this kind of informations.

Message 4 of 12
(3,978 Views)

I tend to use configuration files (ini) to setup my hardware.  They are simple to use and make things easy to setup.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 12
(3,969 Views)

Okay, it seems that an ini file is the most common for these. 

Now another sub-question: where (at which point of a Windows filesystem) should I store this file to have it safe?

__________________
Engage! using LV2015
0 Kudos
Message 6 of 12
(3,962 Views)

In general, I store the init file in the directory ProgramData (C:\ProgramData\DirectoryOfMySoftware\Init.ini).  I don't know if it is the best place...

0 Kudos
Message 7 of 12
(3,954 Views)
Solution
Accepted by topic author jeanlucpicard

I was going to recommend an INI file too.

 

When you say "safe" do you mean that there won't be any permission issues to worry about?  Or that users can't alter it?

 

I prefer to use the "Get system directory" functionality.

 

Config in public.png

 

If you look at the "Help" entry for Get System Directory, it tells you what permissions and accessibity you can expect for any given directory.

 

"C:\ProgramData\" is a hidden directory by default and I found that trying to tell other users how to find a hidden directory to be more trouble than it was worth.

Message 8 of 12
(3,949 Views)
Message 9 of 12
(3,932 Views)

Thanks, it seems that ProgramData should be fine

__________________
Engage! using LV2015
0 Kudos
Message 10 of 12
(3,922 Views)