[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5486cca80705060029p433c6acar22faaeced2d7da37@mail.gmail.com>
Date: Sun, 6 May 2007 09:29:35 +0200
From: "Antonino Ingargiola" <tritemio@...il.com>
To: "Alan Cox" <alan@...rguk.ukuu.org.uk>
Cc: "Oliver Neukum" <oliver@...kum.org>,
"Paul Fulghum" <paulkf@...rogate.com>,
linux-usb-users@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [SOLVED] Serial buffer corruption [was Re: FTDI usb-serial possible bug]
2007/5/5, Alan Cox <alan@...rguk.ukuu.org.uk>:
> On Sat, 5 May 2007 20:07:15 +0200
> Oliver Neukum <oliver@...kum.org> wrote:
[cut]
> > should I understand this so that, if tty_buffer_request_room() returns
> > less than requested, the rest of the data should be dropped on the
> > floor?
>
> If it returns NULL then either there is > 64K buffered (we can adjust
> that if anyone shows need - its just for sanity) or the system is out of
> RAM.
For my use case would be more sensible to accept the new data and
discard the older one in the tty buffer: the tty buffer would be a
moving window of the most recent incoming data. This because if
someone does not read the incoming data maybe he's not interested in
it. When he finally reads the data (assuming there was buffer
underrun) he's likely interested to the more recent chunk of incoming
data and not to an "head" of the data firstly received. Since I
acquire measurement data from serial this make perfect sense for me.
But does this make sense in general too?
However, whatever policy the buffer uses, the fundamental point it's that
when I flush the input buffer I should be sure that each byte read
after the flush is *new* (current) data and not old one. This because
when the input stream can be stopped I can check that there are 0 byte
in the buffer, but when the stream can't be stopped I must use a
flush-and-sleep (multiple times) heuristic before I can read a single
*reliable* byte.
> Alan
>
Regards,
~ Antonio
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists