O'Reilly logo

GNU/Linux Rapid Embedded Programming by Rodolfo Giometti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required