Ubuntu 14.04 PCAN Problems
Posted: Wed 14. Jan 2015, 11:40
Hi,
I have a (X)Ubuntu 14.04 system that uses a manually installed PCAN driver in CHARDEV mode. Each kernel update forces me to recompile the driver so that the new kernel recognizes its version number and loads the module, which is a bit annoying. I'm therefore thinking about converting the software to SocketCAN usage and use the NETDEV driver that comes with Ubuntu.
I've "make uninstall"ed the old driver and now the driver that comes with Ubuntu is loaded on system boot and I see there is an (inactive) can0 interface. Now I have some questions:
1) I do not see a /proc/pcan device can therefore not see information about the driver. I did get a /proc/pcan decice once when I manually installed a driver, but there does not appear to be one when using the driver that comes with Ubuntu. Is that normal? Some kind of configuration issue in the kernel used by Ubuntu perhaps? Or is it a sign of some other problem?
2) I can change the baudrate with "ip link set can0 type can bitrate 250000", however, I'd prefer to do that from inside my program. I've seen there are code samples on the web that suggest
ifr.ifr_ifru.ifru_ivalue = 1000000;
ret = ioctl(s, SIOCSCANBAUDRATE, &ifr);
but my Ubuntu does not appear to have SIOCSCANBAUDRATE (I've "grep"ed the headers). At the same time I cannot use any tricks using the /dev/pcan device becauses they do not exist in Ubuntu's NETDEV driver. So how can I change the baudrate without invoking the "ip" command?
cheers,
Torsten
I have a (X)Ubuntu 14.04 system that uses a manually installed PCAN driver in CHARDEV mode. Each kernel update forces me to recompile the driver so that the new kernel recognizes its version number and loads the module, which is a bit annoying. I'm therefore thinking about converting the software to SocketCAN usage and use the NETDEV driver that comes with Ubuntu.
I've "make uninstall"ed the old driver and now the driver that comes with Ubuntu is loaded on system boot and I see there is an (inactive) can0 interface. Now I have some questions:
1) I do not see a /proc/pcan device can therefore not see information about the driver. I did get a /proc/pcan decice once when I manually installed a driver, but there does not appear to be one when using the driver that comes with Ubuntu. Is that normal? Some kind of configuration issue in the kernel used by Ubuntu perhaps? Or is it a sign of some other problem?
2) I can change the baudrate with "ip link set can0 type can bitrate 250000", however, I'd prefer to do that from inside my program. I've seen there are code samples on the web that suggest
ifr.ifr_ifru.ifru_ivalue = 1000000;
ret = ioctl(s, SIOCSCANBAUDRATE, &ifr);
but my Ubuntu does not appear to have SIOCSCANBAUDRATE (I've "grep"ed the headers). At the same time I cannot use any tricks using the /dev/pcan device becauses they do not exist in Ubuntu's NETDEV driver. So how can I change the baudrate without invoking the "ip" command?
cheers,
Torsten