The CAN bus in Linux
As seen earlier, every CAN controller is represented in the system as a network device, and it can be listed as any other Ethernet or Wi-Fi device using the ifconfig
command (or equivalent). The reason is that a CAN bus is just a network of several machines that are able to talk to each other into a LAN.
So, as we already saw earlier, we can use all networking commands on these devices. Here are two examples using both ifconfig
and ip
commands:
root@a5d3:~# ifconfig can0 can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:50 root@a5d3:~# ip link show can0 2: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10 link/can
In particular, using the ip
command...