Skip to Navigation

Linux and Mac OS X drivers

Introducing the Exodriver

The native USB drivers for Linux and Mac OS X have merged into a single driver: the Exodriver. The Exodriver is a thin interface (think exoskeleton) to LabJack devices. It’s written as a C library that uses libusb-1.0 for USB communication. The library can open, close, read from, and write to a LabJack U3, U6, UE9, and U12. Because it’s a library and doesn’t have any kernel code, it’s easy to build.

U12 users also have the option to use the ljacklm high-level driver, which requires the Exodriver. For more details visit the ljacklm web page .

Mac OS X Quickstart

Mac OS X users can use the pre-built installer rather than building the Exodriver from the source. The installer includes an patched copy of libusb 1.0.8 (source code). We also provide a simple Xcode project if you would like to use Xcode to build LabJack applications with the Exodriver. C language examples are provided with the Exodriver’s source code.

If you would prefer to build the Exodriver from the source, the instructions in the next section work on Mac OS X.

Two notes to U12 Users on Mac OS X: First, there is an issue with interrupt transfers and libusb that can be a huge problem for U12 users. There is an unofficial patch that should be included in the next release (1.0.9) of libusb. For now, we offer the libusb source with the patch applied. We have also updated the pre-built installer to use this version. (You should probably use the installer anyway because of the second note.) Second, use the “Customize install” option of the pre-built installer to add the LabJackHID kernel extension. This is a null kernel extension which prevents the OS’s HID driver from claiming a LabJack HID device. This is only required by U12 and SkyMote Bridge devices, otherwise it does not need to be installed.

Quickstart: Building from the source

If you have all the requirements:

  1. A modern Linux or Mac OS X system
  2. A C compiler (gcc, e.g., build-essential on Debian/Ubuntu, Xcode on Mac OS X)
  3. libusb-1.0 installed (from the source or -dev binary packages)

then building the Exodriver is easy. Download the source (click the “ZIP” button or “Download Source” link on that page), build it, and install it.

On both Linux and Mac OS X, run

  
$ cd liblabjackusb/
$ make
$ sudo make install
  

After installing the Exodriver, build the U3, U6, or UE9 example programs:

  
$ cd ../examples/U6/
$ make
  

Run one of example programs like this:

  
$ ./u6BasicConfigU6
  

For more information, consult INSTALL.Linux or INSTALL.MacOSX. INSTALL.Linux details which kernel versions are required and how to automatically set device permissions properly. INSTALL.MacOSX lists which releases of Mac OS X are supported.

In-depth Linux build instructions

As we detailed in May 2010, Ubuntu 10.04 comes with a binary release of libusb-1.0, so building the Exodriver is easier than ever. Install the dependencies with apt-get, checkout the Exodriver source code, and build it. Here are the complete steps, along with a handful of steps at the end that build LabJackPython, which is our Python module that works well with the Exodriver:

  
$ sudo apt-get install build-essential
$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install git-core
$ git clone git://github.com/labjack/exodriver.git
$ cd exodriver/liblabjackusb/
$ make
$ sudo make install
$ cd ..
$ sudo cp 10-labjack.rules /etc/udev/rules.d/.
$ sudo udevadm control --reload-rules
$ cd
$ git clone git://github.com/labjack/LabJackPython.git
$ cd LabJackPython/
$ sudo python setup.py install
$ python
>>> import u3
>>> d = u3.U3()
>>> d.configU3()
   

If you don’t have Ubuntu 10.04, and your distribution doesn’t have binary libusb-1.0 packages, this step will fail:

  
$ sudo apt-get install libusb-1.0-0-dev
   

Instead build libusb-1.0 from the source. Download the source from SourceForge. Version 1.0.8 is the latest as of July 2010. Build it in the standard way:

  
$ tar xvfj libusb-1.0.8.tar.bz2 
$ cd libusb-1.0.8/
$ ./configure
$ make
$ sudo make install
   

Be sure to consult INSTALL.Linux for instructions on how to set the device permissions correctly using udev.

In-depth Mac OS X build instructions

Download Xcode and install it if you don’t have it already.

Mac OS X requires libusb-1.0 to be built from the source (like many Linux distributions). Download the source from SourceForge. Version 1.0.8 is the latest as of July 2010. Build it in the standard way:

  
$ tar xvfj libusb-1.0.8.tar.bz2 
$ cd libusb-1.0.8/
$ ./configure
$ make
$ sudo make install
   

After installing libusb-1.0, install the Exodriver as described in the Quickstart.

