Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 01 Nov 1997 10:44:45 -0500
From:      Bill Lloyd <wlloyd@mpd.ca>
To:        "User Rdkeys Robert D. Keys" <rdkeys@seedlab1.cropsci.ncsu.edu>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Looking for ways to do serial datalogging on FreeBSD
Message-ID:  <345B4E6D.6224@mpd.ca>
References:  <199710311914.OAA07431@seedlab1.cropsci.ncsu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
User Rdkeys Robert D. Keys wrote:
> 
> If I wanted to use a serial port as a datalogging input port on FreeBSD,
> from, for example a small outboard box emitting lines of data at 300 baud
> continuously, what might be good ways to do that?
> 
> Ideally, I would like to have a script or a small program running that
> would poll the system clock, poll the port for a line of data at hourly
> intervals, write that line to a logfile, then sit until the next hour,

You should investigate <ftp://ftp.vix.com/pub/vixie/rtty-3.2.tar.gz>;

It allows logging of serial ports (as many as you want).  The package is
for remote tty.  Here is a snip from the README

---------   
Rtty is "remote tty" (not radioteletype).  You run a server per port
and then connect to that server from any number of "tip"/"cu"-like
clients.  I wrote it for our console concentrator, but there's no
reason other than performance why you couldn't use it to drive modems,
printers, prom programmers, and so on.

...
Details

The server can be told to keep a log file.  This log file will record
all data in or out of the tty port; that is, data that comes from the
tty port will be logged, and data that is typed at (and therefore sent
to) the tty port from any client will be logged.  There are no special
markers in the log file to tell you which data came from which source;
the data is all just interleaved in the order it was received by the
server.  Note that line terminators in the log file will be "physical"
meaning probably \r\n rather than the normal UNIX \n.  It depends on
the device on the other end of the tty port, but \r\n is pretty common.

We watch our log files with daemons that do roughly what "tail -f" does
except they scan for things like "file table full" or "out of inodes"
or "panic" -- you know, things that computers say when they are unhappy.
None of our scanning software is included in this release of rtty, but
you can write your own.  Note that the protocol used between the server
and client is mostly implemented in a separate module of this source
directory; if you want to connect to the server in real time and scan
the output direcly instead of tailing the log file, that's an option.
(You would most especially want to do it this way if you aren't using
any log files.)

-------


-bill


-- 
William Lloyd (wlloyd@mpd.ca)			|    <http://www.mpd.ca>;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?345B4E6D.6224>