linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Edwards <grant.b.edwards@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Subject: Re: serial: custom baud rate
Date: Mon, 14 May 2018 15:36:56 +0000 (UTC)	[thread overview]
Message-ID: <pdcaeo$d04$1@blaine.gmane.org> (raw)
In-Reply-To: 20180513205726.5029c88a@alans-desktop

On 2018-05-13, Alan Cox <gnomes@lxorguk.ukuu.org.uk> wrote:
> 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

Yep, my mistake.  It looks like the driver where I last ran into this
was an old out-of-tree driver.

-- 
Grant Edwards               grant.b.edwards        Yow! Mary Tyler Moore's
                                  at               SEVENTH HUSBAND is wearing
                              gmail.com            my DACRON TANK TOP in a
                                                   cheap hotel in HONOLULU!

      reply	other threads:[~2018-05-14 15:36 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
2018-05-14 15:36     ` Grant Edwards [this message]

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='pdcaeo$d04$1@blaine.gmane.org' \
    --to=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;
as well as URLs for NNTP newsgroup(s).