Optional: Build a combined 32-/64-bit Exodriver on Mac OS X

These steps are generally not needed, but there are circumstances that require a combined 32-bit and 64-bit Exodriver. You need both architectures when you get error messages like the one in this LabJack forum topic

  
dlopen(liblabjackusb.dylib, 6): no suitable image found.  Did find:
    /usr/local/lib/liblabjackusb.dylib: mach-o, but wrong architecture
   

In this case, a 32-bit process tried to load a 64-bit Exodriver. Here’s how it happened: When following the instructions in the Quickstart, the compiler built a copy of the Exodriver for its native architecture. On modern Mac OS X systems, that’s x86_64 (64-bit). Verify this by running:

  
$ file /usr/local/lib/liblabjackusb.dylib 
/usr/local/lib/liblabjackusb.dylib: Mach-O 64-bit dynamically linked shared library x86_64
   

Normally, this is what you want. The programs you will use to call the Exodriver will also be 64-bit. The built-in Python on Mac OS X, for example, is compiled for three architectures, including x86_64:

  
$ file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 3 architectures
/usr/bin/python (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture i386):	Mach-O executable i386
/usr/bin/python (for architecture ppc7400):	Mach-O executable ppc
   

There are some programs on Mac OS X, though, that are not 64-bit (they’re i386 only), and they can’t load a 64-bit Exodriver. The Python download from python.org, for example, is 32-bit at the time of this writing. We recommend using the built-in Python on Mac OS X.

When you must load the Exodriver from a 32-bit process, you must compile libusb-1.0 and the Exodriver to be combined 32-/64-bit libraries. Start with libusb-1.0

  
$ tar xvfj libusb-1.0.8.tar.bz2 
$ cd libusb-1.0.8/
$ export CFLAGS="-arch i386 -arch x86_64"
$ ./configure --disable-dependency-tracking
$ make
$ sudo make install
   

Confirm it worked by running:

  
$ file /usr/local/lib/libusb-1.0.dylib
/usr/local/lib/libusb-1.0.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/libusb-1.0.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/usr/local/lib/libusb-1.0.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
   

After libusb-1.0 is installed correctly, move on to the Exodriver. Download the source link on GitHub. Find the Exodriver download directory

  
$ cd path/to/exodriver
$ cd liblabjackusb/
   

