May 25, 2015
"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.
export LD_LIBRARY_PATH=`pwd`:`pwd`.lib:$LD_LIBRARY_PATHNote: Including the ".lib" reference is harmless if it is not needed.
./RingBuffer_SyncTestUse CTRL-C to stop the test. See the RingBuffer_SyncTest Usage section below for more information about this program.
If you get this message:
If you get this message:
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.
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'
"yum info libusb.x86_64" (for the 64 bit version) "yum info libusb.i686" (for the 32 bit version)
"apt-get policy libusb.x86_64" (for the 64 bit version) "apt-get policy libusb.i686" (for the 32 bit version)
"yum install libusb.x86_64" (for 64 bit) "yum install libusb.i686" (for 32 bit)
"apt-get install libusb.x86_64" (for 64 bit) "apt-get install libusb.i686" (for 32 bit)
For your convenience the source code for version "libusb-1.0.19" (the latest, May 2015) is included in this download. Newer versions may be available at the web address http://sourceforge.net/projects/libusb.
To do this compile you need appropriate (32 or 64 bit) versions of "glibc-devel" and "libgcc" installed on your system: "glibc-devel.i686" and "libgcc.i686" for 32 bit or "glibc-devel.x86_64" and "libgcc.x86_64" for 64 bit.
To compile the included copy of "libusb" use this command:
. ./compile_libusb.shThe compile will create two new subdirectories (lib and include).
Use the supplied test program "RingBuffer_SyncTest".
This program must be able to find the two shared libraries, "libRingBuffer" and "libusb". The following command will add two possible locations to the library search list:
export LD_LIBRARY_PATH=`pwd`:`pwd`.lib:$LD_LIBRARY_PATHNote: Including the ".lib" reference is harmless if it is not needed.
To run the test program, plug the Biosemi Receiver's USB cable into the computer and type:
./RingBuffer_SyncTestUse CTRL-C to stop the test. See the RingBuffer_SyncTest Usage section below for more information about this program.
If you get this message:
If you get this message:
If the supplied version of "RingBuffer_SyncTest" just won't run on your Linux version, try doing the Build the test program step below and then repeat this Test your installation step.
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.
Note:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
ldd /usr/local/lib/liblvrt.so.8.5showed that libGL.so.1, libX11.so.6 and libXext.so.6 were missing. This command:
yum whatprovides libGL.so.1showed that "mese-libGL-10.1.2-2.e16.i686" was needed. Using this command:
sudo yum install mesa-libGL-10.1.2-2.e16.i686and repeating the above "ldd" command showed that all missing packages were now installed.
To merge this new libRingBuffer with an existing version of BioSemi's ActiView program or other existing acquisition application:
If the application is looking for a liblabview_dll library, copy and rename the libRingBuffer file and use that instead.
To do this you need appropriate (32 or 64 bit) versions of "glibc-devel" and "libgcc" installed on your system:
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:
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:
Hitting CTRL-C when the program is running will stop the run.
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).
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".
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.
Bus 002 Device 010: ID 0547:1005 Anchor Chips, Inc. Bus 006 Device 002: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubLook for a device with ID 0547:1005, perhaps also labelled "Anchor Chips, Inc.". Take the bus and device numbers (here 002 and 010) and use them like this:
dir -l /dev/bus/usb/002/010The dir output looks something like this:
crw-rw-r--. 1 root root 189, 137 May 13 08:10 /dev/bus/usb/002/010This shows the BioSemi receiver's USB port's protection settings.
Bus 003 Device 001: ID 0000:0000 Bus 004 Device 001: ID 0000:0000 Bus 007 Device 001: ID 0000:0000 Bus 005 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 Bus 008 Device 001: ID 0000:0000 Bus 002 Device 001: ID 0000:0000 Bus 002 Device 003: ID 0547:1005 Anchor Chips, Inc. Bus 006 Device 001: ID 0000:0000 Bus 006 Device 002: ID 046d:c018 Logitech, Inc. Optical Wheel MouseLook for a device with ID 0547:1005, perhaps also labelled "Anchor Chips, Inc.". Note the bus and device numbers (here 002 and 003) and then do this:
dir -l /dev/usb*In the dir output look for something like this:
crw------- 1 root root 442, 0 May 19 12:12 /dev/usbdev1.1_ep00 crw------- 1 root root 442, 0 May 19 12:12 /dev/usbdev1.1_ep81 crw------- 1 root root 442, 2048 May 19 12:12 /dev/usbdev2.1_ep00 crw------- 1 root root 442, 2048 May 19 12:12 /dev/usbdev2.1_ep81 crw------- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep00 crw------- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep01 crw------- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep06 crw------- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep81 crw------- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep82 crw------- 1 root root 442, 4096 May 19 12:12 /dev/usbdev3.1_ep00 crw------- 1 root root 442, 4096 May 19 12:12 /dev/usbdev3.1_ep81 crw------- 1 root root 442, 6144 May 19 12:12 /dev/usbdev4.1_ep00 crw------- 1 root root 442, 6144 May 19 12:12 /dev/usbdev4.1_ep81 crw------- 1 root root 442, 8192 May 19 12:12 /dev/usbdev5.1_ep00 crw------- 1 root root 442, 8192 May 19 12:12 /dev/usbdev5.1_ep81The lines containing usbdev2.3 show the protection for the BioSemi device's USB port.
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:
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="biosemi_rules_end" # biosemi usb receiver ATTR{idVendor}=="0547", ATTR{idProduct}=="1005", MODE="0666" ATTR{idVendor}=="0547", ATTR{idProduct}=="1005", SYMLINK+="biosemi" ATTR{idVendor}=="04b4", ATTR{idProduct}=="8613", MODE="0666" ATTR{idVendor}=="04b4", ATTR{idProduct}=="8613", SYMLINK+="biosemi2" LABEL="biosemi_rules_end"
udevadm control --reload-rules udevadm control --start-exec-queue
/sbin/udevcontrol reload_rules /sbin/udevstart (or sometimes: /sbin/start_udev)
crw------- 1 root root 442, 0 May 19 12:12 /dev/usbdev1.1_ep00 crw------- 1 root root 442, 0 May 19 12:12 /dev/usbdev1.1_ep81 crw------- 1 root root 442, 2048 May 19 12:12 /dev/usbdev2.1_ep00 crw------- 1 root root 442, 2048 May 19 12:12 /dev/usbdev2.1_ep81 crw-rw-rw- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep00 crw-rw-rw- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep01 crw-rw-rw- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep06 crw-rw-rw- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep81 crw-rw-rw- 1 root root 442, 2050 May 19 12:12 /dev/usbdev2.3_ep82 crw------- 1 root root 442, 4096 May 19 12:12 /dev/usbdev3.1_ep00 crw------- 1 root root 442, 4096 May 19 12:12 /dev/usbdev3.1_ep81 crw------- 1 root root 442, 6144 May 19 12:12 /dev/usbdev4.1_ep00 crw------- 1 root root 442, 6144 May 19 12:12 /dev/usbdev4.1_ep81 crw------- 1 root root 442, 8192 May 19 12:12 /dev/usbdev5.1_ep00 crw------- 1 root root 442, 8192 May 19 12:12 /dev/usbdev5.1_ep81
./RingBuffer_SyncTest 10
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".
usbbiosemi 0x0003 0x0547 0x1005 0 0 0 0 0 0 0 0 0
#!/bin/bash if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then chown root "${DEVICE}" chgrp root "${DEVICE}" chmod 666 "${DEVICE}" fi
chmod a+x /etc/hotplug/usb/usbbiosemi
./RingBuffer_SyncTest 0