Re: Blocking read() from a USB->Serial adapter.



On 2006-11-25, Floyd L. Davidson <floyd@xxxxxxxxxx> wrote:

The tty line discipline will generate an "EOF" condition and
return 0 bytes when it sees the EOF character (typically
ctrl-d) as the first byte after read() is called.

Okay, but that is actually just a manufactured work around to
simulate it, not an EOF condition. And it only exists for
specified circumstances (icanon?? tty line discipline??

I think that's right.

I'm not sure when it is or isn't there).

If the timer is enabled, and times out, read() will return 0.

You're right. I thought it returned with an ETIMEDOUT error,
but I was probably thinking of a different OS.

If the O_NONBLOCK flag is set, then it sets EAGAIN. But nothing
for blocking reads when the VTIME expires.

That sounds right. I was conflating features of the eCos
serial driver with the Linux line-discipline VTIME stuff.

Another possibility is if the number of bytes request was 0,
read() will return 0.

Yup -- I forgot about that.

I had to go look all of this up... Anymore, I don't remember
anything except where to start searching... ;-)

I never could keep the canonical stuff straight. I stopped
using anything but raw mode with my own timouts using select or
poll.

--
Grant Edwards
grante@xxxxxxxx

.