> --- In "yoobb" <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.
getty is the program that handles connection on a port (launches
login, pppd, etc).
>
> 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.
>
You can just use "stty -F /dev/ttyAM1 speed 4800" to set both in and
out speed. You may also set the "raw" option so no processing is done.
> I also had to set executable permissions: chmod +x S99datarecord.
Sure, but usually you write "/etc/init.d/datarecord", make it
executable, and then link it to "/etc/rc.2/S99datarecord". The script
should take at least two parameters: "start" and "stop" (look at the
other scripts in init.d). This is all just "the usual", you can skip it.
> 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.
Maybe you could pipe into gawk if there is anything you can extract
with regexp (e.g. GPS NMEA182 strings start with $ and end with *).
> I'll explore more sophisticated methods as time permits. The
previous response lists
> some very promising suggestions.
>
> Thanks to all!
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/4It09A/fOaOAA/yQLSAA/CFFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|