Thursday, February 3, 2011

Gentoo and GPIB (IEEE 488.2) device control: sci-libs/linux-gpib

Most of you will probably never have heard of the GPIB (IEEE 488.2) bus before. It's a pretty ancient (1960!), but robust parallel bus for addressing lab measurement equipment, which now supports up to 8 Mbyte/s. A clear specialist application, but one that is common for example in university labs all across the world. A typical PCI adapter card costs somewhere around €1k, a typical 3m cable (heavily shielded) somewhere around €250, but then, in many cases the attached hardware is far more expensive.

Under Linux, there are basically two ways to adress GPIB hardware:

As much of the hardware is bought from National Instruments, one is the proprietary National Instruments VISA driver stack on top of NI's GPIB hardware driver. This works very reliable (once it's installed), supports e.g. LabView for Linux (eurgh), and NI is actively developing drivers for (some of its) hardware. So much for the good sides. Here are it's disadvantages:
  1. installation is basically doing its own package management, only very few (mostly outdated) linux distributions are really supported and trying others can be a serious pain, and the entire installation process is fundamentally incompatible with portage (I've been trying to beat it into an ebuild for a while and this is a sure way to madness); 
  2. since the Linux kernel USB interface is declared GPL-only, no GPIB-USB devices are supported since kernel 2.6.24.
For those trying to use the excellent NI GPIB-USB interfaces in their labs, even NI employees point to the second option: the open-source (GPL) linux-gpib package. While its development has stalled in terms of features, it supports the usual hardware fine and interfaces even with most recent kernels, and the author wants to maintain it further to that effect. For this package, we now have an ebuild in Gentoo: sci-libs/linux-gpib. It is still package-masked since the installation needs testing. While we do have the required hardware in our labs, I have not had a chance to set up an entire Gentoo system there for it. But- if you have been working with linux-gpib and maybe even with one of the inofficial ebuilds before, please give it a try and report your experiences on bug 165399.

As a final remark, probably the best possible support would be to combine the open-source linux-gpib hardware driver with the NI VISA intermediate layer. Unfortunately, this would mean linking a GPL library and proprietary code, so no-go. At least as long as nobody budges...

1 comment:

  1. You might also be interested in some Python bindings and instrument measurement framework.