Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jun 1999 23:22:26 -0700 (PDT)
From:      Doug White <dwhite@resnet.uoregon.edu>
To:        Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Advice for writing software using serial ports needed
Message-ID:  <Pine.BSF.4.03.9906032320030.774-100000@resnet.uoregon.edu>
In-Reply-To: <19990601175101.A14395@internal>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 1 Jun 1999, Andre Albsmeier wrote:

> Because I hate to do it on DOS/Win95/WinNT, I would like to solve
> the following problem on FreeBSD:
> 
> I have to write a small programm that sends data to a serial port.
> The device on the serial port sends the data back (just like a
> loopback interface with TX/RX and RTS/CTS connected together).
> I need some advice or a pointer how to do this properly. I think
> I have to:
> 
> 1. open /dev/cuaa0
> 2. set baudrate, bits, ... somehow (ioctl, termios, ???)
> 3. write/read to/from it within a select() loop
> 4. ???

You're right on target.  This is how ppp works.  For #2,  you're after the
tcgetattr()/tcsetattr() and cfgetspeed()/cfsetspeed() termios calls.
That's all you have to do though.  The tcgetattr(3) man page has
everything you need.

Doug White                               
Internet:  dwhite@resnet.uoregon.edu    | FreeBSD: The Power to Serve
http://gladstone.uoregon.edu/~dwhite    | www.freebsd.org



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?Pine.BSF.4.03.9906032320030.774-100000>