USB to CANv2 Professional on Raspberry Pi CM4 and Ubuntu Server 64 Bit

Hi,
I am still using USB-to-CAN v2 professional on Raspberry modules. You helped me out some time ago with my setup here:
USB-to-CAN v2 Professional with Debian on a Raspberry Pi 4 - Ixxat Support / USB To CAN - hms.how (hms-networks.com)

Now the needed setup has changed a bit. We are now using Raspberry Pi CM4 which should not make a big difference and Ubuntu Server 64 Bit instead of Debian with a Kernel 5.19.0-1014-raspi.

The headers should be installed. apt list linux-headers-$(uname -r) provides:
linux-headers-5.19.0-1014-raspi/kinetic-updates,kinetic-security,now 5.19.0-1014.21 arm64 [installed]

when I try to compile the package you provided in the other support thread, I can build ixxat_usb_cl1.o and ixxat_usb_cl2.o, but when it comes to ixxat_usb_core.o, make throws weird errors. This is my complete make output:

ubuntu@uer-dev:~/libs/usb2can_20180920-Modified_by_PeWu$ make
make -C /lib/modules/5.19.0-1014-raspi/build M=/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu modules
make[1]: Entering directory '/usr/src/linux-headers-5.19.0-1014-raspi'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: aarch64-linux-gnu-gcc-12 (Ubuntu 12.2.0-3ubuntu1) 12.2.0
  You are using:           gcc-12 (Ubuntu 12.2.0-3ubuntu1) 12.2.0
  CC [M]  /home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_cl1.o
  CC [M]  /home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_cl2.o
  CC [M]  /home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.o
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c: In function ‘ixxat_usb_stop_queue’:
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c:349:25: error: too few arguments to function ‘can_free_echo_skb’
  349 |                         can_free_echo_skb(netdev, i);
      |                         ^~~~~~~~~~~~~~~~~
In file included from ./include/linux/can/dev.h:22,
                 from /home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c:19:
./include/linux/can/skb.h:27:6: note: declared here
   27 | void can_free_echo_skb(struct net_device *dev, unsigned int idx,
      |      ^~~~~~~~~~~~~~~~~
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c: In function ‘ixxat_usb_write_bulk_callback’:
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c:831:9: error: too few arguments to function ‘can_get_echo_skb’
  831 |         can_get_echo_skb(netdev, context->echo_index);
      |         ^~~~~~~~~~~~~~~~
./include/linux/can/skb.h:24:27: note: declared here
   24 | unsigned int __must_check can_get_echo_skb(struct net_device *dev,
      |                           ^~~~~~~~~~~~~~~~
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c: In function ‘ixxat_usb_start_xmit’:
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c:876:9: error: too few arguments to function ‘can_put_echo_skb’
  876 |         can_put_echo_skb(skb, netdev, i);
      |         ^~~~~~~~~~~~~~~~
./include/linux/can/skb.h:20:5: note: declared here
   20 | int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
      |     ^~~~~~~~~~~~~~~~
/home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.c:881:17: error: too few arguments to function ‘can_free_echo_skb’
  881 |                 can_free_echo_skb(netdev, i);
      |                 ^~~~~~~~~~~~~~~~~
./include/linux/can/skb.h:27:6: note: declared here
   27 | void can_free_echo_skb(struct net_device *dev, unsigned int idx,
      |      ^~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:257: /home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu/ixxat_usb_core.o] Error 1
make[1]: *** [Makefile:1850: /home/ubuntu/libs/usb2can_20180920-Modified_by_PeWu] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.19.0-1014-raspi'
make: *** [Makefile:6: all] Error 2

At the moment, my only idea is that the source code for kernel 5.11 might not be compatible with kernel 5.19 or something might be wrong with the kernel headers of that specific ubuntu headers package.

Can you please provide me some assistance or compatible drivers?

Thanks in advance and best regards
Michael

Hi Michael,

Yes, you are correct. Some changes have been made. Please give this version a try:

socketcan_03_15_2023.zip (161.5 KB)

It should work with all kernels 4 - 6.

Best Regards,

Kyle Reynolds

Hi Kyle,

thank you very much! I was now able to build and install the drivers and set my can interface up. I will go on testing communication with my can devices as soon as I can. For the moment, it looks fine!

BR
Michael

Great - please let me know if you have any other questions!