Socket-CAN virtual bus

痴心易碎 提交于 2019-12-04 05:20:21

All you need is cangw tool from can-utils. Create two virtual interfaces:

ip link add dev vcan0 type vcan
ip link add dev vcan1 type vcan
ip link set up vcan0
ip link set up vcan1

Create routing rule, so that all packets coming to vcan0 will be sent to vcan1:

cangw -A -s vcan0 -d vcan1 -e

Listen to vcan1 in one terminal:

candump vcan1

And send packet from another terminal:

cansend vcan0 123#0011

You'll see, that candump will get this CAN packet:

vcan1  123   [2]  00 11
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!