On Tue, 23 Aug 2022, Ilpo Järvinen wrote: > > My only concern is whether `tty_termios_baud_rate' > > can ever return 0 for `old_termios', which would of course never happen > > with `uart_get_baud_rate'. > > dz_encode_baud_rate() disallows 0 as baud rate. I don't understand what > you're trying to say here. I asked a question in case someone knew a definite answer offhand. > > But new code seems to me to be doing the right thing anyway. That is if > > we're getting out of a hangup (which we don't currently handle with the > > modem lines anyway, but that's quite a different and complex matter) with > > an invalid baud rate, then we'll fail to encode it, then fail to encode 0, > > and finally resort to 9600 baud and write it back to `termios'. So we'll > > get out of a hangup with a baud rate different to one requested, but that > > is as much as we can do in that case: we have fulfilled the request the > > best we could and `uart_get_baud_rate' would set the rate to 9600 baud > > anyway. > > This I kind of agree with but given the precondition where 0 baud rate is > always rejected by dz_encode_baud_rate(), I don't think this scenario can > materialize at all? It was easier for me to just verify we'd do the right thing should the old rate ever be 0 than to prove it could not. You don't always have to get to the bottom of something to know the right answer. Maciej