lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 3 May 2018 18:27:14 +0000 (UTC)
From:   Grant Edwards <grant.b.edwards@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     linux-serial@...r.kernel.org
Subject: Re: serial: custom baud rate

On 2018-05-03, Muni Sekhar <munisekharrms@...il.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]

-- 
Grant Edwards               grant.b.edwards        Yow! Are we live or on
                                  at               tape?
                              gmail.com            

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