[PATCH evemu 3/4] make-event-names: use input.h from sysroot (instead of host system version)

Peter Hutterer peter.hutterer at who-t.net
Sun Aug 10 14:27:23 PDT 2014


On Sun, Aug 10, 2014 at 07:46:01PM +0200, Peter Seiderer wrote:
> On Sat, Aug 09, 2014 at 05:49:31PM +1000, Peter Hutterer wrote:
> Hello Peter,
> 
> > On 9/08/2014 08:18 , Peter Seiderer wrote:
> > >Signed-off-by: Peter Seiderer <ps.report at gmx.net>
> > 
> > tbh, it'd be easier if we just ship our own input.h in evemu. that
> > way we never have to worry about compilation errors with new kernel
> > headers.
> > 
> 
> I think this is the wrong approach, header file duplication is first
> step towards compatibility mismatches. I think the clean way is to
> use the toolchain/linux kernel version (e.g for evemu users with
> very old kernels or old evemu releases with newer (past evemu
> release) kernel)...

the predictability of evemu is actually higher if we ship the header file.
before, we had builds fail on older kernels because we didn't ifdef out the
code paths correctly. if we ship the header, we know that a build on one
kernel will build on any other kernel.

evemu only uses the kernel's public API, which is set in stone (and it uses
it through libevdev anyway). And the API surface is small enough that we
actually know the behaviour of older kernels for newer defines. and in
almost all cases, it's harmless.

so from a maintenance point of view, updating the shipped header file every
couple of months when a new kernel comes out is a lot easier to handle that
fixing the build errors on random kernels when they come in.

Cheers,
   Peter

PS: the holy grail would be to get all this from libevdev anyway, in which
case the question becomes moot.

> > >---
> > >  src/make-event-names.py | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > >diff --git a/src/make-event-names.py b/src/make-event-names.py
> > >index 2d0924d..945d473 100755
> > >--- a/src/make-event-names.py
> > >+++ b/src/make-event-names.py
> > >@@ -10,8 +10,10 @@ from __future__ import print_function
> > >  import argparse
> > >  import re
> > >  import sys
> > >+import os
> > >
> > >-SOURCE_FILE = "/usr/include/linux/input.h"
> > >+# environment variable SYSROOT set by buildroot for cross-compilation
> > >+SOURCE_FILE = os.environ.get('SYSROOT', '') + "/usr/include/linux/input.h"
> > >
> > >  class Bits(object):
> > >     pass
> > >
> > 
> > 


More information about the Input-tools mailing list