Linux Drivers and SDK

Full Transcript

Welcome to the Kvaser Linux Driver and SDK installation guide. In this video we will show you how to build and install our Kvaser Linux Driver and SDK.

For our demonstration we’ll be using Ubuntu’s latest Long Term Support version of the operating system, 14.04.3.

[Getting Started]

Before we can begin we’ll need to grab the latest version of our Kvaser LINUX Driver and SDK. We’ve provided an annotation in the video so you can click to automatically start the item downloading without having to leave the video. Alternatively, you can visit this URL to download the necessary files. ( http://www.kvaser.com/go/0004/linux )

Open a Terminal window. Then use the change directory command to move to the directory containing linuxcan.tar.gz. Once there, extract the file by typing, “tar -xvzf linuxcan.tar.gz”

[Installing Kernel Header Files]

Now we need to download and make the kernel header files available to the compiler. We can do this by typing “sudo apt-get install build-essential”. Some systems may need to use the command “sudo apt-get install linux-headers-`uname -r`”. Note, if you have versions of the Linux headers installed other than that of the currently running kernel, the headers may cause conflicts and faulty drivers.

[Installing All Drivers]

From the linuxcan folder, we can now build the drivers, and install them. To build the drivers we’re going to type “make” into the terminal. Once everything has been built, we need to type “sudo make install”. This will install all of the drivers at once.

[Installing Individual Drivers]

You can also install specific drivers rather than installing them all at once. However, since all device drivers use CANlib and the kvcommon driver you will need to build and install these first. To install CANlib, move to the canlib directory and type “make”, then type “sudo make install”. Next, move to the common directory and type “make” and then install the kvcommon driver with “sudo ./installscript.sh”. Once kvcommon is installed, you can change directory to any driver you want to install and type “make” to build. Then type “sudo ./installscript.sh” to install that driver. Just make sure you have installed CANlib and the kvcommon driver first.

[Installing Debug Version]

If you want to build a debug version of the drivers, you can type “make KV_Debug_ON=1” where we would normally use “make” in the steps we just covered.

[Test]

Now that we’ve installed our drivers, we want to test to make sure they’ve installed properly by using the examples included in CANlib. Before beginning, make sure that you have a Kvaser device connected to your computer. For our example we will be using a Leaf Light v2. Then change directory to canlib/examples. Type “./listChannels” and if we’ve installed the drivers correctly, the terminal should list the number of channels available on the bus.

[Loading and Unloading Drivers Manually]

USB interfaces, like the Leaf Light v2 we just used in our test, will automatically load and unload the drivers when the devices are inserted or removed from the PC. However, for virtualcan or interfaces that connect via PCI port, you need to load the drivers manually before use. To do this, type “sudo modprobe” and then the name of the driver you need to load. For our example we will load the virtualcan driver by typing “sudo modprobe virtualcan”. If we run listChannels again we can see that two virtualcan channels are now listed with the Leaf Light v2.


The Kvaser Linux Drivers and Software Development Kit are everything you need to 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 a virtual hardware, virtualcan, that can do just about everything our real hardware can.

Download the Linux SDK and begin developing for any Kvaser hardware right away. Once you get a Kvaser interface you can seamlessly transition from the virtual driver to our real hardware. So download our drivers and SDK and get started today.

Get the SDK

Download Drivers and Software Development Kit

Download

Having Trouble?

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
Contact Us

More Questions?

Feedback