serial snoop

Hi,
I'm trying to troubleshoot a serial device and would like to be able snoop on the data on the serial line. I have had some success using the 'watch' command against /dev/cuaU0, but I only get what is getting sent to the serial device and not what is received. Does anyone know if there is a way to snoop on the serial line in the other direction? I haven't had any luck reading the man pages or searching...
Thanks!
Brock
 
I believe it should be possible to do with socat(1), I haven't tried though.
I used to use a simple program interceptty (there is no port, you'll have to compile yourself, but it's straight forward), the command:
Code:
# interceptty -s 'ispeed 115200 ospeed 115200' /dev/cuaU0 /tmp/serlal
creates /tmp/serlal virtual serial port that you use for the actual communication. It prints the serial data to stdout.
Just tested it with a serial port I use to access a BeagleBone Black's serial console: perfectly catches two-way data.
 
I wrote something to do that years ago, but the person who wanted it was not wanting it for sincere reasons, so I never released it.
 
Another option would be to intercept the C runtime calls to open/read/write/close (much like Super Capsicumizer 9000) to log the bytes inbound and outbound using LD path shenanigans. The appeal is no need to run under the higher privs need to load an ad-hoc device driver.
 
Back
Top