linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Rogier Wolff <R.E.Wolff@BitWizard.nl>
Cc: Stuart MacDonald <stuartm@connecttech.com>,
	'Alan Cox' <alan@lxorguk.ukuu.org.uk>,
	"'linux-os (Dick Johnson)'" <linux-os@analogic.com>,
	'Krzysztof Halasa' <khc@pm.waw.pl>,
	'David Woodhouse' <dwmw2@infradead.org>,
	linux-serial@vger.kernel.org,
	'LKML' <linux-kernel@vger.kernel.org>
Subject: Re: Serial custom speed deprecated?
Date: Tue, 29 Aug 2006 08:46:10 +0100	[thread overview]
Message-ID: <20060829074610.GA29882@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060829062049.GA18752@bitwizard.nl>

On Tue, Aug 29, 2006 at 08:20:49AM +0200, Rogier Wolff wrote:
> On Mon, Aug 28, 2006 at 09:09:18PM +0100, Russell King wrote:
> > So, while I whole heartedly agree with passing baud rates
> > numerically, I do not think we need any of this inexact flagging
> > nonsense provided we implement something as userland programs expect
> > - iow, the POSIX behaviour.
> 
> I fully agree we should implement Posix behaviour. Wether that specifies
> what userland programmers expect is where I disagree. 
> 
> If you happen to change RTS/CTS at the same time as you change baud,
> the call will return succes, even though the most important part (for
> you) of your call failed. Note that if the succes of the call depends
> on the previous state of RTS/CTS. Thus the error will depend on
> whatever happened before. This creates difficult-to-diagnose problems
> for sysadmins.

I disagree.  POSIX recommends the following sequence when setting termios
modes:

	tcgetattr(fd, &termios);
	/* modify termios */
	if (tcsetattr(fd, &termios) == -1)
		/* whatever error handling, none of the modes worked */
	tcgetattr(fd, &real_termios);

and in that respect it's the classic negotiation between two differing
sets of code - the application asks for what it wants, and then requests
what it actually got.  It can then check real_termios to see if the
settings it actually got are compatible with what it wants to achieve.

For example, if it couldn't enable CRTSCTS, it might decide to use XON/
XOFF flow control instead.

If tcsetattr() were to return an error if _any_ mode failed, then you
wouldn't know if it failed because CRTSCTS wasn't supported, or the
baud rate, or maybe some other mode you asked for.  That's multiple
times worse, and it would actually result in lots of programs failing
just because one setting wasn't supported - and will result in more
sysadmins scratching their collective heads.

So, the key idea here is that fiddling with termios is a _negotiation_
between the application and the driver.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

  reply	other threads:[~2006-08-29  7:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <028a01c6c6fc$e792be90$294b82ce@stuartm>
     [not found] ` <1156411101.3012.15.camel@pmac.infradead.org>
     [not found]   ` <m3bqqap09a.fsf@defiant.localdomain>
2006-08-24 17:41     ` Serial custom speed deprecated? Alan Cox
2006-08-24 18:51       ` Krzysztof Halasa
2006-08-24 20:43         ` linux-os (Dick Johnson)
2006-08-24 22:11           ` Alan Cox
2006-08-27  6:52             ` Rogier Wolff
2006-08-27 10:00               ` Russell King
2006-08-28 14:14               ` Stuart MacDonald
2006-08-28 20:09                 ` Russell King
2006-08-29  6:20                   ` Rogier Wolff
2006-08-29  7:46                     ` Russell King [this message]
2006-08-25 15:17           ` Stuart MacDonald
2006-08-25 15:52             ` linux-os (Dick Johnson)
2006-08-24 22:43         ` Alan Cox
2006-08-25 10:58           ` Krzysztof Halasa
2006-08-25 15:21           ` Stuart MacDonald
2006-08-25 19:32             ` Russell King
2006-08-25 20:21               ` Stuart MacDonald
2006-08-25 20:54                 ` linux-os (Dick Johnson)
2006-08-25 20:39               ` Theodore Tso
2006-08-26 12:16                 ` Krzysztof Halasa
2006-08-25 15:10         ` Stuart MacDonald
2006-08-24 22:05       ` Russell King
2006-08-25 15:01       ` Stuart MacDonald
     [not found] <033001c6c77a$a7d8ab10$294b82ce@stuartm>
2006-08-24 13:19 ` Alan Cox
2006-08-24 13:03   ` David Woodhouse

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=20060829074610.GA29882@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dwmw2@infradead.org \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=stuartm@connecttech.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;
as well as URLs for NNTP newsgroup(s).