Linux CANlib SDK

The Kvaser Linux Drivers and Software Development Kit are everything you need to get started.

This package contains our drivers and SDK for developing in a Linux environment. Everything you’ll need to get started is included in one place. The SDK includes virtual hardware, virtualcan, that can do just about everything our real hardware can. Download the Linux SDK and begin developing for Kvaser hardware right away. Once you get a Kvaser interface, you can seamlessly transition from the virtual driver to our real hardware. Download our drivers and SDK and get started today.

General SDK Contents

  • Getting-started and reference documentation
  • Example programs
  • Supports virtual (non-hardware) CAN channels which you can use for test or demo purposes.
  • Includes drivers for Kvaser CAN and LIN interfaces.
  • Support libraries for LIN.
  • See more information on libraries below.

Software written using CANlib provides compatibility with present and future hardware from Kvaser. The Linux CANlib API is designed to make porting Windows applications to Linux platforms as seamless as possible.


CANlib SDK Libraries

CANlib – The first library is CANlib, and this is used to interact with Kvaser CAN devices connected to your computer and the CAN bus. At its core you have functions to set bus parameters (e.g. bit rate), go bus on/off and read/write CAN messages. You can also use CANlib to download and start t programs on supported devices.

LINlib – The LINlib library is used to interact with Kvaser LIN devices. Similar to CANlib, it holds functions to set bus parameters, go bus on/off and read/write LIN messages.

Additional Libraries

Additional resources can be downloaded via the Linux SDK Library which adds the following libraries:

kvmlib – The Memorator library kvmlib is used to interact with Kvaser Memorator devices that can record CAN messages, e.g. Kvaser Memorator Professional 5xHS. You can download configuration data (e.g. triggers, filters, scripts) allowing you to disconnect the device from your computer, connect the device to a (powered) CAN bus and let it record the traffic autonomously. When done, you can reconnect the device with your computer and use kvmlib to read the recorded data.

kvaMemoLibXML – The kvaMemoLibXML is used to convert XML formatted logger settings into a binary format used by Kvaser Memorator devices. The binary settings file can then be downloaded to a Kvaser Memorator device using the kvmlib mentioned above. With the help of kvaMemoLibXML and kvmlib, you can create your own tool for configuring Kvaser Memorator devices.

kvaDbLib – The database library kvaDbLib is used for creating, reading, writing and modifying CAN databases (.dbc files). These .dbc files hold message and signal definitions for translating raw CAN frames to physical signal values.

kvlclib – The converter library kvlclib is used for converting Kvaser Memorator log files. It can be used to convert between a number of formats, e.g. from Kvaser binary format KME 5.0 (.kme50) to CAN frames in MDF 4.1 (.mf4).

SocketCAN

SocketCAN is a set of open source CAN drivers and a networking stack, and is included in many Linux distributions. Many Kvaser CAN interfaces are supported by SocketCAN, including Leaf, USBcan, and PCI cards. Additional information about using SocketCAN can be found below in the Support section.

Windows Support

Support for Windows is available as a separate download, see our CANlib SDK page for more.

More Information


Support

Here’s some simple troubleshooting tips that might help.

My drivers aren't installing properly.

You may have multiple headers and need to remove headers that aren’t your current build of Linux’s headers. You can remove old headers with a few simple commands. Open a terminal and issue this command.

dpkg -l | grep linux-headers | '{print}'

The terminal should now list what headers are currently on your system. To remove headers, use this command.

sudo apt-get purge linux-headers-HeaderVersionNumber

This will delete the old header file. For instance, my current build of Linux is 3.19.0-25, but I have headers for 3.19.0-23 as well. In order to make sure I install the Kvaser drivers correctly, I need to delete 3.19.0-23 with this command.

sudo apt-get purge linux-headers-3.19.0-23

When I try to install the drivers I keep getting "Permission Denied".

