drm_hwcomposer: Add test utility to listen for uevents
Dumping uevents is useful for debugging purposes.
1. Extract logic related to uevent socket into utils/UEvent.h class.
2. Use it by both UEventListener.cpp and tests/uevent_print.cpp.
Bump clang-tidy level of UEventListener.cpp to normal.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/tests/uevent_print.cpp b/tests/uevent_print.cpp
new file mode 100644
index 0000000..6ffbbfb
--- /dev/null
+++ b/tests/uevent_print.cpp
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: Apache-2.0
+
+#include <iostream>
+
+#include "utils/UEvent.h"
+
+int main() {
+ auto uevent = android::UEvent::CreateInstance();
+ if (!uevent) {
+ std::cout << "Can't initialize UEvent class" << std::endl;
+ return -ENODEV;
+ }
+
+ int number = 0;
+ for (;;) {
+ auto msg = uevent->ReadNext();
+ if (!msg) {
+ continue;
+ }
+
+ std::cout << "New event #" << number++ << std::endl
+ << *msg << std::endl
+ << std::endl;
+ }
+}