On Thu, May 11, 2017 at 09:12:48PM +0300, Peter Mamonov wrote:
> The patch implements TIOCSSERIAL ioctl call. The following fields of the
> `struct serial_struct` are processed:
> 
> - flags: ASYNC_SPD_MASK bits are processed.
> 
> - baud_base: allow a user to specify arbitrary value less or equal the
>   maximum port speed. Use it later in conjunction with custom_divisor to
>   calculate the desired baud rate.
> 
> - custom_divisor: save a user supplied value, use it later for baud rate
>   calculation.
> 
> Custom baud rate may be applied using any combination of baud_base /
> custom_divisor as follows:
> 
>       # stty -F /dev/ttyUSBX 38400
>       # setserial /dev/ttyUSBX baud_base 1000 divisor 1 spd_cust # 1 kBaud
>       # setserial /dev/ttyUSBX baud_base 42000 divisor 42 spd_cust # 1 kBaud
> 
> The patch is based on the code from the drivers/usb/serial/ftdi_sio.c.
> 
> Signed-off-by: Peter Mamonov <pmamo...@gmail.com>

First, sorry for not getting back to you sooner on this one.

The short story is that setting the speed using TIOCSSERIAL has been
deprecated for a very long time, and the alt-speed handling (e.g.
SPD_WARP) has been broken in tty core for about four years without
anyone noticing.

I've cleaned this up now, and specifically added a deprecation warning
also to ftdi_sio.

Instead you should be using BOTHER and the "new" TCSETS2 ioctl for
setting non-standard baud rates. It's a bit cumbersome to use due to
missing libc support, but it is the right interface for this.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to