Making a serial snooper with a linux box?

I have some industrial equipment I'm trying to reverse-engineer. It communicates from the main CPU to a controller via a serial connection. I want to hook into the serial connection and dump everything doing down that line to log file so that I can stare at the messages and try to figure out the protocol.

I could just plug the serial cable into my computer but I need the messages to continue going to the controller or else the rest of the system will error. So basically I need to tap into it.

My first thought is to use a laptop with two USB-Serial adapters. I could use a perl script to open both serial connections as files and send everything that comes in the one serial connection right back out the other serial connection, but also dump it to a log file. Will this even work? I can see that it will introduce some latency but I don't think that will be critical.

Yielded:
http://www.beyondlogic.org/protocolanalyser/protocolanalyser.htm

A hardware solution is possible, but the software solution you describe will work just as well too. I did this very thing on a Linux system using a Python program many moons ago. I suppose Perl might work too, it just won't look as nice :wink:

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Here's one that's simple, solid, and free. It splits the two directions between two serial ports. You can build the breakout cable in literally just a few minutes if you don't need handshaking lines. Takes several minutes if you do.

Captures everything to a text file, and even does timestamping of status line changes (and, iirc, data: it's been several months since I used it, and the protocol wasn't time-critical, so my memory is a bit fuzzy on the subject).