From: Peter Hurley <peter@hurleysoftware.com>
To: Grant Edwards <grant.b.edwards@gmail.com>, linux-serial@vger.kernel.org
Subject: Re: tcflow(TCOON/TCOOFF) vs. received XON/XOFF characters
Date: Thu, 17 Jul 2014 14:18:32 -0400 [thread overview]
Message-ID: <53C81378.60606@hurleysoftware.com> (raw)
In-Reply-To: <lq8l35$cfa$1@ger.gmane.org>
On 07/17/2014 10:03 AM, Grant Edwards wrote:
> On 2014-07-17, Peter Hurley <peter@hurleysoftware.com> wrote:
>
>> tcflow(TCOxxx) flow control is independent of IXON flow control.
>> The union of both flow states determines if the tty can output;
>>
>> IXON = true IXON = false
>> START STOP
>> tcflow(TCOON) on off on
>> tcflow(TCOOFF) off off off
>
> Thanks, that's pretty much what I had decided based on tests and
> browsing the source code.
>
> Just to confirm:
>
> tcflow(TCION/TCIOFF): overrides the "input" side of xon/xoff flow
> control and forces the sending of XON/XOFF.
>
> tcflow(TCOON/TCOOFF): does not have anything to do with the "output"
> side of xon/xoff flow control, but controls
> something completely orthogonal.
>
> That rather counter-intuitive (not that counter-intuitive is exactly a
> novel thing when it comes to Unix serial ports).
>
> That rasies this question: what does an application use to control the
> "output" side of xon/xoff flow control? There is a Windows API for
> doing that, and I get asked how to do it in Linux. I always tell them
> they can't.
I didn't explain this properly.
Both tcflow(TCOxxx) and receiving START/STOP when IXON == true control
the output flow.
For example,
ttyS0 = open("/dev/ttyS0", O_RDWR);
/* Disable ttyS0 output */
tcflow(ttyS0, TCOOFF);
/* writes to ttyS0 will now be buffered but not sent */
/* remote terminal sends START which is received, however sending is
* still disabled by tcflow()
*/
/* Enable ttyS0 output */
tcflow(ttyS0, TCOON);
/* ttyS0 output enabled, previously buffered writes are now sent */
/* remote terminal sends STOP which is received and ttyS0 output
* is now disabled (writes to ttyS0 will be buffered but not sent)
*/
tcflow(ttyS0, TCOON); <--- has no effect because flow was not previously
disabled by tcflow()
/* remote terminal sends START which is received and ttyS0 output
* is now enabled, previously buffered writes are now sent
*/
I did gloss over one special case: tcflow(TCOON) will re-enable output
_even if the remote terminal last sent STOP_ but only if output is also
disabled by tcflow(TCOOFF).
To me, the separate state tracking of tcflow() and START/STOP makes sense.
Regards,
Peter Hurley
prev parent reply other threads:[~2014-07-17 18:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 17:20 tcflow(TCOON/TCOOFF) vs. received XON/XOFF characters Grant Edwards
2014-07-17 13:09 ` Peter Hurley
2014-07-17 14:03 ` Grant Edwards
2014-07-17 18:18 ` Peter Hurley [this message]
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=53C81378.60606@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=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).