我们如何检测来自 linux socketCAN 的丢帧?

问题描述

我想检测在使用 linux socketCAN 实现的 CAN 套接字上丢弃的帧数。当在终端上给出命令 ip -details -statistics link show can0 时,我可以获得 Rx 和 Tx 的丢弃列中丢弃的帧数。

2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNowN mode DEFAULT group default qlen 10
link/can  promiscuity 0 
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 
  bitrate 250000 sample-point 0.866 
  tq 266 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
  flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
  clock 30000000
  re-started bus-errors arbit-lost error-warn error-pass bus-off
  0          0          0          0          0          0         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
RX: bytes  packets  errors  dropped overrun mcast   
1860       356      0       0       0       0       
TX: bytes  packets  errors  dropped carrier collsns 
13789      1843     0       0       0       0       

如何使用 C 代码获取/检测 Rx 和 Tx 的丢弃号码?。 感谢您抽出宝贵时间并提前回答。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)