Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Apr 2001 12:03:30 -0400
From:      Bob Johnson <bob@eng.ufl.edu>
To:        johnsa@kpi.com.au
Cc:        questions@freebsd.org
Subject:   Re: How to:Read directly from serial port to a file
Message-ID:  <3AD5D1D2.882E8459@eng.ufl.edu>

next in thread | raw e-mail | index | archive | help
> Date: Thu, 12 Apr 2001 13:28:27 +1000
> From: Andrew Johns <johnsa@kpi.com.au>
> Subject: How to:Read directly from serial port to a file
> 
> Issue:
> 
> I've got a PC attached to a phone system which emits data about the phone
> lines in use via a serial line at 1200 baud.
> 
> What I want is to plug the serial cable into the PC and dump the incoming
> data directly to a file for later analysis by 3rd party software.
> 

$ cp /dev/cuaa0 phonelog.txt &

ought to be all you need, assuming you have read permission for /dev/cuaa0.  
If you need to change the default buad rate of the port, then (as root) 

# stty speed 1200 < /dev/cuaia0

should do it, although there is another way (which I don't remember) 
that may be less idiomatic.  /dev/cuaiaX sets the initial (default) 
parameters for port X, and /dev/cualaX lets you set locked parameters 
(that can't be changed by user programs, I think).


You probably also want to redirect standard output and error to a 
file so you have a record of any complaints, e.g. 

$ cp /dev/cuaa0 phonelog.txt > phonerr.txt 2>&1 &

or perhaps

$ cat /dev/cuaa0 > phonelog.txt 2> phonerr.txt &

> I have had this working in the past, but the box has been blown away and I
> cannot seem to get it going again.
> 
[...]


- Bob

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3AD5D1D2.882E8459>