Naming multiple PEAK USB CAN adpaters
Posted: 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??
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??