From: Breno Leitao <leitao@linux.vnet.ibm.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] jsm: fixing termios structure to be compatible with stty application
Date: Thu, 01 Oct 2009 17:34:12 -0300 [thread overview]
Message-ID: <4AC51244.1010600@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090930213140.4172748f@lxorguk.ukuu.org.uk>
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
next prev parent reply other threads:[~2009-10-01 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-30 16:18 [PATCH] jsm: fixing termios structure to be compatible with stty application leitao
2009-09-30 20:31 ` Alan Cox
2009-10-01 20:34 ` Breno Leitao [this message]
2009-10-01 21:10 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC51244.1010600@linux.vnet.ibm.com \
--to=leitao@linux.vnet.ibm.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.