================================================================================================= ACCES/IO Linux USB API Version 1.0 Released 2/09 ================================================================================================= The ACCES/IO Linux USB API provides an API that application programs running under a Linux operating system to utilize the functionality provided by any ACCES/IO data aquisition product with a USB interface to a host computer. The API should run under any standard Linux kernel greater than or equal to version 2.6. The API functions available are described in the ACCES/IO Software Reference Manual. (You can also look at the source code to see what they are) NOTE: Although the source code to the API is provided, it is not necesary to look at or modify it. You only need to make calls to the APIs functions, and include the API as part of your make/build process. The files included with this release, 'aiotest.c', and 'Makefile' give an example of how to do this. The API uses the open source library 'libusb' from www.libusb.wiki.sourceforge.net as it's USB interface to the USB subsystem in Linux. Libusb is a user-space API that allows applications to interface with USB devices without having to write or interface directly with kernel mode/device drivers. The ability to do all standard USB operations is provided by libusb. Libusb itself interfaces with the standard Linux USB Host Controller which is the actual USB device driver. This release of the ACCES/IO USB API includes libusb version 1.0 but any version greater than or equal to 1.0 should work. The version MUST be greater than or equal to 1.0 because that is where the asynchronous I/O capability was introduced into the library and the ACCES/IO USB API uses that capability. NOTE : that in the source forge source tree when the this ACCES/IO API was released the version of libusb 1.0 that was available was named 1.0, but actually was called libusb 0.9.3 when the release was un-tar'ed. The final version of 1.0 had not yet been released,but the ACCES/IO USB API has been fully tested and verified to be stable using 0.9.3. The figure below illustrates how your application program and the API fit together to communicate with an ACCES/IP product. -----------LINUX Workstation ----------------- *_Sample.c (one of the sample programs; replace with your application) | libusb | Linux USB Host Controller | USB-Hardware ------------------------------------------- | | USB cable | ----------------------- ACCESS/IO Product ------------------------ The release of the API contains the following : README.txt - the file you are reading now ReleaseNotes.txt - contains comments about the release(you should read this) aioUsbApi.h - header file for the API itslef aioUsbApi.c - C source file for the API itself makeAtoD - Makefile for the API and test program USB-DIO-32H.hex - firmware for the Acces I/O DIO_32 USB-DIO16H-16A.hex - firmware for the Acces I/O DO,DI,DIO_16H products acces.rules - udev rules file for hotplug of ACCES/IO products acceloader.sh - script called by hot plug system to load firwmware into ACCES/IO product fxload - standard EZ_USB utility to load firmware EZ_USB devices (for x86 machines) (Acces I/O products). If this version does not run on your machine download a version from the WEB that will. There are many sites where you can get it. Google 'fxload' to see them. DI_Sample.c - sample test program This is a sample program that receives data from the fast input bus of the board and writes the data to a file. DO_Sample.c - sample test program This is a sample program that sends data from a file to the fast output bus of the board DO_Sample_Roundup.c - sample test program This is a sample program that sends data from a file to the fast output bus of the board. It rounds up the input file size to a multiple of 512 bytes DIO_Slow.c - sample test program This is a sample program that allows to to write to and read from the slow output ports of the board. runDIsample - script to set libusb environment variable and run the DI_Sample program runDOsample - script to set libusb environment variable and run the DO_program program runDIOslow - script to set libusb environment variable and run the sample DIO_Slow sample program libusb.h - header file for libusb libusb-0.9.3.tar.bz2 - libusb 1.0 (ignore the version number 0.9.3) To use use this API follow the steps below : IMPORTANT NOTE : 1) You must complete steps 1-14 BEFORE connecting an ACCES/IO product to your computer since some of these setup the Linux hot-plug functionality for the ACCES/IO products 2) Make sure that /proc/decv/usb is mounted at boot time. This is needed by the script that is called by udev, and that loads the firmware into the Acces Devices when they are connected. Some Linux distributions do this be default, but if not you must do this by putting the appropriate mount command in your /etc/fstab file. 3) There are two Digital I/O Output sample programs DO_Sample.c, DO_Sample_Roundup.c DO_Sample_Roundup.c rounds the input file size to send up to a multiple of 512 bytes, AND you have to send at least 2 1024 bytes if you are connecting an Acces Digital Output card to an Acces Digital Input card (or DIO configured as output to DIO configured as input). This is a bug and will be fixed in a future release. DO_Sample.c does not round up the input file size to a multiple of 512 bytes, but the same limitation as above holds true. This will be fixed in a future release 1. Copy the file 'diousb-rX.Y-Z ' where you want to install the API (e.g. yourDir) X.Y is the release number, e.g. 1.1. Z is the date the release was made for example diousb-r.1-2-18-09 2. cd yourDir 3. tar -xzvf diousb-rX.Y-Z NOTE : a backup copy of the release tar file is included in the tar file 4. cp fxload /sbin 5. tar -xjzf libusb-0.9.3.tar.bz2 6. cd libusb-0.9.3 7. ./configure 8. make 9. make install 10. cd yourDir 11. cp acces.rules /etc/udev/rules.d 12. cp accessloader.sh /usr/share/usb 13. cp *.hex /usr/share/usb 14. make clean -f makeDO make clean -f makeDOroundup make clean -f makeDI make clean -f makeDIOslow 15. Connect the ACCES/IO product to your workstation 16. ./runDIsample ./runDOsample ./runDIOslow ./runDIOroundup IMPORTANT NOTE : You must complete steps 1-14 BEFORE the first time you unpack the release before connecting an ACCES/IO product to your computer since some of these setup the Linux hot-plug functionality for the ACCES/IO products After that you only need to do step 15 and 16 and connect the device before you run the sample programs There are two Digital I/O Output sample programs DO_Sample.c, DO_Sample_Roundup.c DO_Sample_Roundup.c rounds the input file size to send up to a multiple of 512 bytes, AND you have to send at least 2 1024 bytes if you are connecting an Acces Digital Output card to an Acces Digital Input card (or DIO configured as output to DIO configured as input). This is a bug and will be fixed in a future release. DO_Sample.c does not round up the input file size to a multiple of 512 bytes, but the same limitation as above holds true. This will be fixed in a future release For questions and/or support contact ACCES/IO at 858-550-9559