lkml.org 
[lkml]   [2018]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: serial: custom baud rate
Date
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!

\
 
 \ /
  Last update: 2018-05-14 17:39    [W:0.049 / U:5.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site