Support Note

Driver and Hardware Installation Guide for Linux


This guide describes how to install Kvaser Hardware under Linux. System requirements: Linux 2.2, 2.4 or 2.6 (only 2.6 for USBcanII). The current driver only supports ONE USBcanII device and is not tested on SMP kernels.
1. Prerequisites. Make sure you have the right software tools to build Kvaser Linux CANlib. You will need the following:

- Linux kernel source tree configured for the kernel you are running.
- A kernel supporting modules.
- For PCIcan and PCIcan II: PCI support.
- For LAPcan and LAPcan II: PCMCIA Card Services support.
- The same C-compiler as used for the kernel build. PLease note that gcc 3.1 can produce a broken driver.


2. Download. Download the drivers from the Software Download Area [Support->Downloads].


3. Preparations. Close all programs that use a previously installed Linux CANLIB

4. Unpacking the archive. Unpack the drivers somewhere, e.g. in your home directory, using tar:

tar zxvf linuxcan.tar.gz

and cd into the linuxcan directory: 

cd linuxcan


5. Building the driver. This will build drivers for all supported hardware as well as the libraries and examples. Type:

make


6. Install the driver. On a RedHat-like system, installing is simply done by issuing a 

su 

followed by 

make install

This will perform the following tasks: The modules  
/lib/modules/`uname -r`/kernel/drivers/pcmcia/lapcan_cs.o i and  /lib/modules/`uname -r`/kernel/drivers/char/kvpcican.o will be copied. 
If you need the modules somewhere else, please edit the installscript_pcican.sh or installscript_lapcan.sh. 

For PCIcan. The lines:

alias pcican kvpcican
install kvpcican /usr/sbin/pcican.sh start
remove kvpcican /usr/sbin/pcican.sh stop 

will be added to /etc/modules.conf and the file pcican/pcican.sh will be copied to /usr/sbin/. This is a script that creates the device nodes for PCIcan and is invoked when the PCIcan driver is loaded/unloaded with modprobe.

For LAPcan. The file config/can is copied to /etc/pcmcia/. This script handles the device nodes for LAPcan when the card is inserted/removed.

The following lines are then added to /etc/pcmcia/config

device "lapcan_cs" class "can" module "lapcan_cs"
card "Kvaser LAPcan" manfid 0x01ee, 0x001d bind "lapcan_cs"
card "Kvaser LAPcan II" manfid 0x01ee, 0x0073 bind "lapcan_cs"

This states that the driver lapcan_cs.o shall be loaded when cards with the "manfid" of LAPcan/LAPcan II are inserted and the "can" script shall be run.


7. Library and header files. The Canlib user library libcanlib.so.1.x.y is installed in /usr/lib and links with the names libcanlib.so.1 and libcanlib.so are made. The header files canlib.h and canstat.h are installed in /usr/include and documentation plus examples are placed in /usr/doc/canlib.

7. Loading the driver. The PCIcan driver is loaded by running the command 

modprobe pcican. 

This command can be added to the /etc/rc.d/rc.local script to load the driver automatically at system boot.

For LAPcan, the driver is loaded automatically when the card is inserted.


8. Compiling Canlib programs. To use Canlib, include canlib.h & canstat.h and link with the canlib dynamic library. You can use the Makefile for the examples as a template. Located at /usr/doc/canlib/examples/Makefile.


Contact our Support Team.

Back to Support Notes Index >>

 


© Kvaser AB - All rights reserved | Contact us | Webmaster | Sitemap
Direct link to this page: