Hi all,
I know it is a long time, but I need to come back to this topic.
In principle, /sys/class/net/canX/device/interface gives me some
information to the connected device, e.g.:
LANG=C cat /sys/class/net/can0/device/interface
PCAN-USB Pro FD CAN
LANG=C cat /sys/class/net/can2/device/interface
USB-CANmodul2
Interestingly, for PCAN-USB and PCAN-PCIexpress (2 channel), there is no
such information; the file interface does not even exist.
I'm on Kernel 4.15.0 here.
I don't have access to other CAN adapters, so I don't know the general
status, but would hope that such important information is accessible
from userspace. I guess it's the vendors responsibility to add such
information?
Regards,
André
Am 19.07.17 um 19:42 schrieb aha_1980@xxxxxx:
Hi Marc,
Am Dienstag 18. Juli 2017 schrieb Marc Kleine-Budde:
On 07/17/2017 09:36 PM, André Hartmann wrote:
thanks for your hints! I've investigated a bit (with PEAK and SYSTEC
adapters) and I'm partly satisfied.
Wolfgangs tip with ip -d gives me indeed the driver associated to a
CAN interface. And in /sys/class/net/can0/subsystem/can0/device/
interface I found the device string, thanks Marcel. (Full logs are
appended).
However, the most important infos are still only visible in dmesg.
It's the drivers output which CAN channel is associated with each
hardware interface, e.g.:
peak_usb 2-1.4:1.0: PEAK-System PCAN-USB Pro [...] (2 channels)
peak_usb 2-1.4:1.0 can0: attached to PCAN-USB Pro channel 0 (device 1)
peak_usb 2-1.4:1.0 can1: attached to PCAN-USB Pro channel 1 (device 0)
So if there is no way to get these infos from userspace now, I think it
would be a good addition to have this possibility. Especially if there
is more than one CAN adapter connected.
Does the udev property dev_id help? See
http://permalink.gmane.org/gmane.linux.can/5227 for more information.
That looks indeed interesting. My Google-foo tells me the patch was included in a pull request, so it should be merged to mainline Kernel.
Let's see what I can achive.
Thanks, Andre
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |