USB Device Support on NI Linux Real-Time Operating System

Updated Sep 12, 2018

Issue Details

I have connected a USB device to my hardware running the NI Linux Real-Time Operating System (RTOS). I have no visual confirmation that the USB device is usable by my hardware. How do I know that it has been recognized or if the USB device is supported?  

Solution

The Linux kernel has built-in support for many types of devices including but not limited to USB storage devices and USB webcams.  Since the NI Linux RTOS is based on the Linux kernel, support for these devices is included. There is no defined list of hardware that can be referenced for support purposes, but there are ways to determine if a device can be used with the NI Linux RTOS.  

Note: The techniques discussed here will require the ability to log in to the NI Linux Real-Time target using a secure shell (SSH) or serial connection to the device.  Documentation has been provided in the Related Links section that can assist with this.  

Detecting Connected USB Devices:
It is possible to verify that a USB device has been detected by the NI Linux RTOS when it is initially plugged into a USB port on the target.  Once logged in to the Real-Time target, connect a USB device and issue the command dmesg to the console, then press enter.  Information similar to that shown in Figure 1 will be displayed.  You can search the information for text related to the device you have plugged into the target.  This is a reliable method for determining if the NI Linux RTOS can identify your device.  This does not guarantee that the device is usable with the target.
 

Figure 1. Typical dmseg Information About a USB Storage Drive

Determining if the Connected USB Device Is Usable by the Target:
The current kernel that the NI Linux RTOS utilizes is the 3.14.40 Linux kernel.  When the kernel detects a USB device that it can support, the kernel module (driver) is automatically loaded into memory and the device will become accessible to the user.  An easy method to determine if a new kernel module has been loaded for a particular USB device is to issue the lsmod command to the terminal before inserting the device, then issuing the same command after inserting the device.  If a module has been loaded, comparing the lists of loaded modules will show the new module.  

For most supported USB devices, a module will be automatically loaded for the kernel.  There may be times that a module does not load automatically.  To manually load a module for the kernel, issue the command modprobe <module> to the terminal.  For example, if the ftdi_sio module, a USB-to-Serial driver needs to be loaded, the command would be modprobe ftdi_sio.  

USB storage devices will be automatically mounted to the Real-Time target.  These can be accessed in the /media location and a shortcut to the drive will generally be mapped as /U unless a folder with that name exists on the system.  In such a case, the next available letter is used to map the USB storage device.

Additional Information

List of USB Modules on the NI Linux Real-Time OS:
Many kernel modules are multipurpose and do not make any indication as to what hardware is supported by the module.  There are no resources that explicitly list all hardware that is on a specific module.  To determine if your hardware is supported by the NI Linux RTOS, a search for the hardware on the internet may allow you to determine the kernel module it is associated with.  The current list of USB modules that are included with the NI Linux RTOS can be found in:/lib/modules/<kernel-version>/modules.usbmap. 


More Information About a Module:
Most modules that exist for the Linux kernel have documentation that can be referenced online. See the Related Links to learn more about each module.  To gain a general idea about the particular function of a module, you can issue the command modinfo <module> to the terminal. This will generally display module developer information as well as a simple description of the function of the module.

WAS THIS ARTICLE HELPFUL?

Not Helpful