[Lcdproc] [PATCH] include asm/termbits.h instead of termios.h in hd44780-serial.c
Peter Marschall
peter@adpm.de
Fri Apr 27 14:50:01 2007
Hi,
On Thursday, 26. April 2007 21:03, FoX wrote:
> 2007/4/26, Peter Marschall <peter@adpm.de>:
> > As I already wrote in another reply to your post, these patches will not
> > make it into LCDproc mainline as they break other configurations.
>
> Hi all, sorry for answering so late but I've been a bit busy these days.
>
> > Would you mind to describe what the exact problem is that these patches
> > are trying to solve.
>
> First of all, we use a custom toolchain build from linux kernel
> sources + gcc + uClibc.
> The kernel headers are installed as every other package : our custom
> packages tree.
> The install script installs headers in $SYSROOT_PREFIX/usr/include.
>
> > Maybe we can come up with a solution that works on all systems.
> >
> > If it is only the definition of the one baud rate definition (B230400)
> > then a simple
> >
> > #if defined(B230400)
> > ...
> > #endif
> > like for the other hiher baud rates might do the trick.
>
> The configure.in mod by paul_c reveals that my <termios.h>
> ($SYSROOT_PREFIX/usr/include/termios.h) hasn't the B230400 definition.
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).
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].
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.
Regards
Peter
--
Peter Marschall
peter@adpm.de