[Lcdproc] [PATCH] include asm/termbits.h instead of termios.h in hd44780-serial.c

FoX foxcore@gmail.com
Fri Apr 27 15:07:02 2007


2007/4/27, Peter Marschall <peter@adpm.de>:
> O.K, so it is only about the missing definition of B230400 in <termios.h>.
>
> As a first quick fix, I have #ifdef'd this one mapping in CVS (MAIN, not in
> stable) so that hd44780-serial.c should compile with your toolchain as well.
>
> > Obviously, <asm/termios.h> includes <asm/termbits.h> which hosts B230400.
> > That's he reason of such a patch.
>
> Right, but the problem is that header files from /usr/include/asm/
> shall not be used in userland programs directly with glibc.
> (see Rene's and my previous post).

I was not justifying the patch itself, but why I sent it. I totally
admit this patch is an ugly hack that has nothing to do in your trunk
;) .

> Thus the maximum that I am willing to accept (i.e. I will not code it myself)
> is a combination of
> 1) a configure check that exclicitely checks for the GeexBox
>   toolchain and defines a preprocessor constant (e.g. __GEEXBOX__)
> 2) the inclusion of <asm/termio.h> hideen behind #ifdef __GEEXBOX_
>
> 2) can also get included alone, forcing you (or any other GeexBox user)
> to call ./configure with a command line like
>   CPPFLAGS=-D__GEEXBOX__ ./configure ....
>
> The check in 1) needs to be as specific to the GeexBox toolchain as possible.
> I.e. it has to be a positive check for GeexBox, not a negative one that only
> checks for the existence of <asm/termios.h> [fails if termios.h does not
> contain the definition for B230400] or whether B230400 is defined in
> <termios.h> [fails if neither <termios.h> nor <asm/termios.h> define
> B230400].

And I found the reason inside bits/termios.h from uClibc, included by
<termios.h> :

#if 0 /* limited on uClibc, keep in sync w/ cfsetspeed.c */
#define  B230400  0010003
#define  B460800  0010004
#define  B500000  0010005
#define  B576000  0010006
#define  B921600  0010007
#define  B1000000 0010010
#define  B1152000 0010011
#define  B1500000 0010012
#define  B2000000 0010013
#define  B2500000 0010014
#define  B3000000 0010015
#define  B3500000 0010016
#define  B4000000 0010017
#define __MAX_BAUD B4000000
#else
#define __MAX_BAUD B115200
#endif

So I think that the special geexbox case can be enlarged to every
uClibc crosscompilation.

> Of course, the simplest solution is the quick fix above.
> If you can live with the fact that the max. bitrate allowed with
> GeexBox is 115200 baud, then we can leave it this way.

I can live with it of course :p
I'm just trying to find a way not to have a geexbox special patch for
lcdproc in our package, to ease maintainance.


-- 
Guillaume LECERF
GeeXboX developer