Chardev & Netdev devices on one system

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
thomasteo
Posts: 1
Joined: Mon 17. Oct 2016, 04:49

Chardev & Netdev devices on one system

Post by thomasteo » Mon 17. Oct 2016, 04:55

Hello,
Is it possible to have two CAN interfaces on one system; one chardev and the other netdev?
One possible way I can see is:
* have two different USB devices, one with a different device ID
* compile two kernel modules, renaming one (eg pcan_char)
* use modalias and udev to force one of the device IDs to use a particular driver

But perhaps there's an easier way (or perhaps having two almost identical kernel modules loaded will cause problems).

Any advice welcome.

Thanks,
Thomas

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Chardev & Netdev devices on one system

Post by S.Grosjean » Mon 17. Oct 2016, 14:34

Hello!

Your question is quite interesting... But I actually don't see any easy solution for you.

In fact, the driver module is attached to a USB Device Id, which fixed value is given at the time the USB device is plugged into the host. Our PCAN USB adapters define their own (0x000c) and this value can't be changed at all. So, each time you'll plug a PCAN-USB, then the system will load the driver module which has been registered for handling the 0x000c value. This could be "pcan.ko" but (also) "peak_usb.ko" (the mainline linux-can driver), or a (new) one named "pcan_char.ko"... But there're will always be only one driver module handling this Device Id. loaded by the system at one time.

Handling both netdev/chardev interfaces at the same time in pcan is not a conceivable option at the moment.

Regards,

Stéphane
— Stéphane

Post Reply