1

OK, I've been googling for hours so I obviously have not been able to understand the answers to the various questions that have already been asked about this subject. I am hoping that, by asking the question again in a more specific way, I will be able to get an answer I can understand.

I have some application running in linux that communicates with an external device attached to a serial port. I want be able to capture and log the data sent in both directions between the application and the device, with timestamps at the beginning of each line in the file.

As a test case, I am using minicom as the application I want to monitor, connected via a null modem cable to another computer also running minicom. I have already confirmed that, if I type characters on either of the computers, characters appear in the other computer's terminal. So far, so good.

I then found this question:

How can I monitor serial port traffic?

In the answer to this question, the program jpnevulator is suggested. However, when reviewing the man page, I could not figure out the right way to use jpnevulator to get what I want. Here is what I tried to do:

First, I opened a terminal window and typed the following command:

$jpnevulator --tty=/dev/ttyS0 --pty --pass --read --ascii --timing-print --file=serial.log

I saw the output: jpnevulator: slave pts device is /dev/pts/18

I then opened another terminal window and typed the following command:

minicom -D/dev/pts/18 -b115200

Minicom opened without complaint.

However, when I typed characters in either terminal (local and remote), nothing appeared in either terminal. jpnevulator only logged the data written to /dev/pts/18.

My expectation is that jpnevulator :

  1. reads data from /dev/pts/18 and "passes" this data on to /dev/ttyS0 while also writing this data to the specified file.

  2. reads data from /dev/ttyS0 and "passes" this data on to /dev/pts/18 while also writing this data to the specified file.

I am aware of the remark in the faq that says "Jpnevulator was never built to sit in between the kernel and your application. I'm sorry."

However the very same faq states in the second paragraph down: "Now with a little bit of luck some good news: A little while ago Eric Shattow suggested to use pseudo-terminal devices to sit in between the kernel and your application." That is the approach I am trying to take but I am having no success. What am I missing?

Thanks to all in advance.

Cheers, Allan

p.s. I was successfully able to capture the back and forth traffic using the socat method mentioned in the existing question I referenced but this method did not offer any way of timestamping the traffic. I was hoping that jpnevulator would have provided this for me.

0

I have answered my own question: I found another utility that better provides what I want:

https://github.com/geoffmeyers/interceptty

That package includes a perl script that post-processes the output of interceptty to provide a "pretty" output. I found it quite easy to modify the script to add a timestamp to each line.

Thanks to Geoff Meyers for providing this.

Allan

  • Thanks for posting the answer! Please take a moment to accept this answer by clicking on the checkmark on the left. If you could also give us a bit more detail on how you used this to help future readers, that would be great. – terdon Nov 1 '18 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.