From: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
To: Grant Edwards <grant.b.edwards@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: serial: custom baud rate
Date: Sun, 13 May 2018 20:57:26 +0100 [thread overview]
Message-ID: <20180513205726.5029c88a@alans-desktop> (raw)
In-Reply-To: <pcfka2$gie$1@blaine.gmane.org>
On Thu, 3 May 2018 18:27:14 +0000 (UTC)
Grant Edwards <grant.b.edwards@gmail.com> wrote:
> On 2018-05-03, Muni Sekhar <munisekharrms@gmail.com> wrote:
>
> > If I need to set a custom baud rates(e.g. 14400, 128000, 256000), does
> > Linux serial framework has any supporting method?
>
> Sure, use the termios2 structure instead of the termios structure:
>
> #include <linux/termios.h>
>
> struct termios2 t;
>
> ioctl(fd, TCGETS2, &t)
>
> t.c_cflag &= ~CBAUD;
> t.c_cflag |= BOTHER;
> t.c_ispeed = baud;
> t.c_ospeed = baud;
>
> ioctl(fd, TCSETS2, &t)
>
> [Not all devices/drivers support termios2]
That shouldn't be true - all devices get passed ispeed/ospeed and
everything in tree was using the correct fields as far as I could tell
last time I checked this
Alan
next prev parent reply other threads:[~2018-05-13 19:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 12:39 serial: custom baud rate Muni Sekhar
2018-05-03 17:54 ` Theodore Y. Ts'o
2018-05-04 9:04 ` Muni Sekhar
2018-05-04 13:59 ` Theodore Y. Ts'o
2018-05-14 17:24 ` Andy Shevchenko
2018-05-03 18:27 ` Grant Edwards
2018-05-13 19:57 ` Alan Cox [this message]
2018-05-14 15:36 ` Grant Edwards
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=20180513205726.5029c88a@alans-desktop \
--to=gnomes@lxorguk.ukuu.org.uk \
--cc=grant.b.edwards@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox