Need Kvaser driver that is not available in latest source kernel

Hello,

I need a module for Kvaser Mini PCI Express 2xHS (https://www.kvaser.com/product/kvaser-mini-pci-express-2xhs-3/)

Elinux mentioned kvaser_pci & kvaser_usb are the two drivers for Kvaser products CAN Bus - eLinux.org

I installed these two modules, but it did not recognize my Kvaser device. I looked further into the Kconfig file in

kernel_src/kernel/kernel-4.4/drivers/net/can/usb/Kconfig

from the latest L4T TX2 kernel source, and they did not mention this device under config CAN_KVASER_USB

However, the Kconfig file in this public repo here, and they have more latest changes for the kvaser_usb module that includes the device I am using.
https://github.com/torvalds/linux/blob/master/drivers/net/can/usb/Kconfig

I use Linux but I don’t have that “linux from scratch” skill. So can anyone advise what is my option to get more latest changes for this particular module?

Thank you in advance!

Hi,
TX2 r28.2.1 is at K4.4 and it looks like the driver is added in later kernel version.
[url]https://github.com/torvalds/linux/commit/71873a9b38d1cc6c93e2962149a7bb7272a7cb66#diff-b7df765f713d9b1d4c3b55d1b00a0ade[/url]

You have to fetch all commits, cherry-pick them to K4.4 and try.
Please also consider Xavier r31.1, which is at K4.9.

@DaneLLL: Thank you. The files provided in your link works.

For anyone facing the same, I download the kvaser_usb.c file in the link from DaneLLL, and build module per this post https://superuser.com/questions/513656/update-single-kernel-module-driver.
Back-up the old kvaser_usb.ko in

/lib/modules/your-kernel-version/kernel/drivers/net/can/usb

and replace it with the new built kvaser_usb.ko file. Then reboot.
This driver does not recognize the device automatically if checking on ifconfig -a, so I had to bring up the driver with:

sudo modprobe can_dev
sudo modprobe kvaser_usb

Then the two CAN channels show up.

1 Like

Sometimes running “sudo depmod -a” will do the trick to make a module show up automatically when needed.

@linuxdev: Thanks. That seems working.

I use kvaser usb can light on tx2 , installed the Linux can driver successfully from kvaser website, but has below :

I use lsusb command will show:
Bus 001 devoce 004:ID 0bfd:0123 kvaser AB

when use ifconfig command
there is no can list in the list.

this is the kvaser use-can, did anyone in this loop know how to make it work? Thanks.

A few commands to check ifconfig -a & lsmod | grep kvaser to see if any CAN device or kvaser driver is loaded.

To have the device show in ifconfig, you need to set up the device with baudrate. For example 500K:

sudo ip link set can0 type can bitrate 5000000
sudo ip link set up can0

If you got complain from the set up step that can0 does not exist and lsmod command did not return back with any loaded kvaser module, that means your system does not recognize the Kasver Light yet as a CAN device. My suspicion for that is because the tegra kernel for TX2 that you currently use does not have kvaser_can driver automatically loaded. So there are two other options from here.

Option 1: You said you successfully compiled the Kvaser Linux driver provided by Kvaser website. You should go ahead running some sample scripts that they provide to see if that works.

Option 2: Build the kvaser_usb module if it does not exist, but you need to remove the Kvaser driver from Kvaser website first since they may conflict to each other.

When I did this and still do now, option 2 was my only option to use with TX2 because I ran into major compiling error with the Kvaser Linux driver from Kvaser website.

yes ,it doesn’t exist can0 I’m a beginner, can you help explain how to remove kvaser driver, and how to build kvaser_usb modle. which commands and location can be used?
thanks very much

Depends on how you installed the package, if you did “sudo make install” for the entire driver package, I’m not quite sure how to reverse that process easily
maybe trying “make uninstall” or “sudo make uninstall”. If you installed only the driver that you need, for example “leaf”, check in the leaf folder there is a “uninstall.sh” script that you can use.

Then you can try to follow the tips here to install the kvaser_usb driver: