Naming multiple PEAK USB CAN adpaters

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
jschmidt
Posts: 9
Joined: Fri 23. Aug 2024, 20:52

Naming multiple PEAK USB CAN adpaters

Post by jschmidt » Fri 23. Aug 2024, 21:10

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??

M.Heidemann
Sales & Support
Sales & Support
Posts: 1069
Joined: Fri 20. Sep 2019, 13:31

Re: Naming multiple PEAK USB CAN adpaters

Post by M.Heidemann » Mon 26. Aug 2024, 09:02

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 3598 times
BR

Marvin
---
Marvin Heidemann
PEAK-Support Team

jschmidt
Posts: 9
Joined: Fri 23. Aug 2024, 20:52

Re: Naming multiple PEAK USB CAN adpaters

Post by jschmidt » Mon 26. Aug 2024, 18:01

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.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1069
Joined: Fri 20. Sep 2019, 13:31

Re: Naming multiple PEAK USB CAN adpaters

Post by M.Heidemann » Tue 27. Aug 2024, 09:24

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
---
Marvin Heidemann
PEAK-Support Team

jschmidt
Posts: 9
Joined: Fri 23. Aug 2024, 20:52

Re: Naming multiple PEAK USB CAN adpaters

Post by jschmidt » Tue 27. Aug 2024, 22:25

Understood. I'll try installing that driver package to see if it'll give me the functions I need. Thanks!

Post Reply