Linux driver compiled with NETDEV_SUPPORT, but no can0 dev

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
Hartmut Hoss
Posts: 3
Joined: Fri 1. Feb 2019, 18:03

Linux driver compiled with NETDEV_SUPPORT, but no can0 dev

Post by Hartmut Hoss » Fri 1. Feb 2019, 18:23

Hi,
after compiling and installing the linux driver, pcanview runs on Ubuntu, but I can't use my PCAN-USB-adapter with can-utils/socketcan (no device can0). Compiling with "make -C driver NET=NETDEV_SUPPORT" doesn't help: pcanview runs, but there is still no device can0 or vcan. For some reason, the PCAN driver for Linux works, buts fails to install the the netdev interface.
Does anyone have an idea what's missing? Please find more details in the attached logfile.
Many thanks and best regards,
Hartmut Hoss
Attachments
peak-linux-driver.log
Logfile make and install
(8.87 KiB) Downloaded 406 times
Last edited by Hartmut Hoss on Sat 2. Feb 2019, 14:01, edited 1 time in total.

Hartmut Hoss
Posts: 3
Joined: Fri 1. Feb 2019, 18:03

Re: Linux driver compiled with NETDEV_SUPPORT, but no can0 d

Post by Hartmut Hoss » Sat 2. Feb 2019, 11:45

P.S.: some additional information:
Running "make -C driver NET=NETDEV_SUPPORT" in folder "peak-linux-driver-8.7.0" works, but "make NET=NETDEV_SUPPORT" fails with error message "src/pcan-settings.c:53:10: fatal error: popt.h: No such file or directory".
Running "sudo make -C driver install" works, but "sudo make install" fails with the following message:

Code: Select all

Info: /lib/modules/4.15.0-45-generic/misc exists.
Info: Left current 'pcan'-entry in /etc/modprobe.d/pcan.conf untouched.
Info: Copied 45-pcan.rules to /etc/udev/rules.d.
Info: mainline drivers removed and blacklisted in
      /etc/modprobe.d/blacklist-peak.conf
make[1]: Leaving directory '/m/peak_systems/peak-linux-driver-8.7.0/driver'
make[1]: Entering directory '/m/peak_systems/peak-linux-driver-8.7.0/lib'
mkdir -p /usr/lib
cp -d lib/* /usr/lib
if [ -d lib32 ]; then \
	mkdir -p /usr/lib32; \
	cp -d lib32/* /usr/lib32; \
fi
mkdir -p /usr/include
chmod 644 libpcan.h libpcanfd.h
cp libpcan.h libpcanfd.h /usr/include
/sbin/ldconfig
make[1]: Leaving directory '/m/peak_systems/peak-linux-driver-8.7.0/lib'
make[1]: Entering directory '/m/peak_systems/peak-linux-driver-8.7.0/test'
cp receivetest transmitest bitratetest filtertest pcanfdtst pcan-settings /usr/local/bin
cp: cannot stat 'pcan-settings': No such file or directory
Makefile:165: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/m/peak_systems/peak-linux-driver-8.7.0/test'
Makefile:92: recipe for target 'install' failed
make: *** [install] Error 2
I guess: "make -C driver NET=NETDEV_SUPPORT" (or "cd driver ; make NET=NETDEV_SUPPORT") builds the chardev drivers only. Building the test target with "make NET=NETDEV_SUPPORT" is required, but fails with "

Code: Select all

src/pcan-settings.c:53:10: fatal error: popt.h: No such file or directory
Maybe there's just an include path missing in the makefile?

Hartmut Hoss
Posts: 3
Joined: Fri 1. Feb 2019, 18:03

Re: Linux driver compiled with NETDEV_SUPPORT, but no can0 d

Post by Hartmut Hoss » Sat 2. Feb 2019, 12:28

Coming closer :D The missing popt.h can be installed by

Code: Select all

sudo apt-get install libelf-dev
sudo apt-get install libpopt-dev
After that, "make NET=NETDEV_SUPPORT" and "sudo make install" work without any errors. And after

Code: Select all

sudo modprobe pcan
sudo modprobe can
sudo modprobe vcan
sudo modprobe slcan
sudo ip link set can0 type can
sudo ip link set can0 up type can bitrate 125000
there is a "can0" link:

Code: Select all

ip -details link show can0
3: can0: <NOARP,UP,LOWER_UP> mtu 16 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE restart-ms 0 
	  bitrate 125000 sample-point 0.875 
	  tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
	  pcan: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
	  clock 8000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
Time to proceed with ros_canopen using the socketcan-interface :D
Maybe a small hint in the manual PCAN-Driver-Linux_UserMan_eng.pdf would be nice, something like: "run make NET=NETDEV_SUPPORT and when you encounter a missing popt.h error, just install popt with sudo apt-get install libpopt-dev and repeat." Just in case ;)

Post Reply