summaryrefslogtreecommitdiff
path: root/include/input/InputEventLabels.h
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2023-02-23 19:03:03 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2023-02-23 19:06:39 +0000
commit1e63fc2fcb3d965d1df95e20b192565915d32fe8 (patch)
treea610b04422579ad7f127d7bacef9c2b15c10c636 /include/input/InputEventLabels.h
parentb2bd83cb33bb9dce0a441c5f0ff178d9a0c7f6e9 (diff)
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
Diffstat (limited to 'include/input/InputEventLabels.h')
-rw-r--r--include/input/InputEventLabels.h8
1 files changed, 8 insertions, 0 deletions
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<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;