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.

Linux Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Gracefully detecting when NI-DAQmx is ready

Solved!
Go to solution

I am running NI-DAQmx 20.1 on openSUSE Leap 15.1 on a PXI-8101 controller. If I login immediately after a reboot and try to run any NI-DAQmx command (e.g. nilsdev) I get the dreaded...

libnipalu.so failed to initialize
Verify that nipalk.ko is built and loaded.
Aborted (core dumped)

After about 35 seconds I can run NI-DAQmx commands without errors. I am implementing a headless server so I need to delay my startup script until NI-DAQmx is ready. I can loop until nilsdev stops dumping core but that is inelegant. Is there a better way to determine when NI-DAQmx is ready to run commands without crashing?

 

I used to use a fixed delay but I just spent this week debugging a failure in about 1% of reboots that turned out to be because NI-DAQmx occasionally takes longer than usual to initialize.

Chuck Cox
Embedded Systems Engineer
SynchroSystems
0 Kudos
Message 1 of 3
(1,805 Views)
Solution
Accepted by topic author cccox

Hey cccox,
Thank you for posting your question here. nilsdev is the predecessor of lsni. Your error indicates that the NI-PAL service is not started yet. You can try to manually start nipal via /etc/init.d/nipal start or check its run state in a while loop before executing your own code. You can also programmatically check that your system has entered runlevel 5 via the runlevel.sysvinit command.

Generally, nilsdev and lsni are based on the NI System Configuration API, so you can write your own code to handle availability checks. Please refer to the SysCfg CAPI programming reference here: NI System Configuration 18.0 Function Reference 

Please keep us posted on your progress.
Good luck!



0 Kudos
Message 2 of 3
(1,742 Views)

Here is what we ended up with in our Bash shell script:

 

# Wait until NI-DAQmx is ready
printf "NI-DAQmx Starting"
until /etc/init.d/nipal status
do
sleep 1
printf "."
done
printf "\n"

 

Chuck Cox
Embedded Systems Engineer
SynchroSystems
0 Kudos
Message 3 of 3
(1,488 Views)