Re: Blocking read() from a USB->Serial adapter.
- From: Grant Edwards <grante@xxxxxxxx>
- Date: Sat, 25 Nov 2006 05:17:16 -0000
On 2006-11-25, Charles Sullivan <cwsulliv@xxxxxxxxxxxx> wrote:
A blocking read() of more than one character from an actual RS232
serial port returns when the number of characters specified has
been read.
No. Have a look at man 2 read. Note the word "attempts".
I can understand the "attempts to read" for a non-blocking
read - returning fewer characters than specified if the
characters aren't immediately available to be read.
But I had the impression that a blocking read is supposed to
block forever or until it either reads the specified number of
characters or is interrupted.
That's the way most character drivers work, but that's not
required by the documented API.
You're saying maybe it will and maybe it won't and that's to
be expected.
Yes, that's what he's saying.
Not a problem. I am just puzzled why reading from the adapter
differs from reading from an actual serial port.
Good question. In both cases you're calling the same piece of
code in the tty line discipline layer. If you really do want
to know why the behavior differs, you're probably going to have
to examine the tty line discipline read() system call handler
and the code for the 16550 driver and the usb-serial driver.
BTW, the number of characters to be read is never more than
10.
OK, but that's moot.
--
Grant Edwards
grante@xxxxxxxx
.
- References:
- Blocking read() from a USB->Serial adapter.
- From: Charles Sullivan
- Re: Blocking read() from a USB->Serial adapter.
- From: Bjoern Schliessmann
- Re: Blocking read() from a USB->Serial adapter.
- From: Charles Sullivan
- Blocking read() from a USB->Serial adapter.
- Prev by Date: Re: Signals and threads
- Next by Date: Re: Blocking read() from a USB->Serial adapter.
- Previous by thread: Re: Blocking read() from a USB->Serial adapter.
- Next by thread: Re: Blocking read() from a USB->Serial adapter.
- Index(es):
Relevant Pages
|