From: Grant Edwards <grant.b.edwards@gmail.com>
To: linux-serial@vger.kernel.org
Subject: Problem with tcflush() and RTS/CTS flow control?
Date: Wed, 23 Jan 2013 21:03:23 +0000 (UTC) [thread overview]
Message-ID: <kdpj6q$nos$1@ger.gmane.org> (raw)
I've been writing serial port regression test programs to test the
serial drivers I maintain. I occasionally run them on "standard"
16x50 serial ports for comparison purposes. My flow control
regression test passes with my driver and fails with 16x50 serial
ports (some are Moschip parallel-serial port boards, some are Oxford
multi-port serial boards). At the moment, I don't have any
motherboards with serial ports that I can test on. I've tested under
3.5 and 3.8 kernels so far.
Here's the test scenario:
1) Port is in "raw" mode with rtscts flow control enabled.
2) Send receive data to port until RTS goes off (receive ~3968
bytes).
3) Make read() calls on port until RTS comes back on (read ~3840
bytes).
4) Send receive data to port until RTS goes off again (receive ~3968
bytes).
so far, everything's working fine...
5) Call tcflush(TCIFLUSH).
RTS should go back on at this point, since the receive buffer is
now empty and there's plenty of room to receive more data.
RTS does not come back on: it stays off (forever, AFAICT).
If you read() the port in non-blocking mode it returns EAGAIN. A
read() in blocking mode will block. The receive buffer is empty and
incoming data is throttled off, so a blocking read() never returns.
This seems like a bug to me.
Calling tcflow(TCION) once it's in this state does nothing. [I guess
it's not supposed to since it's only intended to be used in XON/XOFF
mode.]
With my driver, calling tcflush(TCIFLUSH) causes RTS to come back on
again and incoming data resumes. Why isn't this the right thing to
do?
--
Grant Edwards grant.b.edwards Yow! PUNK ROCK!! DISCO
at DUCK!! BIRTH CONTROL!!
gmail.com
reply other threads:[~2013-01-23 21:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='kdpj6q$nos$1@ger.gmane.org' \
--to=grant.b.edwards@gmail.com \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).