Re: [RFC PATCH] serial: core: fix tcdrain() with CTS enabled

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

 



On Thu, Feb 03, 2022 at 03:23:37PM +0100, Tomasz Moń wrote:
> Do not set timeout to twice the approximate amount of time to send the
> entire FIFO if CTS is enabled. If the caller requested no timeout, e.g.
> when userspace program called tcdrain(), then wait without any timeout.
> 
> Premature return from tcdrain() was observed on imx based system which
> has 32 character long transmitter FIFO with hardware CTS handling.
> 
> Simple userspace application that reproduces problem has to:
>   * Open tty device, enable hardware flow control (CRTSCTS)
>   * Write data, e.g. 26 bytes
>   * Call tcdrain() to wait for the transmitter
>   * Close tty device
> 
> The other side of serial connection has to:
>   * Receive some data, e.g. 10 bytes
>   * Set RTS output (CTS input from sender perspective) inactive for
>     at least twice the port timeout
>   * Try to receive remaining data
> 
> Without this patch, userspace application will finish without any error
> while the other side of connection will never receive remaining data.
> 
> Signed-off-by: Tomasz Moń <tomasz.mon@xxxxxxxxxxxxxxx>
> ---
>  drivers/tty/serial/serial_core.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)

Note, I do not apply "RFC" patches as obviously the submitter does not
think they are good enough to be merged :)

thanks,

greg k-h



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux