Subject: Re: Serial port programming problem/question
To: Leif Lindholm <leif@smurfnet.nu>
From: Ben Collver <collver@peak.org>
List: netbsd-users
Date: 01/07/2005 06:46:43
Hi Leif,

I don't have the time to answer your questions directly, but a document
you may find useful is the Serial Programming Guide for POSIX Operating
Systems, available at http://easysw.com/~mike/serial/

Some sample code may be seen at:
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/tip/
http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/getty/

Cheers,

Ben

On Fri, Jan 07, 2005 at 03:31:14PM +0100, Leif Lindholm wrote:
> Hi
> 
> I've been trying to port a program i wrote on Linux to NetBSD 2.0 (both
> x86), but I have problems getting the serial communications working.
> 
> The program is reading input from a serial port (ttyS0/tty00), in normal
> newline-terminated ASCII format (9600, 8N1).
> 
> My first problem is that the open("/dev/tty00") call never returns
> unless I use O_NONBLOCK.
> My second is that if I use O_NONBLOCK, the select() call always return
> and the FD_ISSET() shows that there is data available - but the read()
> doesn't return any data.
> 
> I get the output just fine when using minicom/kermit on the NetBSD, so
> there shoudn't be anything else blocking the port.
> 
> Which serial device should I be using - tty00 or dty00 (or some other)?
> 
> Does anyone have some sample code I could use for reference?
> 
> Am I missing something obvious?
> 
> regards
> 	/
> 		Leif
> 
> p.s.
> Please cc replies, as I am not subscribed to the list.
> d.s.
> 
>