Hi Peter,
Sorry about the late reply, a bit short on time at the moment.
On Tue, Oct 02, 2018 at 01:07:00PM -0700, H. Peter Anvin wrote:
> Hi Johan et al,
>
> I'm trying to figure out what the status is of BOTHER and termios2 is in
> various architectures, and I saw these patches:
>
> 1cee38f0363a88db374e50b232ca17b9a4c12fa0
> fefe287e4bf6ee23a5d9422a0a49de5389acc712
>
> As you might know glibc never implemented this stuff, and I'm trying to fix
> that.
Nice to see someone picking this up.
> One of their questions is whether there are architectures on which
> capability does *NOT* exist at this point.
>
> If you could help straighten this out it would be great.
>
> Specifically, are there any platforms:
>
> 1. where simply stuffing values into c_ispeed or c_ospeed and setting BOTHER
> can be used to set the baud rate, even for the "standard" baud rates
> (obviously breaking if the kernel is too old -- how old is that?)
This should work on all archs that define BOTHER and IBSHIFT (for input
rates), and also to set standard rates (c_cflag would get updated to a
Bfoo value).
Alan added this (modulo some follow-up fixes) in edc6afc54968 ("[PATCH]
tty: switch to ktermios and new framework").
> 2. where c_ispeed and c_ospeed aren't set, even if the value in c_cflags isn't
> BOTHER?
These should always be set.
> 3.
>
> Also:
>
> 4. I note alpha -- apparently as the only architecture -- doesn't define
> BOTHER, even though it has B* constants that aren't the same as the
> corresponding baud rates. It does, however, have c_[io]speed in its
> legacy struct termios. Do you happen to know how this
> is supposed to work on Alpha? There are claims that Alpha doesn't need it,
> yet I see absolutely no support code for actually setting arbitary
Haven't looked that closely at alpha, but I'm pretty sure setting
c_[io]speed will not work unless BOTHER is defined (and set).
> In fact, as far as I can tell, we could actually end up overrunning the
> baud_table[] array on Alpha, as the limit check is only done on cbaud &
> CBAUDEX, and CBAUDEX on Alpha is zero, yet Alpha has 32 possible values for
> c_cflags & CBAUD, and the array is only 31 entries long.
That appears to be the case, yes.
> Should we just
>
> #define BOTHER 037
>
> on Alpha, which ought to solve both problems, or is there a solution that
> works even on legacy kernels?
Looks like a nice and simple solution.
Johan