4

i still want to check my Bootloader + Linux Startupcode for an embedded device. Therefore i want to catch the time for every command printed to the serial port.

I know there are programs like putty (which i can dearly recommend), getty, cutecom, picocom, screen etc. But none of these add timestamps to the incomming messages on the host screen (I'm not really talking about the date, more like how many ms have gone since the first output). It actually sounds not like a big deal.

I found out there is one script doing what i wanted to have, called grabserial but it's not working properly, since it's to slow to process the whole output. I discussed this problem in a different forum (if you want to know: grabserial problem but it's not part of the topic). So i can't use that script.

Now again: can you tell me a terminal for Linux which adds timestamps to every line, which was received from a Serial Port?

Thank you

[Edit:] I've found a pretty rough workaround with cereal, which wants to have some settings, since it locks the port everytime you use it. In the end, it adds the actual date and time, not the startup time and difftime between each step, so as you can see I'm still looking for an adequate solution.

Community
  • 1
  • 1
user3085931
  • 1,757
  • 4
  • 29
  • 55

5 Answers5

9

This might come 3 years too late, but minicom (https://en.wikipedia.org/wiki/Minicom) supports timestamps for every line printed on the terminal. In Ubuntu it's directly available in the default repos.

AllBlackt
  • 710
  • 6
  • 9
  • I already moved on from that project, but have you checked if it keeps what it promises? I'm asking since I've seen a lot of terminal tools that say they will attach timestamps, but in the end didn't or at least in a very unpractical kind of way. – user3085931 Aug 16 '16 at 07:43
  • 3
    minicom version 2.7 (compiled Feb 7 2016), on Ubuntu 16.04.01 has visible time stamps in the format "YYYY-MM-DD HH:MM:SS", I just used it right now. – AllBlackt Aug 16 '16 at 08:49
  • 1
    Thanks for the investigation – user3085931 Aug 16 '16 at 09:35
  • Now I remember minicom. It actually works quiet well. However as mentioned in the question I was benchmarking startup-times, means that the lowest unit seconds barely is precise enough. I didn't quiet understand why they put that limit – user3085931 Sep 02 '16 at 11:06
  • 4
    For completeness, start minicom with something like minicom -b 9600 -D /dev/ttyUSB0 -z -C ~/logs/tty-USB0.log -8 -b baudrate -D device to use -z status line at the bottom of the page -C capture file path -8 or -7 for number of bits per character to pass unchanged. Once started you need to type ^AN once to turn on timestamp logging and again to turn on millisecond level timestamps. – DDay Jun 01 '17 at 17:10
1

tio found at https://tio.github.io provides various timestamp options:

       -t, --timestamp

          Enable line timestamp.

       --timestamp-format <format>

          Set timestamp format to any of the following timestamp formats:

          24hour          24-hour format ("hh:mm:ss.sss")

          24hour-start    24-hour format relative to start time

          24hour-delta    24-hour format relative to previous timestamp

          iso8601         ISO8601 format ("YYYY-MM-DDThh:mm:ss.sss")

          Default format is 24hour

In your case, showing how much time has passed since start, that would be something like this:

tio -t --timestamp-format 24hour-start /dev/ttyUSB0

Settings can also be enabled in tio configuration file ~/.tioconfig

Martin
  • 111
  • 1
0

You might want to look in to using strace to monitor the serial port. See How can I monitor data on a serial port in Linux?

Community
  • 1
  • 1
mti2935
  • 11,465
  • 3
  • 29
  • 33
0

If you are willing to build the binary by yourself, you can try a branched picocom (https://github.com/codepox/picocom). This is based on picocom 1.7 which is a little old.

I have forked and enhanced this picocom and made it be able to show either delta-time or wall-clock timestamp. You can find it here (https://github.com/tdwong/picocom-with-timestamp). You still have to build the binary by yourself.

Here is how I use it. Note, N is the command to enable/toggle timestamp.

$ picocom -b 115200 /dev/ttyUSB0
  ...
<ctrl-a> N      # enable delta-time timestamp
<ctrl-a> N      # toggle wall-clock timestamp
<ctrl-a> N      # disable timestamp
Tzunghsing David Wong
  • 1,271
  • 14
  • 10
-3

I believe that ExtraPuTTY is the solution you are looking for.

However, I wasn't clear if you wanted something to run ON Linux or just to be able to monitor it (SSH to Linux). If you didn't want a Windows solution, then I apologize.

2023-05-05 Edit: My apologies, I did not have any way of knowing that the link I provided 8 years ago now goes to some consulting company. I was using extraputty at the time and did not intentionally link a company to promote it. Here is the link to archive.org showing the site as it was at the time I made this post.

Randal R.
  • 7
  • 2
  • 1
    This just takes me to some consulting company. – ls6777 Jan 17 '23 at 03:04
  • I believe he means SuperPuTTY, but yes can confirm extraputty link goes to some consulting company. https://code.google.com/archive/p/superputty/wikis/Documentation.wiki#:~:text=SuperPutty%20is%20a%20Windows%20application,when%20multiple%20connections%20are%20used. – Arthur Bowers May 04 '23 at 11:56