Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Mikael Johansson <mikael.lars.johansson@axis.com>
To: linux-serial@vger.kernel.org
Cc: Mikael Starvik <starvik@axis.com>,
	Jesper Nilsson <jespern@axis.com>,
	Johan Adolfsson <johana@axis.com>
Subject: artpec.c / serial_core.c hardware flow control problem
Date: Thu, 28 Jun 2012 17:29:27 +0200	[thread overview]
Message-ID: <4FEC7857.6010006@axis.com> (raw)

Greetings,

We have a problem with drivers/serial/artpec.c (Not yet in main tree) 
which uses hardware supported flow control (XON/XOFF). We do cfmakeraw() 
and tcsetattr() from userspace to set a termios struct where (c_iflag & 
IXON) is not set. The problem is that the call to tcsetattr() is not 
propagated down to serial_artpec_set_termios(), the reason being that 
uart_set_termios() doesn't think that IXON is a RELEVANT_IFLAG and 
returns prematurely instead of calling uart_change_speed --> 
ops->set_termios().

Could this be fixed by making IXON a RELEVANT_IFLAG?:

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 7f28307..d45473d 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1211,7 +1211,7 @@ static void uart_set_termios(struct tty_struct *tty,
       * bits in c_cflag; c_[io]speed will always be set
       * appropriately by set_termios() in tty_ioctl.c
       */
-#define RELEVANT_IFLAG(iflag)    ((iflag) & 
(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
+#define RELEVANT_IFLAG(iflag)    ((iflag) & 
(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|IXON))
      if ((cflag ^ old_termios->c_cflag) == 0 &&
          tty->termios->c_ospeed == old_termios->c_ospeed &&
          tty->termios->c_ispeed == old_termios->c_ispeed &&


Or should it be fixed at some other level?

Note: This was tested on 2.6.35 but appears to have the same code in the 
newer kernels. Not many drivers seem to look at the IXON flag, only 
crisv10, omap_serial and jsm_neo.

Best regards,
Mikael Johansson


             reply	other threads:[~2012-06-28 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 15:29 Mikael Johansson [this message]
2012-06-28 16:24 ` artpec.c / serial_core.c hardware flow control problem Alan Cox
2012-06-29 15:16   ` Johan Adolfsson
2012-06-29 16:31     ` Alan Cox

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=4FEC7857.6010006@axis.com \
    --to=mikael.lars.johansson@axis.com \
    --cc=jespern@axis.com \
    --cc=johana@axis.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=starvik@axis.com \
    /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