Re: [RFC 2/4] tty: fix DTR/RTS not being dropped on hang up

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

 



On Wed, 2013-02-13 at 18:27 +0100, Johan Hovold wrote:
> Move HUPCL handling to port shutdown so that DTR/RTS is dropped also on
> hang up.
> 
> Currently a hung up port will return immediately from
> tty_port_close_start leaving DTR/RTS unchanged.
> ---
>  drivers/tty/tty_port.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
> index 57a061e..ffe3689 100644
> --- a/drivers/tty/tty_port.c
> +++ b/drivers/tty/tty_port.c
> @@ -198,11 +198,20 @@ EXPORT_SYMBOL(tty_port_tty_set);
>  
>  static void tty_port_shutdown(struct tty_port *port)
>  {
> +	struct tty_struct *tty = port->tty;
> +
>  	mutex_lock(&port->mutex);
>  	if (port->console)
>  		goto out;
>  
>  	if (test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) {
> +		/*
> +		 * Drop DTR/RTS if HUPCL is set. This causes any attached
> +		 * modem to hang up the line.
> +		 */
> +		if (!tty || tty->termios.c_cflag & HUPCL)
> +			tty_port_lower_dtr_rts(port);
> +

port->ops->shutdown() requires the hardware to reset anyway, including
the DTR/RTS state.



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


[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