May 25, 2015

Install and Test on Linux

Contents

Preample

"RingBuffer" is the new name for the BioSemi library that was formerly called "Labview_DLL". The new name was chosen to remove any inference that the library comes from or, is dependent on, the National Instruments "LabVIEW" product.

This software contains no kernel mode routines and runs entirely in user mode.

The BioSemi Linux software is distributed here in both prebuilt binary form - for Intel Linux 6.5 and later - and with a Makefile so that it can be rebuild to run with updated components.

The low level software needed to access the USB sample stream generated by the BioSemi acquisition hardware consists of 2 libraries:

Prebuild binary files are located in the "Linux32" and "Linux64" subdirectories. The first set of instructions below give the steps required to use these pre-built binary files, see Quick Start.

If these binary files don't work, try rebuilding them from the available source, see Slower Start.

Quick Start (for when "libusb" may be already installed)

If the program runs without reporting errors, a more permanent location for library "libRingBuffer" would remove the need to repeatedly modify "LD_LIBRARY_PATH". One possibility is to put the library in "/usr/local/lib" and make sure that /etc/ld.so.conf contains the line:

/usr/local/lib

Once this test program works, follow the instructions in Try Client/Server if you want to try the client/server mode of operation.

Some performance improvement may be gained by using the library parameters explained at Tuning.

Slower Start (for when "libusb" is missing)

For this install you will need the Linux Development Tools package. If the tools are not already installed, the command to do this on RedHat, CentOS and similar systems is:

yum groupinstall 'Development Tools'

If the program runs without reporting errors, a more permanent location for library "libRingBuffer" (and "libusb" if you had to build your own copy) would remove the need to repeatedly modify "LD_LIBRARY_PATH". One possibility is to put the library (or libraries) in "/usr/local/lib" and make sure that /etc/ld.so.conf contains the line:

/usr/local/lib

Once this test program works, follow the instructions in Try Client/Server if you want to try the client/server mode of operation.

Some performance improvement may be gained by using the library parameters explained at Tuning.

Merging with ActiView or Other Existing Application

Note:

To merge this new libRingBuffer with an existing version of BioSemi's ActiView program or other existing acquisition application:

Build the test program

To do this you need appropriate (32 or 64 bit) versions of "glibc-devel" and "libgcc" installed on your system:

Warning: don't do this procedure for both 64 bit and 32 bit software in the same login session. This procedure appends to paths defined in the environment. Serially appending both 64 and 32 bit items to the same environment variables will cause confusion.

Type "make".

This should build the ring buffer shared library (libRingBuffer) and a test program (RingBuffer_SyncTest) that uses this library for data acquisition.

If you get this message:

/usr/bin/ld: cannot find -lusb-1.0

this usually means that no version or a wrong version of "libusb-1.0" is installed. Versions installed by the "yum" commands above are usually run time versions of "libusb" and often don't include everything needed to perform a link operation. Sometimes there are "-devel" versions available to "yum" but, to be sure of what you are using, the best solution is usually to:

RingBuffer_SyncTest Usage

This program checks that the 0xffffff00 sync words appear in all the right places in the input stream. It stops with a message if they don't.

There can be 3 command line parameters for this program:

These parameters can be in any order or left out completely.

Hitting CTRL-C when the program is running will stop the run.

Develop a Program

To develop your own acquisition program using the RingBuffer library, see RingBufferLibrary-API for a description of the API's available.

The distributed software was compiled in both 32 and 64 bit modes on CentOS 6.5 (Linux 2.6.32) and was tested on CentOS 6.5 and CentOS 7 (Linux 3.10.0).

USB Access Permissions

In Linux, USB devices often have ownership and permissions set to restrict access to "root" only. This access must be opened whenever the BioSemi Receiver's cable is plugged into one of the computer's USB ports. This will happen automatically once you add a rule for this. Newer systems use "udev" or "udevadm" to do this; older systems use "hotplug".

udev

After the Biosemi Receiver cable is plugged into a USB port, run program "lsusb" (on CentOS 5, /sbin/lsusb) to determine the port being used.

We need world "read+write" access. The last 3 protection characters give world's access rights, here "r--" (CentOS6.5, CentOS7) or "---" (CentOS5).
To change this we must add a udev rule to open the port whenever the BioSemi cable gets plugged in.
To add this rule, follow these steps:

hotplug

An older system that was used for testing runs Redhat AS4, Linux 2.6.9. This system uses "hotplug" to control USB access. To open access to the USB port using "hotplug" perform the following steps, as "superuser".