Now edit the Makefile in a text editor to comment out (put a # sign in front of) this ARCHFLAGS line:

  
#ARCHFLAGS =
   

and uncomment (remove the # sign from) this ARCHFLAGS line two lines above it:

  
ARCHFLAGS = -arch i386 -arch x86_64
   

Now build and install the software

  
$ make clean
$ make
$ sudo make install
   

Verify that it worked by running:

  
$ file /usr/local/lib/liblabjackusb.dylib 
/usr/local/lib/liblabjackusb.dylib: Mach-O universal binary with 2 architectures
/usr/local/lib/liblabjackusb.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/usr/local/lib/liblabjackusb.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
   

Because libusb-1.0 and the Exodriver are built for the i386 architecture, 32-bit applications can load them.

Comments

#1

 

musz@musz-Aspire-5500Z:~/LabJackPython$ python

Python 2.7.2+ (default, Oct  4 2011, 20:03:08) 

[GCC 4.6.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import ue9

>>> d = ue9.UE9()

>>> d.configUE9()

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

AttributeError: 'UE9' object has no attribute 'configUE9'

>>> 

 

#2

That function is not available for the UE9.  You will want to use commConfig and controlConfig functions instead.  Most of the UE9 class' functions are based on the low-level functions, and the UE9 does not have a ConfigUE9 low-level function.  For a list of all available UE9 Python functions and documentation (which include some examples), look at the ue9.py source code, or use the Python help function on the UE9 class:

import ue9
help(ue9.UE9)

#3

For current and possibly new installations of the driver, please note the following:

 

 

In Ubuntu, and probably other distributions, there has been a change in:

/etc/udev/rules.d/10-labjack.rules

The SYSFS is being out-phased and replaced with ATTR, thus you might want to change this ASAP by editing the file.

You can check beforehand in the boot.log to see if the change apply to you. If it does, you will see some error messages regarding this.

 

#4

I changed the 10-labjack.rules file to use ATTR instead of SYSFS.  You
can find the updated file with the exodriver source code on github.

#5

Thanks for bringing this to our attention.  I'll look into this and see what kind of changes need to be made to the 10-labjack.rules file.

#6

Hey folks,

I'm upgrading an old Xcode project of mine for a U3 done a few years ago, and it seems I missed the memo with what got taken out on the way to Exodriver-land. What happened to u3.h, u3.c and all the functions they had such as getCaliInfo and such? If someone could provide me an upgrade guide, I'd appreciate it. My U3 is a 1.20 hardware version. I'd install the old drivers (tell me again why USB needs this stuff? I like the idea of libraries much more, thanks for moving in that direction) but I'd rather stay current, and it doesn't look like you have the old driver installer handy on this here web site.

 

Thanks. 

 

Dave

#7

API-wise not too much has changed, just the inner workings.  The C examples still exist that include the u3.c/h files, and can be found with the Exodriver source code located here: https://github.com/labjack/exodriver.  This isn't obvious on this page's documentation now that I read it, so I'll make a note to include this when we update the page next time.  The labjackusb.h header file has the version history which explains the changes.  In the U3's case some of the pipe defines changed.  Driver installation can now be done with source code or Mac installer.  If you would like the old driver e-mail support@labjack.com .

#8

Exodriver_NativeUSB_Setup does not work on Mac OS X 10.5.8.

Python generated this error when importing u3:

<class 'LabJackPython.LabJackException'>: Could not load the Exodriver driver. Ethernet connectivity only.

Check that the Exodriver is installed, and the permissions are set correctly.
The error message was: dlopen(liblabjackusb.dylib, 6): no suitable image found.  Did find:
    /usr/local/lib/liblabjackusb.dylib: unknown required load command 0x8000002

Compiling/installing Exodriver from the Quickstart instructions here solved the problem.

#9

 

The "unknown required load command" error has been fixed in the latest Mac OS X installer update.

 

#10

That Python exception occurs when the Exodriver is not installed.  As for Exodriver_NativeUSB_Setup not working, can you describe how it is not working or is there an error message?

#11

Minimum U3 hardware version not met for this kernel.  This driver supports only hardware 1.30 and above.  Your hardware version is 1.21.
This hardware version is supported under kernel 2.6.28.

 

Running under linux kernel 2.6.18-194 x64 (Centos5.5)... Get the above error when trying to run the u3BasicConfigU3 in the example directory.

 

Thoughts?

#12

The Exodriver is detecting that your U3 has hardware version 1.21, and that your Linux kernel is less than 2.6.28.  The Exodriver does not support U3 hardware versions 1.20 and 1.21 on Linux kernels less than 2.6.28.  There is a bug between these hardware versions and older kernels that require updating the kernel to fix.

For a full list of Exodriver requirements please refer to the INSTALL.Linux file.

#13

Update possibility Ubuntu?

On gizhub there are nice routines included for the El-1050 in u3.py. How to update the installation best?  the "build" directory is locked...

thanks

#14

Does the "sudo python setup.py install" not work?  That is the command for LabJackPython installation.  sudo should bypass the locked issues.  If for some reason files in the build directory are not being updated you could "sudo rm -R build" first to delete the build directory.

#15

thanks- I started later with the cookbook - skiped the install thing and went right to the labjackpython git...

Update actions should start from the beginning?

 

thanks

#16

"Update actions should start from the beginning?"

I am confused with your question here.  Running "sudo python setup.py install" will overwrite/update existing LabJackPython library files installed in your Python directory.

#17

Here it defaults (stops) - even if beginning from the start:

sudo git clone git://github.com/labjack/exodriver.git

 destination path 'exodriver' already exists and is not an empty directory

The github u3 code is from  February and I would like to use the I2C and El-1050 functions from it...

 

#18

"git clone" only works once for a repository.  If the repository's directories and files already exist on your computer you cannot use "git clone" again.  To update your files after a "git clone", go into the repository's directory (exodriver) and use the "git pull" command to update your files.  Alternatives to this are to delete the exodriver directory and perform the "git clone", or not use "git" all together and download the exodriver and LabJackPython source code from github (there is a "Downloads" button) and build/install from those.

#19

Thanks a lot - this is the answer to version a) "error: cannot open .git/FETCH_HEAD: Permission denied

version b) works neither since the exodriver directory is locked - you cannot delete even using sudo.

I think I need some Ubuntu specialist....

thanks

#20

after going deeper into linux - chmod allowed now to delete the folders and to start from scratch.

perfect

#21

The installation in ubuntu went exactly as you stated without problems, using the U3. We are now going on to the applications directory. We're somewhat new to python, so I hope we can figure it out. Thanks for all the work making this available in Linux.