termios2 support

Mike Frysinger vapier at gentoo.org
Sat Jan 5 08:58:24 UTC 2008

On Tuesday 11 December 2007, Will Wagner wrote:
> I would like support for arbitrary baud rates with serial ports with
> through uclibc.
> I have looked at the uclibc code and there appear to be some support for
> this in kernel_termios.h but it is limited to alpha & powerpc. It also
> does not seem to use the kernel ioctl's TCGETS2 & TCSETS2 that are
> available with 2.6

not really.  the fact that the speed members exist in the termios struct for 
some ports is irrelevant so long as the TCGET/TCSET ioctl's are being used.  
for all the termios having different structures/layouts, the kernel 
implements the tty layer the same for everyone.  it's just the structure 
itself which has these stupid arch/ABI warts because it's exposed to 

> Can anyone suggest the best way to extend x86 so that it has support for
> c_ispeed & c_ospeed in the termios structure? I believe that with the
> 2.6 kernel all architectures ktermios struct contains c_ispeed &
> c_ospeed and so it could be added generically. Is that correct? Looks
> like TCGETS2 & TCSETS2 are supported on both x86 and arm, is that right?

you dont need libc support to access the functionality now ... you can cheat 
by doing:
#include <asm/termios.h>
#include <asm/ioctls.h>
	struct termios2 t;
	ioctl(fd, TCGETS2, &t);
	t.c_ospeed = t.c_ispeed = 543210;
	t.c_cflag &= ~CBAUD;
	t.c_cflag |= BOTHER;
	ioctl(fd, TCSETS2, &t);

i hesitate to add support for termios2 to uClibc in case the glibc guys 
implement things in a different way.  the last thing i want is that sort of 
ugly API incompatibility.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080105/098d957b/attachment-0002.pgp 

More information about the uClibc mailing list