mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-20 23:10:06 +01:00
Pass linux/input.h as argument to make-event-names.py
Rather than a hardcoded path inside the source. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
2a3219f55d
commit
caa9267290
2 changed files with 6 additions and 7 deletions
|
|
@ -22,7 +22,7 @@ libevdevincludedir = $(includedir)/libevdev-1.0/libevdev
|
|||
libevdevinclude_HEADERS = libevdev.h libevdev-uinput.h
|
||||
|
||||
event-names.h: Makefile make-event-names.py
|
||||
$(PYTHON) $(srcdir)/make-event-names.py --output=c > $@
|
||||
$(PYTHON) $(srcdir)/make-event-names.py --output=c $(top_srcdir)/include/linux/input.h > $@
|
||||
|
||||
EXTRA_DIST = make-event-names.py
|
||||
CLEANFILES = event-names.h
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import re
|
|||
import sys
|
||||
import argparse
|
||||
|
||||
SOURCE_FILE = "/usr/include/linux/input.h"
|
||||
|
||||
class Bits(object):
|
||||
pass
|
||||
|
||||
|
|
@ -166,9 +164,7 @@ def parse_define(bits, line):
|
|||
b = getattr(bits, attrname)
|
||||
b[value] = name
|
||||
|
||||
def parse(path):
|
||||
fp = open(path)
|
||||
|
||||
def parse(fp):
|
||||
bits = Bits()
|
||||
|
||||
lines = fp.readlines()
|
||||
|
|
@ -180,11 +176,14 @@ def parse(path):
|
|||
return bits
|
||||
|
||||
if __name__ == "__main__":
|
||||
bits = parse(SOURCE_FILE)
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--output", default="c")
|
||||
parser.add_argument('source', metavar="/path/to/linux/input.h",
|
||||
type=argparse.FileType('r'),
|
||||
help='source file to parse')
|
||||
|
||||
args = parser.parse_args(sys.argv[1:])
|
||||
bits = parse(args.source)
|
||||
if args.output == "python":
|
||||
print_python_mapping_table(bits)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue