Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

NISysCfgFindHardware "expertNames" argument


I'm using the NISysCfg C api to find details of connected devices. As the NISysCfgFindHardware function is so slow, I am hoping to speed it up by only choosing a limited number of "experts" to query - in particular daqmx and niimaq. The function works as expected if NULL or "" is passed to the expertNames argument (returning all devices), however, if I try and limit the search range by passing "daqmx" or "daqmx, niimaq" I never get any results.

I have not been able to find any examples where anything other than NULL is passed to this argument. Any ideas what should be passed to this arg correctly limit to a small set of "experts"?


Please note that using a filter works as expected but doesn't speed the function up - it just filters the returned results.





0 Kudos
Message 1 of 8

Could you provide us with a little more context as to why you are trying to implement this search and what you are trying to accomplish in your application?


Also, if you could attach your code it would be helpful in addressing your issue. 

0 Kudos
Message 2 of 8

As a step back, our systems consist of an IMAQ Frame Grabber (using camera link) and a couple of USB connected DAQ cards. Due to the nature of the system we build, it is desirable for there to be no manual configuration preformed, hence I would like to be able to identify and configure both the DAQ and IMAQ cards via C apis. This seems to be straight forward for the DAQ cards using DAQmx, but not so for the IMAQ card. From my investigations the IMAQ library can only list the available interface names via imgInterfaceQueryNames, which simply returns a list of the .iid files configured in the system (and only the ones that existed when the process started), and no indication of whether they are valid for any installed card.


The NISysCfg library provides the ability to detect the actual IMAQ card and the details of it (in particular the serial number) such that I can generate a valid .iid file for later use.  It is just annoyingly slow

Below is some test code that enumerates the devices in the system (all error handling omitted for clarity)

    NISysCfgSessionHandle sys_handle = 0;    
    NISysCfgEnumResourceHandle enum_handle = 0;
    char* expert_names = NULL;
    NISysCfgEnumResourceHandle enum_val_handle;

    NISysCfgStatus status = NISysCfgInitializeSession(NULL, NULL, NULL, NISysCfgLocaleDefault, NISysCfgBoolTrue, 0, NULL, &sys_handle);
    NISysCfgFindHardware(sys_handle, NISysCfgFilterModeMatchValuesAll, NULL, expert_names, &enum_handle);
    while (NISysCfgNextResource(sys_handle, enum_handle, &enum_val_handle) == NISysCfg_OK)
        char productName[NISYSCFG_SIMPLE_STRING_LENGTH];
        char exp_name[NISYSCFG_SIMPLE_STRING_LENGTH];
        NISysCfgIsPresentType is_present;
        NISysCfgGetResourceProperty(enum_val_handle, NISysCfgResourcePropertyProductName, productName);
        NISysCfgGetResourceProperty(enum_val_handle, NISysCfgResourcePropertyIsPresent, &is_present);
        NISysCfgGetResourceIndexedProperty(enum_val_handle, NISysCfgIndexedPropertyExpertName, 0, exp_name);
        NISysCfgGetResourceIndexedProperty(enum_val_handle, NISysCfgIndexedPropertyExpertUserAlias, 0, alias);

        printf("Product name: %s, IsPresent: %d, ExpName: %s, Alias %s\n", productName, is_present, exp_name, alias);

If I use expert_names = NULL as above (or ""), I get all the devices in my system as I expect:

Product name: NI USB-6211, IsPresent: 1, ExpName: daqmx, Alias Dev2
Product name: NI USB-6251 (OEM), IsPresent: 1, ExpName: daqmx, Alias Dev1
Product name: NI PCIe-1433, IsPresent: 1, ExpName: niimaq, Alias img0

But, if I try and filter by using expert_names = "daqmx" or any other variation I try, there are no results found.



0 Kudos
Message 3 of 8
NISysCfgSessionHandle session = NULL;	
NISysCfgFilterHandle filter = NULL;

NISysCfgInitializeSession ("localhost", NULL, NULL, NISysCfgLocaleDefault, NISysCfgBoolTrue, 10000, NULL, &session);
//Open filter reference and set filter properties to seach by PXI number and slot number
NISysCfgCreateFilter(session, &filter);
//General purpose filters for all PXI modules
NISysCfgSetFilterProperty(filter, NISysCfgFilterPropertyIsDevice, NISysCfgBoolTrue);
NISysCfgSetFilterProperty(filter, NISysCfgFilterPropertyConnectsToBusType, 1);
//Specific device expert filters (Can un-comment to enable but will then be specific to device family)
//NISysCfgSetFilterProperty(filter, NISysCfgFilterPropertyExpertName, "ni-vst");
//NISysCfgSetFilterProperty(filter, NISysCfgFilterPropertyExpertName, "nifgen5433"); 
//Find and index out relevant HW resource
NISysCfgFindHardware (session, NISysCfgFilterModeAll , filter, "", &resourcesHandle);

Here is an example of some code that when tailored to your specific devices will potentially fit your case.

Instead of using comma separated list we are setting up some specific filters to find your experts.

0 Kudos
Message 4 of 8

Thanks for your help. I have tried your suggested filter configuration, but as per my initial experiments with filters, the filtering functionality works, but doesn't reduce the time to enumerate the devices.

0 Kudos
Message 5 of 8

Are your devices all plugged directly into the computer? Setting your code up to not search through Network devices could cut down the time it takes to find the devices.


Finding your devices is a function that interacts with the Operating System and that is what makes the process slow. You can see this if you go into NI-MAX and open up the Devices and Interfaces drop down, it will take much longer than any of the other drop downs to open. 

0 Kudos
Message 6 of 8

Yes, all my devices are connected to the local PC. How do I limit the search to exclude network devices? Other than setting the targetName, username and password in NISysCfgInitializeSession, the only other relevant parameters I could see were the connectTimeoutMsec parameter and NISysCfgSetRemoteTimeout function, and the timeouts on these don't seem to have any impact. 

0 Kudos
Message 7 of 8

Excluding network devices was a suggestion I had thought of off the top of my head. After taking a deeper dive into the CVI documentation it looks like it is not possible to exclude Network Devices from the search. Unfortunately it looks like the search not be able to get any faster because of the interaction between the software and the Operating System.

0 Kudos
Message 8 of 8