This is the mail archive of the
mailing list for the glibc project.
Re: Terminal interface and non-standard baudrates
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Frank Schaefer <schaefer dot frank at gmx dot net>
- Cc: libc-help at sourceware dot org
- Date: Mon, 22 Jun 2009 08:56:36 -0400
- Subject: Re: Terminal interface and non-standard baudrates
- References: <4A1C3AC9.firstname.lastname@example.org>
On Tue, May 26, 2009 at 2:54 PM, Frank Schaefer<email@example.com> wrote:
> A question/feature request related to the terminal interface / serial port:
> On Linux, there are two possibilities to select non-standrad baudrates.
> The old/deprecated solution is to set the baudrate to B38400 and do an
> additional ioctl(... TIOCSSERIAL, struct serial_struct ) with a custom
> divisor and the ASYNC_SPD_CUST-flag selected in the serial_struct.
> The new solution (introduced in 2007 ?) is to ORe the c_cflag of struct
> termios with BOTHER (= CBAUDEX | B0). In this case, the
> c_ispeed/c_ospeed-fields contain the baudrate directly.
> I noticed that BOTHER is not defined/available when I include
> <termios.h> and that c_ispeed/c_ospeed always contain (c_cflag & CBAUD),
> so I assume that this is currently not supported by the C-library, right ?
> Would it be possible to add this feature to the C-library ?
Using BOTHER is not currently supported. My suggestion would be to
file a bug in the glibc bugzilla with a clear reference to the new
standard. If no such reference exists, then we have no proof that the
community has decided on a standard method.
Where are you seeing c_ispeed and c_ospeed always set with CBAUD?
In glibc head under sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr)
I see things like "termios_p->c_ispeed = k_termios.c_cflag & (CBAUD |
CBAUDEX);" when copying the kernel termios structure to the userspace