我正在尝试为 SocketCAN 编写一个稍微修改过的 CAN 协议(protocol)。 SocketCAN 文档有一个关于此的简短部分:
5.3 writing own CAN protocol modules
To implement a new protocol in the protocol family PF_CAN a new
protocol has to be defined in include/linux/can.h .
The prototypes and definitions to use the SocketCAN core can be
accessed by including include/linux/can/core.h .
In addition to functions that register the CAN protocol and the
CAN device notifier chain there are functions to subscribe CAN
frames received by CAN interfaces and to send CAN frames:
can_rx_register - subscribe CAN frames from a specific interface
can_rx_unregister - unsubscribe CAN frames from a specific interface
can_send - transmit a CAN frame (optional with local loopback)
For details see the kerneldoc documentation in net/can/af_can.c or
the source code of net/can/raw.c or net/can/bcm.c .
( https://www.kernel.org/doc/Documentation/networking/can.txt )
问题是我找不到这里引用的一些文件。我对 Linux 内核不是很熟悉,所以我不知道我是否找错了地方。我可以找到
include/linux/can.h
和目录 include/linux/can/
但那里没有 core.h
文件。此外,我找不到引用的 net/
目录。其他信息:
core.h
应该在哪里): beaglebone:~# ls /usr/include/linux/can/
bcm.h error.h gw.h netlink.h raw.h
如果有人能帮我指出我应该在哪里寻找这些文件,我将非常感激。
非常感谢!
最佳答案
CAN协议(protocol)由硬件实现;尝试制作不符合标准的数据包将不适用于兼容的硬件。
关于linux - 使用 SocketCAN 编写自定义 CAN 协议(protocol),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31685578/