Page 1 of 1

Naming multiple PEAK USB CAN adpaters

Posted: Fri 23. Aug 2024, 21:10
by jschmidt
Hello, all! I've searched for days for a solution to this, before giving up and making an account here to ask for a solution.

I'm running Ubuntu 20.04, and have two PEAK USB CAN interfaces connected. They have different CAN IDs, set using the PCAN utility. By default they will enumerate as "can0" and "can1" using the built-in peak driver included with the linux kernel. dmesg reveals that the CAN channel IDs are persistent and revealed by the "bcdDevice" attribute.

I have programs that need to access each specific and separate bus, but I can't guarantee that they will always enumerate to the same device. So, I would like to use a udev rule or some other mechanism to give each USB CAN interface a known name each time the computer comes up. So far my efforts of using a udev rule that uses the attribute "bcdDevice" (seemingly the only unique identifier available) along with the NAME= assignment have been fruitless. It just doesn't seem to use the bcdDevice rule at all and assigns can0 and can1 regardless.

The example udev rule provided in the PEAK docs that uses a PROGRAM= with matching bash program doesn't work, since the driver doesn't seem to actually create a "/sys/class/net/can0/peak_usb/can_channel_id" file that it can cat a channel ID from.

Can anyone help? I'm pulling my hair out here - there's got to be a way to do this, right??

Re: Naming multiple PEAK USB CAN adpaters

Posted: Mon 26. Aug 2024, 09:02
by M.Heidemann
Hello,

Use the driver package, you can set the device id using the peak-settings application:
device number..png
device number..png (104.14 KiB) Viewed 11189 times
BR

Marvin

Re: Naming multiple PEAK USB CAN adpaters

Posted: Mon 26. Aug 2024, 18:01
by jschmidt
Thanks for your reply. Does that utility do anything different that the Windows-based utility I already used for changing the PEAK USB's CAN address?

"pcan-settings" does not seem to be installed or available on my system. In fact, I don't think the 'pcan' module even exists on my system right now; it seems to be 'peak-usb'.

Would it make sense to remove the built-in driver and install the latest PEAK driver manually? Currently my linux kernel is 5.15.0-119-generic.

Re: Naming multiple PEAK USB CAN adpaters

Posted: Tue 27. Aug 2024, 09:24
by M.Heidemann
Hello,

That's why i specified "driver package", pcan-settings is part of our proprietary driver packge:

Package:
https://www.peak-system.com/quick/PCAN-Linux-Driver

Docs:
https://www.peak-system.com/fileadmin/m ... an_eng.pdf

Best Regards

Marvin

Re: Naming multiple PEAK USB CAN adpaters

Posted: Tue 27. Aug 2024, 22:25
by jschmidt
Understood. I'll try installing that driver package to see if it'll give me the functions I need. Thanks!