in reply to need to capture serial port output

A long time ago I used to write interface programs that could talk to PBX's and other devices across serial ports (from SCO boxes). The concepts I used back when still would work now with Perl.

example running of script:

# tee input.txt</dev/ttyS0 | perl-prog.pl | tee output.txt >/dev/ttyS0
What this does is take Standard Input from the serial port, tee puts a copy in input.txt, then pipes the data to your script, and finially all script output is sent through tee which logs it to a file again then out the serial port.

When you write your perl script you just have to treat it like a user was typing in the data. Great when developing, as you just run the program and type in what you want. You let Linux handle all the IO to the serial port.

Here's the actual start job from an old script:

# start job SMDRdbctee harris.in < /dev/ttyr0a | SMDRdbc interfce | SMDRdbctee har +ris.out > /dev/ttyr0a &
By linking tee to SMDRdbctee it's easy to see when doing ps.

But in recent years I also moved onto Expect also for this type of work. ronzo