USB on Linux and Mac

NI-VISA

USB on Linux and Mac

Linux

NI-VISA relies on a Linux kernel feature for its USB support. This feature is called usbfs, and was referred to as usbdevfs on older Linux kernels. For NI-VISA to support USB devices, this feature must be present and mounted (like a virtual file system). Most major Linux distributions such as Red Hat, SuSE, and Mandrake support this feature. You can use the mount command to display the currently mounted file systems to see if your system currently supports this feature.

Also, the VISA user must have write access to the file that represents the USB device, which is typically somewhere in a subdirectory in /proc/bus/usb. If this is not the case, VISA cannot access the USB device (it cannot be found using viFindRsrc, and viOpen fails). On most systems, the root user has write access by default; however, no other user has this access.

There are several options for providing a nonroot user access to a USB device:

  • Use the hotplug package. This package is installed by default on most distributions, including Red Hat, SuSE, and Mandrake. Use the hotplug package to run scripts for a specific USB device based on characteristics such as Vendor ID (VID) and Product ID (PID). If the hotplug package exists, the NI-VISA Installer by default installs scripts to give all users write access to all USB TMC devices and a framework for USB RAW devices. To add write permissions for a specific USB RAW device, run the included script:

    <VXIPNPPATH>/linux/NIvisa/USB/AddUsbRawPermissions.sh

    For more information about the hotplug package, refer to http://linux-hotplug.sourceforge.net/.

  • Mount usbfs (formerly known as usbdevfs) with the option devmode=0666. This gives all users read and write access to all USB devices.
  • Add write permissions to the file that represents the USB device, which is typically somewhere in a subdirectory in /proc/bus/usb. Unfortunately, these permissions are lost if the device is unplugged. Therefore, this approach is not recommended.

Mac OS X

As long as no other driver on the system claims the USB device, you can use NI-VISA to access it. No special setup is required.