/*
** Copyright 2002-2015 KVASER AB, Sweden.  All rights reserved.
*/


- Linux drivers for Kvaser PCIEcan, PCIcan, PCIcan II, USBcanII,
  Leaf and Mhydra -

  Interface   Product                  Driver Name
 -----------+------------------------+-------------
  USB         Leaf Light               leaf
              Leaf SemiPro
              Leaf Professional
              Memorator Professional
              BlackBird
 -----------+------------------------+-------------
  USB         Eagle                    mhydra
              BlackBird v2
              Memorator Pro 5xHS
              USBcan Pro 5xHS
 -----------+------------------------+-------------
  USB         USBcanII                 usbcanII
              Memorator
 -----------+------------------------+-------------
  PCI         PCIEcan 4xHS             pciefd
 -----------+------------------------+-------------
  PCI         PCIcan                   pcican
              PCIcanx
              PCIEcan HS
              PCIEcan HS/HS
 -----------+------------------------+-------------
  PCI         PC104                    pcicanII
              PC104+
              PCIcan II
              PCIcanx II
 -----------+------------------------+-------------


System requirements:

* Linux 2.6 or later
* Header files and compiler for kernel compilation.
  In Ubuntu 14.04 e.g. this is accomplished by issuing the command:

    "sudo apt-get install build-essential"

  On some systems you may also need to issue:

    "sudo apt-get install linux-headers-`uname -r`"

NOTE! Read ReleaseNotes before using the driver.


Compilation:

* To build all drivers:

    "make"

  To install all drivers:

    "sudo make install"

* To build just a single driver, go to the corresponding subdirectory:

    "make"
    "sudo ./installscript.sh"

* To build with debug printouts:

    "make KV_DEBUG_ON=1"

Debug levels and some other settings may be changed in config.mak.


Usage:

* USBcanII, Leaf and Mhydra will load/unload when inserting/removing the device
* For PCI-drivers (pciefd, pcican, and pcicanII), use modprobe to load and
  unload the drivers, e.g.:
    "modprobe pcican" to load pcican driver, and
    "modprobe -r pcican" unload pcican driver.
* Try examples in /usr/doc/canlib/examples/


Installed Files:

* Driver modules
----------------------------------
/lib/modules/`uname -r`/kernel/drivers/char/kvpciefd.ko     (PCIEcan)
/lib/modules/`uname -r`/kernel/drivers/char/kvpcican.ko     (PCIcan)
/lib/modules/`uname -r`/kernel/drivers/char/kvpcicanII.ko   (PCIcanII)
/lib/modules/`uname -r`/kernel/drivers/char/kvvirtualcan.ko (Virtualcan)
/lib/modules/`uname -r`/kernel/drivers/usb/misc/usbcanII.ko (USBcanII)
/lib/modules/`uname -r`/kernel/drivers/usb/misc/leaf.ko     (Leaf)
/lib/modules/`uname -r`/kernel/drivers/usb/misc/mhydra.ko   (Mhydra)

* Module setup
----------------------------------
On CentOS, RedHat, RHEL, Fedora and simlar systems, the following lines are
added to /etc/modprobe.conf, on Debian, Ubuntu, Trisquel and similar systems
they are added to /etc/modprobe.d/kvaser.conf.

for PCIEcan:

    alias pciefd kvpciefd
    install kvpciefd /usr/sbin/pciefd.sh start
    remove kvpciefd /usr/sbin/pciefd.sh stop

for PCIcan:

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

for PCIcan II:

    alias pcicanII kvpcicanII
    install kvpcicanII /usr/sbin/pcicanII.sh start
    remove kvpcicanII /usr/sbin/pcicanII.sh stop

for Virtualcan:

    alias virtualcan kvvirtualcan
    install virtualcan /usr/sbin/virtualcan.sh start
    remove kvvirtualcan /usr/sbin/virtualcan.sh stop

In the same files, the following lines are added to blacklist SocketCAN:

    blacklist kvaser_usb
    blacklist kvaser_pci

* Module loading
----------------------------------
/usr/sbin/pciefd.sh      (start/stop pciefd driver;      by modprobe or manually)
/usr/sbin/pcican.sh      (start/stop pcican driver;      by modprobe or manually)
/usr/sbin/pcicanII.sh    (start/stop pcicanII driver;    by modprobe or manually)
/usr/sbin/virtualcan.sh  (start/stop virtualcan driver;  by modprobe or manually)
/usr/sbin/usbcanII.sh    (start/stop usbcanII driver;    by udev or manually)
/usr/sbin/leaf.sh        (start/stop leaf driver;        by udev or manually)
/usr/sbin/mhydra.sh      (start/stop mhydra driver;      by udev or manually)

* Module hotplug support
----------------------------------
If /etc/hotplug exists:
/etc/hotplug/usbcanII.usermap
/etc/hotplug/usb/usbcanII
/etc/hotplug/leaf.usermap
/etc/hotplug/usb/leaf
/etc/hotplug/mhydra.usermap
/etc/hotplug/usb/mhydra

/etc/udev/rules.d/10-kvaser.rules

* Include files for canlib library
----------------------------------
/usr/include/canlib.h
/usr/include/canstat.h

* Canlib library and links
----------------------------------
/usr/lib/libcanlib.so
/usr/lib/libcanlib.so.1.1.0
/usr/lib/libcanlib.so.1

* Canlib documentation
----------------------------------
/usr/doc/canlib/HTMLhelp

* Canlib examples
----------------------------------
/usr/doc/canlib/examples

* Canlib Makefile template
----------------------------------
/usr/doc/canlib/examples/Makefile