If you chose to extract the file another way than using the tar command, it may cause an issue with permissions where the install will be denied. To fix this, go to each folder and right click the installscript.sh file and select properties. Under the Permissions tab there is a checkbox for permission to execute. If you extract as we show in the video, this checkbox will automatically be checked, but other methods may cause this checkbox to be unchecked. So make sure the “run as executable” checkbox is checked in each folder if you’re having issues installing the drivers.

Permissions example

SocketCAN isn't recognizing my device.

If you’ve already installed our Linux Drivers & SDK, then SocketCAN will be blacklisted so as not to conflict with our drivers. In order to reverse this, you can uninstall our Linux Drivers & SDK. Please contact support if you need more information on this issue.

Where can I find a full list of supported devices for SocketCAN?

The official Linux documentation on supported devices is available at elinux.org but you can find the full list of supported Kvaser devices sorted by which version the support was added below.

5.4

  • Kvaser Mini PCI Express HS v2
  • Kvaser Mini PCI Express 2xHS v2
  • Kvaser PCIEcan HS v2
  • Kvaser PCIEcan 2xHS v2
  • Kvaser PCIEcan 4xHS

4.19

  • Kvaser Leaf Pro HS v2
  • Kvaser Hybrid 2xCAN/LIN
  • Kvaser Hybrid Pro 2xCAN/LIN
  • Kvaser Memorator 2xHS v2
  • Kvaser Memorator Pro 2xHS v2
  • Kvaser Memorator Pro 5xHS
  • Kvaser USBcan Light 4xHS
  • Kvaser USBcan Pro 2xHS v2
  • Kvaser USBcan Pro 5xHS

4.7

  • Kvaser Mini PCI Express 2xHS
  • Kvaser USBcan Light 2xHS

3.16

  • Kvaser Leaf Light HS v2
  • Kvaser Mini PCI Express HS

3.8

  • Kvaser Leaf Light HS
  • Kvaser Leaf Light GI
  • Kvaser Leaf Professional HS
  • Kvaser Leaf Professional LS
  • Kvaser Leaf Professional SWC
  • Kvaser Leaf SemiPro HS
  • Kvaser Leaf SemiPro LS
  • Kvaser Leaf SemiPro SWC
  • Kvaser Memorator Professional HS/HS
  • Kvaser Memorator Professional HS/LS
  • Kvaser USBcan Professional HS/HS
  • Kvaser USBcan R

2.6.31

  • Kvaser PCIcan
  • Kvaser PCIcanx
  • Kvaser PCIEcan HS
  • Kvaser PCIEcan HS/HS

Recent Developer Blogs:

kvrdevbloglogofinalblack
20/09/2018

Running Python wrapper on Linux

This is an update of an older blog post and is now taking advantage of the Python canlib package v1.6… Read More

Read More
05/06/2017

Build and install signed Kvaser driver modules

This is the second post in a 2-part series about Secure Boot and signing modules on Linux: Secure Boot on… Read More

Read More
29/05/2017

Secure Boot on Linux systems

This is the first post in a 2-part series about Secure Boot and signing modules on Linux: Secure Boot on… Read More

Read More

Recent Linux Articles:

Beta version Linux driver available for Kvaser’s wireless and Ethernet ranges
27/02/2024

Beta version Linux driver available for Kvaser’s wireless and Ethernet ranges

Responding to a growing customer base using Linux, Kvaser has developed a Linux driver to connect to and control Kvaser’s… Read More

Read More
Kvaser’s September 2023 Software Release
28/09/2023

Kvaser’s September 2023 Software Release

Kvaser’s September software update is live. Please visit our Downloads page for the latest release notes.   The Kvaser CANlib… Read More

Read More
Kvaser’s May 2023 Software Release
22/05/2023

Kvaser’s May 2023 Software Release

Kvaser’s latest software release provides support for Kvaser’s redesigned PCI cards, improved handling of multiple time domains in Python and… Read More

Read More

Debug on...