Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.4 KB

README.md

File metadata and controls

65 lines (48 loc) · 2.4 KB

aiousb-linux

aiousb is the Linux implementation of the ACCES I/O USB API as a linux kernel module and library.

Install needed packages

Deb type

apt install git cmake build-essential libudev-dev python3

Red Hat type

yum install git cmake python3-devel libudev-devel

Obtaining the source

git clone https://github.com/accesio/aiousb-linux

Build and install

mkdir build
cd build
cmake ..
make
sudo make install

Setting device permissions on module load

By default the device file requires root permissions to access. To change the default permissions for the device pass dev_mode to the module as a parameter. The mode can be passed in octal similar to chmod command

  • To set using insmod
insmod accesio_usb.ko dev_mode=0666
  • To set for boot
    • Create a file /etc/modprobe.d/accesio-usb.conf
    options accesio_usb dev_mode=0666
    

Using the library

To use the library include aiousb.h in your program. The first call into the library must be AiousbInit(). All of the functions are documented in the ACCES I/O USB API

The source code in the samples directory is intended as a guide. The source code in the test directory is not intended for general use.

Using the library with NO_HOTPLUG

It is possible to build the library without hotplug support by defining NO_HOTPLUG in the cmake command. This was done to address a known Python issue

cmake -DNO_HOTPLUG=y ..

When the library is built without hotplug support the behavior of calls to AiousbInit() after the first one will simulate a hotplug by checking for removed devices and then scanning for new ones. When the library is built with hotplug enabled (the default) then subsequent calls to AiousbInit() will return -EALREADY.

Known issues

Hotplug support breaks Python

Python support is limited, and in order to use it the cmake command must include -DNO_HOTPLUG when building the project. For more information on using the library in this mode see here.

Attempting to use the library in Python when hotplug support is enabled result in a failure when attempting to load the library. The ctypes.CDLL('./libaiousb.so') call will cause the program to crash.