Canplayer won't replay candump files

Arthur Nunes picture Arthur Nunes · Jul 9, 2015 · Viewed 12.1k times · Source

I'm trying to use canplayer to replay some candump files, with no success. When I try to run the canplayer it just executes and returns, giving me no clue of what is happening.

What I've tried up to now:

Setup 1

  • Set up a vcan interface
  • Sent data to the vcan interface using cansend and cangen, with success (verified with candump).
  • Recorded a candump file from vcan0 when running cangen. Recorded files with absolute timestamps (-t a) and without.
  • Tried using canplayer to reproduce the file. Tried using several arguments, no avail. canplayer just returns immediately without any complaint. If I mess up the the file or arguments it complains.

Setup 2

  • Connected 2 PEAK CAN USB adapter devices to the PC.
  • Connected the adapters to each other using a 120ohm terminated cable
  • Started cangen pointing to can0 and verified that the messages got to can1 using candump
  • Recorded candump files from can0 interface.
  • Tried using canplayer to reproduce the file., with no success.

I've tried these tests on two different machines, both running Ubuntu 12.04, with the same results.

Do you know what might be the cause of it?

Answer

Arthur Nunes picture Arthur Nunes · Jul 17, 2015

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

$ 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 -I candump-2015-07-10_081824.log

or

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

Credits for this answer go to Oliver Hartkopp.