简体   繁体   English

Canplayer 不会重放 candump 文件

[英]Canplayer won't replay candump files

I'm trying to use canplayer to replay some candump files, with no success.我正在尝试使用 canplayer 重放一些 candump 文件,但没有成功。 When I try to run the canplayer it just executes and returns, giving me no clue of what is happening.当我尝试运行 canplayer 时,它只是执行并返回,让我不知道发生了什么。

What I've tried up to now:到目前为止我尝试过的:

Setup 1设置 1

  • Set up a vcan interface设置vcan接口
  • Sent data to the vcan interface using cansend and cangen, with success (verified with candump).使用cansend和cangen发送数据到vcan接口,成功(用candump验证)。
  • Recorded a candump file from vcan0 when running cangen.运行cangen时从vcan0记录了一个candump文件。 Recorded files with absolute timestamps (-ta) and without.带绝对时间戳 (-ta) 和不带绝对时间戳的记录文件。
  • Tried using canplayer to reproduce the file.尝试使用 canplayer 重现该文件。 Tried using several arguments, no avail.尝试使用多个参数,无济于事。 canplayer just returns immediately without any complaint. canplayer 只是立即返回,没有任何抱怨。 If I mess up the the file or arguments it complains.如果我弄乱了它抱怨的文件或参数。

Setup 2设置 2

  • Connected 2 PEAK CAN USB adapter devices to the PC.将 2 个 PEAK CAN USB 适配器设备连接到 PC。
  • Connected the adapters to each other using a 120ohm terminated cable使用 120 欧姆端接电缆将适配器相互连接
  • Started cangen pointing to can0 and verified that the messages got to can1 using candump启动指向 can0 的 cangen 并验证消息是否使用 candump 到达了 can1
  • Recorded candump files from can0 interface.从 can0 接口记录 candump 文件。
  • Tried using canplayer to reproduce the file., with no success.尝试使用 canplayer 重现该文件,但没有成功。

I've tried these tests on two different machines, both running Ubuntu 12.04, with the same results.我已经在两台不同的机器上尝试过这些测试,都运行 Ubuntu 12.04,结果相同。

Do you know what might be the cause of it?你知道可能是什么原因吗?

It seems I had recorded the log files in a wrong manner.看来我以错误的方式记录了日志文件。

My logs files where recording using the following command:我的日志文件使用以下命令记录:

$ candump -ta vcan0 "log.candump"

That command, however, records the log in human readable format:但是,该命令以人类可读的格式记录日志:

  vcan0  1B3   [8]  8E 02 74 22 55 70 49 30
  vcan0  658   [6]  27 48 2C 56 14 0A
  vcan0  1F8   [2]  77 99
  vcan0  7B7   [8]  33 A2 24 38 B2 78 86 72
  vcan0  43C   [8]  92 C6 81 2E FC 5E 38 35
  vcan0  7B0   [2]  2D 1B

In order to record log files that can be playback with canplayer, they should be recorded using either为了记录可以用 canplayer 播放的日志文件,它们应该使用以下任一方法记录

$ candump -l vcan0

or或者

$ candump -L vcan0 > myfile.log

The recorded file will look like this:录制的文件将如下所示:

(1436509052.249713) vcan0 044#2A366C2BBA
(1436509052.449847) vcan0 0F6#7ADFE07BD2
(1436509052.650004) vcan0 236#C3406B09F4C88036
(1436509052.850131) vcan0 6F1#98508676A32734
(1436509053.050284) vcan0 17F#C7
(1436509053.250417) vcan0 25B#6EAAC56C77D15E27
(1436509053.450557) vcan0 56E#46F02E79A2B28C7C
(1436509053.650713) vcan0 19E#6FE1CB7DE2218456
(1436509053.850870) vcan0 1A0#9C20407F96EA167B
(1436509054.051025) vcan0 6DE#68FF147114D1

Files in that format can be replayed in canplayer using the following commands:可以使用以下命令在 canplayer 中重播该格式的文件:

$ canplayer -I candump-2015-07-10_081824.log

or或者

$ cat candump-2015-07-10_081824.log | canplayer

Credits for this answer go to Oliver Hartkopp.此答案归功于 Oliver Hartkopp。

I found this article with some great information about using can and vcan.我发现 这篇文章提供了一些关于使用 can 和 vcan 的重要信息。 After taking a log of a physical CAN bus with candump using使用 candump 记录物理 CAN 总线的日志后

$ candump -l can0

as stated in the previous answer.如上一个答案所述。 I used the following to play it back over a virtual CAN bus.我使用以下内容通过虚拟 CAN 总线播放它。

$ canplayer vcan0=can0 -I candump-may-14-2015.log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM