This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Terminal interface and non-standard baudrates


On Tue, May 26, 2009 at 2:54 PM, Frank Schaefer<schaefer.frank@gmx.net> 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
version.

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]