Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Nov 2004 14:45:56 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/dev/uart uart_subr.c 
Message-ID:  <F24090C6-368E-11D9-AA57-000D93C47836@xcllnt.net>
In-Reply-To: <57113.1100468445@critter.freebsd.dk>
References:  <57113.1100468445@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Nov 14, 2004, at 1:40 PM, Poul-Henning Kamp wrote:

>>  Make sure the baudrate specified with the BR tag is somewhat sane.
>>  A baudrate we consider insane is silently replaced with 0. When the
>>  baudrate is 0, we will not try to program the hardware. Instead we
>>  leave the communication speed unaltered, maximizing the chance to
>>  have a working console. Obviously this means we allow specifying a
>>  0 baudrate for exactly that purpose.
>
> Setting a zero speed used to have magic meaning, sometimes sending
> a break, on other systems it would hang up the line.  Overloading
> with yet a meaning may not be a good idea.  (I'm not sure what
> the standards demand btw).

Yes, a 0 baudrate does have special meaning in the higher layers and
process inferfaces. And currently when you specify a 0 baudrate for
the serial console, it interferes at the TTY layer to the extend that
tcsetattr(3) and getty(8) stop functioning. You can and could already
specify a baudrate of -1 and it will and would just work.

However for various reasons it's better and more convenient to use 0
and make sure this value doesn't propagate up to the TTY layer. This
I'm testing currently. It makes the whole thing much more robust in
the end. The various reasons include:
o  0 is a more user-friendly value than -1 (i.e. more intuitive).
o  Any uninitialized variable is implicitly 0, not -1.
o  0 works for signed and unsigned types.
o  There's no confusion possible between the different meanings of 0,
    because there's no domain overlap.

So, I don't see a problem. Especially because the sysadmin can use -1
for the loader variables to achieve exactly the same.

-- 
  Marcel Moolenaar         USPA: A-39004          marcel@xcllnt.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F24090C6-368E-11D9-AA57-000D93C47836>