slattach set tty speed to 0

Denys Vlasenko vda.linux at googlemail.com
Tue Sep 16 21:28:27 UTC 2008


On Tuesday 16 September 2008 09:54, Matthieu CASTET wrote:
> Hi,
> 
> the busybox slattach seem to have a bug.
> If the baudrate speed is not on the commandline, and we are not in raw mode,
> then we will write the c_cflag, but we are not keeping the old baudrate
> value
> (CBAUD*).
> This mean our baudrate will be B0. And according to man [1], this mean
> hangup.
> What I see is that in linux kernel uart_set_termios, it ask the uart
> driver to
> assert nRTS (via uart_clear_mctrl(state->port, TIOCM_RTS | TIOCM_DTR);)
> and the
> other side can't send nothing to us.
> 
> A possible fix could be to do something like [2]
> 
> 
> Matthieu
> 
> [1]
> Setting  the  speed to B0 instructs the modem to "hang up".
> 
> [2]
> --- /tmp/slattach.c	2008-09-15 14:10:47.000000000 +0200
> +++ /tmp/slattach-n.c	2008-09-15 14:10:28.000000000 +0200
> @@ -206,6 +206,8 @@
>  		state.c_cflag = CS8 | HUPCL | CREAD
>  		              | ((opt & OPT_L_local) ? CLOCAL : 0)
>  		              | ((opt & OPT_F_noflow) ? 0 : CRTSCTS);
> +		cfsetispeed(&state, cfgetispeed(&saved_state));
> +		cfsetospeed(&state, cfgetospeed(&saved_state));
>  	}
> 
>  	if (opt & OPT_s_baud) {

Applied, thanks!
--
vda



More information about the busybox mailing list