On Monday, November 28, 2022 11:20:41 AM MST Russell King (Oracle) wrote: > What exactly do you think should be done when a baud rate of zero is > requested? I see two reasonable options: Leave the baud rate alone, or reset it to the default (i.e. 9600). In my opinion, either of those options is just fine. > The fact of the matter is that at hardware level, the UART takes a > clock, and divides that down. To get to a baud rate of zero, one > would need an infinitely large divisor, which (a) is impossible to > program into the hardware and (b) would trigger a divide-by-zero > error in the kernel. So, we have to choose something. > > That decision was made before my time, when Ted Ts'o was maintaining > what was the original serial.c 8250-based driver, and the behaviour > he adopted was to set a baud rate of 9600 when B0 was requested, > which is reasonable - 9600 baud is the default setting. > > POSIX (which is what we use to define the behaviour of the TTY layer, > or at least what we _used_ to) doesn't specify the behaviour of B0 > as the output rate, other than it shall cause the model control lines > to be deasserted. What baud rate you get on the line is unspecified, > and thus left up to the implementation. > > So basically, 9600 baud for B0 is the behaviour of the 8250 driver > going back to the very early Linux versions and that has become the > standard Linux implementation shared by a great many serial drivers. > In effect, it's almost a de-facto standard. That is really interesting, thanks for the explanation! I like the idea of having consistent behavior across the Linux serial drivers, so it seems to me that mapping B0 to B9600 in all drivers is the way to go. -Alex