Improve logging of evdev events by using labels for recognized values
When logging evdev events, use the human-readable labels for recognized
values for the event type, the event code, and event value.
Bug: 193231132
Test: Manual, by enabling raw events logging:
setprop log.tag.InputReaderRawEvents DEBUG
Change-Id: I8ed700a1e2d8659031514d2d8f9aef420b129dbc
diff --git a/include/input/InputEventLabels.h b/include/input/InputEventLabels.h
index 4668fce..9dedd2b 100644
--- a/include/input/InputEventLabels.h
+++ b/include/input/InputEventLabels.h
@@ -30,6 +30,12 @@
int value;
};
+struct EvdevEventLabel {
+ std::string type;
+ std::string code;
+ std::string value;
+};
+
// NOTE: If you want a new key code, axis code, led code or flag code in keylayout file,
// then you must add it to InputEventLabels.cpp.
@@ -52,6 +58,8 @@
static std::optional<int> getLedByLabel(const char* label);
+ static EvdevEventLabel getLinuxEvdevLabel(int32_t type, int32_t code, int32_t value);
+
private:
static const std::unordered_map<std::string, int> KEYCODES;