NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Installing drivers for USB devices on myRIO

Hi,

I would like to install the driver for a USB device on the myRIO. The driver file is attached.

I have no prior experience in Linux. Would greatly appreciate if anyone can advise on how to install the driver onto the myRIO.

I have tried the steps listed in https://decibel.ni.com/content/docs/DOC-34827 and it appears that the device is not listed, so a driver installation may be necessary.

Thank you.

0 Kudos
Message 1 of 10
(6,049 Views)

It looks as if your best bet is to compile the module on the target itself. It's going to take a bit of work since the headers and tools are not exactly at standard locations on the targets, but we've written up a guide to get experienced kernel folks what they need. And really, this sort of thing  should have someone who's at least a bit experienced working with kernel builds looking at this.

Tutorial: Adding Kernel Modules on NI Linux Real-Time

0 Kudos
Message 2 of 10
(4,325 Views)

Thanks. I'll do some read up.

I noticed the driver packages comes with 4 "makefile" file. Do we need to create a makefile according to the tutorial, or can we make use of the packaged makefile?

If we're writing the makefile, do we need to write a makefile for each ".c" file in the folders?

Much thanks for any advice.

0 Kudos
Message 3 of 10
(4,325 Views)

I would recommend taking the existing makefile for the driver module (the one under the driver folder) and adjust it for your needs.

When you first posted this question, I quickly got something building but, without hardware, I had no way to test it. I basically made sure that the environment was configured as described in the document I linked and adjusted the makefile to match where things were located on disk (and the version of the kernel).

I'm on holiday right now, but if you're still stuck next week I can check back in

0 Kudos
Message 4 of 10
(4,325 Views)

mxconf does not have the correct permissions. Additionally, do as the error message states, and check the build.log file for more information.

0 Kudos
Message 5 of 10
(4,325 Views)

You must update the makefiles to point to the correct location for the kernel build directory. Note that the build directory is a squashfs filesystem, only available after you've run setup_versioning_env (which depends on sourcing the versioning_utils.sh script). This is covered in the documentation I directed you to.

So, to be completely clear:

  1. Boot into runmode/LabVIEW mode
  2. Run source /usr/local/natinst/tools/versioning_utils.sh
  3. Run setup_versioning_env
  4. Check to make sure that you have the kernel build directory at /var/volatile/tmp/headers/kernel
    • ls /var/volatile/tmp/headers/kernel/ should show things like Makefile, Kconfig, etc.
  5. Edit the driv_linux_uport.../driver/Makefile's KDIR variable to point to the directory noted in 4.
  6. Edit the driv_linux_uport.../driver/mxconf's K_SOURCE variable to point to the directory noted in 4.

Note that I have not actually run through these steps, and if you want to be working with the kernel, you're going to need to learn stuff and investigate why things are failing. NI makes no promises that some random hardware that claims to have a linux driver will be supported, and certainly no promises on the impact on the performance or reliability of a system with such a driver loaded. This is even moreso the case for drivers that are not included in the kernel source itself.

All of that is a thorough way to tell you that I'm not going to continue spoon-feeding you, I'm not here to give gratis contract work. Please, do a little work and have a reasonable question and not just an open-ended "It's not working, why?"

0 Kudos
Message 6 of 10
(4,325 Views)

     Alright.

     It is precisely because NI doesn't support this aspect of "making use of NI hardware" that's why I ask for assistance from the forum instead of contacting support, in the hope that someone with linux background could provide valuable insight.

     I appreciate the advices given so far.

     Probably there will not be anymore input, so nothing more for me to add.

0 Kudos
Message 7 of 10
(4,325 Views)

I suppose my response was a bit harsh, but basically I don't want to be in the business of hand-holding everyone who wants to add a driver to their LVRT target. This is a place of collaboration, not one-sided assistance.

0 Kudos
Message 8 of 10
(4,325 Views)

ok.. there is 2 module.ko file.

insmod mxusbserial.ko runs ok. So the module was copied into the kernel as stated in the tutorial.

But

insmod mxuport.ko failed.

mxuport error.png

"Unknown symbol in module" means there's issue with the source code?

All the modules were complied in the RT target as described in the tutorial.

0 Kudos
Message 9 of 10
(4,325 Views)

Check the kernel log to see if there is any additional information:

dmesg | tail

0 Kudos
Message 10 of 10
(4,325 Views)