Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd02a47b authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Fix generation of event labels for getevent.

The recent uapi header update moved all the interesting constants
out into another file. Track that, and add the missing makefile
dependency.

Bug: http://b/27073568
Change-Id: I8ac1dd1122865479f69a76cbf427d4aacdf7b790
parent ead369bd
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -80,10 +80,16 @@ $(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
INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py > $@
$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py
# The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late.
# We copy the input path so it can't be accidentally modified later.
$(INPUT_H_LABELS_H): PRIVATE_UAPI_INPUT_EVENT_CODES_H := $(UAPI_INPUT_EVENT_CODES_H)
$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py $(PRIVATE_UAPI_INPUT_EVENT_CODES_H) > $@
# The dependency line though gets evaluated now, so the PRIVATE_ copy doesn't exist yet,
# and the original can't yet have been modified, so this is both sufficient and necessary.
$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py $(UAPI_INPUT_EVENT_CODES_H)
$(INPUT_H_LABELS_H):
	$(transform-generated-source)

+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

import os
import re
import sys

input_prop_list = []
ev_list = []
@@ -36,7 +37,7 @@ ff_list = []

r = re.compile(r'#define\s+(\S+)\s+((?:0x)?\d+)')

with open('bionic/libc/kernel/uapi/linux/input.h', 'r') as f:
with open(sys.argv[1], 'r') as f:
  for line in f:
    m = r.match(line)
    if m: