Re: [PATCH] USB: serial: cp210x: map B0 to B9600

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 28, 2022 at 11:08:25AM -0700, Alex Henrie wrote:
> On Monday, November 28, 2022 7:41:59 AM MST Johan Hovold wrote:
> > On Fri, Nov 25, 2022 at 08:58:25PM -0700, Alex Henrie wrote:
> > > When a baud rate of 0 is requested, both the 8250 driver and the FTDI
> > > driver reset the baud rate to the default of 9600 (see the comment above
> > > the uart_get_baud_rate function). Some old versions of the NXP blhost
> > > utility depend on this behavior.
> > 
> > What exactly do you mean by "depend on" here? Setting B0 is supposed to
> > hang up a modem connection by deasserting the modem control lines, but
> > there's nothing mandating any particular line speed to be set in
> > hardware. Why would that even matter?
> > 
> > If the user space tool is thrown off by the fact that B0 isn't
> > implemented, perhaps that's what should be addressed.
> 
> Oh, it's definitely a bug in blhost. The program sets the baud rate to 0, then 
> tries to communicate over the UART assuming that the baud rate is 9600. It's 
> been fixed in the latest version of blhost, but I'm stuck on an old version and 
> there's nothing I can do about that.
> 
> I don't know why the 8250 and FTDI drivers map B0 to B9600, however it's very 
> old behavior that must have had a purpose.

Heh, not everything has a purpose even if it's old.

For implementation and protocol reasons a driver may need to pick some
arbitrary speed to use for B0, but this is generally not needed for USB
serial devices and only about half of the drivers do so (and then tend
to pick 9600).

Also note that the FTDI driver does in fact leave the line speed
unchanged when B0 is requested (that zero-baud check in
get_ftdi_divisor() is only used for ASYNC_SPD_CUST).

> Maybe Russell knows? Alternatively, 
> leaving the baud rate unchanged seems like reasonable behavior and would also 
> work with the old blhost. But mapping B0 to B300 makes even less sense than 
> mapping it to B9600.

Your application really should not depend on any particular hardware
setting after requesting B0.

That said, I've implemented support for B0 in cp210x which leaves the
current settings unchanged (and which incidentally allows you to
use the buggy tool).

Johan



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux