Skip to content

IVT-Center/kvaser-linuxCAN

kvaser-linuxCAN

Linux drivers for Kvaser PCIeFD, PCIcan, PCIcanII, USBcanII, Leaf and Mhydra.

Interface Product Driver Name -----------+------------------------+------------- USB Leaf Light leaf ​ Leaf SemiPro ​ Leaf Professional ​ Memorator Professional ​ BlackBird -----------+------------------------+------------- miniPCIe Mini PCI Express HS leaf -----------+------------------------+------------- USB Eagle mhydra ​ BlackBird v2 ​ Memorator Pro 5xHS ​ USBcan Pro 5xHS -----------+------------------------+------------- USB USBcanII usbcanII ​ Memorator -----------+------------------------+------------- PCI PCIcan pcican ​ PCIcanx -----------+------------------------+------------- PCIe PCIEcan HS pcican ​ PCIEcan HS/HS -----------+------------------------+------------- PCIe PCIEcan 4xHS pciefd -----------+------------------------+------------- 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! Having versions of the linux headers installed other than that of ​ the currently running kernel may cause conflicts and faulty drivers.

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
    

    Note: All device drivers use the kvcommon driver. If you want to build and install only particular device drivers, you will first need to build and install the kvcommon driver from the linuxcan/common directory using the method above.

  • 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/

NOTE! Please read ReleaseNotes before using the driver.

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

About

Kvaser Linux Drivers & SDK.

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
COPYING
BSD-3-Clause
COPYING.BSD
GPL-2.0
COPYING.GPL

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published