Re: tty/serial: Need clarification on Support for 4+M Baudrate

From: Alan Cox
Date: Thu Jan 12 2012 - 09:38:25 EST


On Thu, 12 Jan 2012 15:20:46 +0100
Rajanikanth H V <rajanikanth.hv@xxxxxxxxxxxxxx> wrote:

> Alan,
>
> FYI: I am not using application, rather I have a Bluetooth driver invoking
> encode_baud_rate(...), please find log below.
>
> I made sure that c_ispeed = c_ospeed = 4.05M Baud, however I see
> tty_termios_encode_baud_rate(...) is normalizing to 4.0
>
>
> manual trace log below:
> ======================================================================================
>
> 4.05M Arbitrary Baud Setting Sequence:
> [ 9.664703] alloc_set_baud_rate_cmd Setting arbitrary baudrate using BOTHER baudrate:89 c_cflag:020000016262
> [ 9.774658] XXXXXX_hci_uart_set_baudrate c_cflag:020000016262 baud:4050000

4050000 seems a bit odd - you want cflag&CBAUD == BOTHER so I'd expect
the low bits to end rather different things to 6262 ?

So something like

struct ktermios new = *tty->termios;
new.c_cflag &= ~(CBAUD|CIBAUD);
new.c_cflag |= BOTHER;
new.c_ispeed = 4050000;
new.c_ospeed = 4050000;
tty_set_termios(tty, &new); /* Can sleep */

/* Returned new will now hold actual values selected */

should do the trick providing the low level driver supports the rate.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/