--- In .com,
"yoobb" m("...","yoobb");"><> wrote:
>
> Does anybody have any ideas on how to easily capture serial port
input (either COM1 or
> COM2) to a text file? Ideally, I would like the TS-7200 to
continuously direct serial port
input
> to a text file, appending to the same file (or a new file) with
each restart.
>
> The only idea I have so far is to install minicom and set up a
boot script that starts
minicom
> and directs it to a text file automatically.
>
> TIA!
>
Thanks to both people who've replied so far!
For now, I am successfully redirecting COM2 to a log file. The device
file is /dev/ttyAM1. I
found out (on this board) that I first have to comment out the line in
the file /etc/inittab
containing "getty" and "ttyAM1". Apparently, getty is a program that,
by default, uses the
serial port. Commenting out this line frees up the serial port for my
own use.
I then added a boot script to /etc/rc2.d, naming it "S99datarecord".
The script contains:
stty -F /dev/AM1 ispeed 4800
stty -F /dev/AM1 ospeed 4800
stty -F /dev/AM1 igncr
cat /dev/AM1 >> /home/me/log
The first two lines set the desired speed. The third line says to
ignore carriage returns.
Before I put in the igncr, I was getting double-spaced output.
Apparently, my device uses
<CR><LF> to end a line (like DOS) and the serial port
must've been converting the CR to a
second LF. igncr throws out the extraneous CR.
I also had to set executable permissions: chmod +x S99datarecord.
This is crude, but it works. The only problem is the data capture
occurs midstream and
stops midstream, so the first and last lines of data are partial lines.
If I were to use the
text file as is, I would have to strip out the the first and last lines
of every session.
I'll explore more sophisticated methods as time permits. The previous
response lists
some very promising suggestions.
Thanks to all!