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.
This commit is contained in:
Elliott Hughes 2016-06-29 14:12:29 -07:00
parent 54c121962b
commit b22b9987a8
2 changed files with 35 additions and 34 deletions

View File

@ -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.

View File

@ -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))