mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-21 02:40: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
|
libevdevinclude_HEADERS = libevdev.h libevdev-uinput.h
|
||||||
|
|
||||||
event-names.h: Makefile make-event-names.py
|
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
|
EXTRA_DIST = make-event-names.py
|
||||||
CLEANFILES = event-names.h
|
CLEANFILES = event-names.h
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
SOURCE_FILE = "/usr/include/linux/input.h"
|
|
||||||
|
|
||||||
class Bits(object):
|
class Bits(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -166,9 +164,7 @@ def parse_define(bits, line):
|
||||||
b = getattr(bits, attrname)
|
b = getattr(bits, attrname)
|
||||||
b[value] = name
|
b[value] = name
|
||||||
|
|
||||||
def parse(path):
|
def parse(fp):
|
||||||
fp = open(path)
|
|
||||||
|
|
||||||
bits = Bits()
|
bits = Bits()
|
||||||
|
|
||||||
lines = fp.readlines()
|
lines = fp.readlines()
|
||||||
|
|
@ -180,11 +176,14 @@ def parse(path):
|
||||||
return bits
|
return bits
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
bits = parse(SOURCE_FILE)
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--output", default="c")
|
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:])
|
args = parser.parse_args(sys.argv[1:])
|
||||||
|
bits = parse(args.source)
|
||||||
if args.output == "python":
|
if args.output == "python":
|
||||||
print_python_mapping_table(bits)
|
print_python_mapping_table(bits)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue