Re: [PATCH] jsm: fixing termios structure to be compatible with sttyapplication
From: Breno Leitao
Date: Thu Oct 01 2009 - 16:34:25 EST
Alan Cox wrote:
> NAK
>
> termios->c_ispeed/ospeed are the actual baud rates not bit encodings
Well, c_flag & CBAUD is the baud rate encoded in the Bfoo format.
> Use
>
> tty_termios_encode_baudrate(termios, ispeed, ospeed);
Well, let me explain you what I want to do.
Actually stty.c source code do:
tcsetattr (STDIN_FILENO, TCSADRAIN, &mode)
tcgetattr (STDIN_FILENO, &new_mode)
...
if (memcmp (&mode, &new_mode, sizeof (mode)) != 0)
error (EXIT_FAILURE, 0,....)
When I run stty -F /dev/ttyn0 speed 9600, the mode structure is different
from new_mode, causing that error.
Debugging those structure, I found that ispeed and ospeed were not set in the
Bfoo format, as expected, since mode->[o|i]speed are set in Bfoo format.
Hence, I just assigned ospeed and ispeed with the requested speed in Bfoo
format (c_flag & CBAUD).
I also tested the tty_termios_encode_baud_rate(), and it will basically do what
I did:
termios->c_ispeed = ibaud;
termios->c_ospeed = obaud;
Thanks for the review, and sorry if I missed the point completely.
Breno
--
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/