From 1e63fc2fcb3d965d1df95e20b192565915d32fe8 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Thu, 23 Feb 2023 19:03:03 +0000 Subject: 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 --- include/input/InputEventLabels.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/input/InputEventLabels.h') diff --git a/include/input/InputEventLabels.h b/include/input/InputEventLabels.h index 4668fce116..9dedd2b2da 100644 --- a/include/input/InputEventLabels.h +++ b/include/input/InputEventLabels.h @@ -30,6 +30,12 @@ struct InputEventLabel { 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 @@ public: static std::optional getLedByLabel(const char* label); + static EvdevEventLabel getLinuxEvdevLabel(int32_t type, int32_t code, int32_t value); + private: static const std::unordered_map KEYCODES; -- cgit v1.2.3-59-g8ed1b