From b22b9987a88f524986c5e40323bfbbb3bb943290 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 29 Jun 2016 14:12:29 -0700 Subject: [PATCH] Fix the generated getevent labels. Some of the less-used stuff stayed behind in input.h, so we need to parse both files. Change-Id: Iff2b6e3fc4f5a6584169d12f16427b4f235da21a Test: manual inspection of the generated file. --- toolbox/Android.mk | 2 +- toolbox/generate-input.h-labels.py | 67 +++++++++++++++--------------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/toolbox/Android.mk b/toolbox/Android.mk index 23af1f9bc..ad8ac03f4 100644 --- a/toolbox/Android.mk +++ b/toolbox/Android.mk @@ -73,7 +73,7 @@ $(TOOLS_H): $(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h -UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input-event-codes.h +UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input.h bionic/libc/kernel/uapi/linux/input-event-codes.h INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h $(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) # The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late. diff --git a/toolbox/generate-input.h-labels.py b/toolbox/generate-input.h-labels.py index a2b911165..c0e9fce6e 100755 --- a/toolbox/generate-input.h-labels.py +++ b/toolbox/generate-input.h-labels.py @@ -38,39 +38,40 @@ ff_list = [] r = re.compile(r'#define\s+(\S+)\s+((?:0x)?\d+)') -with open(sys.argv[1], 'r') as f: - for line in f: - m = r.match(line) - if m: - name = m.group(1) - if name.startswith("INPUT_PROP_"): - input_prop_list.append(name) - elif name.startswith("EV_"): - ev_list.append(name) - elif name.startswith("SYN_"): - syn_list.append(name) - elif name.startswith("KEY_") or name.startswith("BTN_"): - key_list.append(name) - elif name.startswith("REL_"): - rel_list.append(name) - elif name.startswith("ABS_"): - abs_list.append(name) - elif name.startswith("SW_"): - sw_list.append(name) - elif name.startswith("MSC_"): - msc_list.append(name) - elif name.startswith("LED_"): - led_list.append(name) - elif name.startswith("REP_"): - rep_list.append(name) - elif name.startswith("SND_"): - snd_list.append(name) - elif name.startswith("MT_TOOL_"): - mt_tool_list.append(name) - elif name.startswith("FF_STATUS_"): - ff_status_list.append(name) - elif name.startswith("FF_"): - ff_list.append(name) +for arg in sys.argv[1:]: + with open(arg, 'r') as f: + for line in f: + m = r.match(line) + if m: + name = m.group(1) + if name.startswith("INPUT_PROP_"): + input_prop_list.append(name) + elif name.startswith("EV_"): + ev_list.append(name) + elif name.startswith("SYN_"): + syn_list.append(name) + elif name.startswith("KEY_") or name.startswith("BTN_"): + key_list.append(name) + elif name.startswith("REL_"): + rel_list.append(name) + elif name.startswith("ABS_"): + abs_list.append(name) + elif name.startswith("SW_"): + sw_list.append(name) + elif name.startswith("MSC_"): + msc_list.append(name) + elif name.startswith("LED_"): + led_list.append(name) + elif name.startswith("REP_"): + rep_list.append(name) + elif name.startswith("SND_"): + snd_list.append(name) + elif name.startswith("MT_TOOL_"): + mt_tool_list.append(name) + elif name.startswith("FF_STATUS_"): + ff_status_list.append(name) + elif name.startswith("FF_"): + ff_list.append(name) def Dump(struct_name, values): print('static struct label %s[] = {' % (struct_name))