Subject: Re: Serial port questions
To: Bruce Martin <BruceM@cat.co.za>
From: David Brownlee <abs@anim.dreamworks.com>
List: netbsd-help
Date: 07/25/1999 12:24:52
On Sat, 24 Jul 1999, Bruce Martin wrote:
> 3 Questions:
>
> - I want to get a character from the receive buffer, but there may not
> always be one: how do I check if it is empty first, or timeout after
> trying to read it for a while?
>
You can use something like
fcntl(fd,F_SETFL,fcntl(fd,F_GETFL)|O_NONBLOCK)
to set the filedescriptor to be non blocking, then use read(...)
to read the data.
To check if data is present use poll(1) or select(1).
> - How do I change the DTR line state?
>
The answer to that is probably somewhere under termios(4)
(man 4 termios)
> - How do I change the depth of the FIFO required to cause an interrupt?
That would almost certainly be in the kernel chip driver
David/absolute
-=- "That which does not kill us, makes us stranger" -=-