
So I could replay the whole operation and trace timing executions.
Note: I run them by using syntax: script -t ttySniff.log 2>ttySniff.tm -c "./ttySniff.sh USB0"
You could replace strace -e read by strace -e read,write or strace -e write depending on your need. Perl script will unbackslash strings logged by strace -s 9999. (Most Linux distros never added it to their repos) The single-purpose-tool interceptty from 2006 has slightly simpler syntax, but can only intercept TTYs (while proxying ioctls), and is probably not in your package manager. If you need to setup your serial port, or send other ioctls, do so before calling socat, as socat cannot proxy them. The socat syntax looks confusing at first, but in fact, it's just 2 nested statements.Ī small price to pay to such a powerful, versatile tool. The files in.txt and out.txt will then contain the captured data. SYSTEM:'tee in.txt |socat - "PTY,link=/tmp/ttyV0,raw,echo=0,waitslave" |tee out.txt' Googling "socat serial port pty tee debug" will point you to several "standard procedure" examples, one being: socat /dev/ttyS0,raw,echo=0 \ In your usecase you could connect your serial port /dev/ttyS0 to a PTY /tmp/ttyV0, then point your application to the PTY, and have socat tee out Input and Output somewhere for you to observe. Socat is a tool to connect (nearly) everything to (nearly) everything, and tee can duplicate streams.