From 851f935fe1bfcd42775cf50449d21cfadf1007c1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 19 May 2025 15:23:24 +1000 Subject: [PATCH] tools: print missing event types in the demo client Instead of aborting, print something useful Part-of: --- tools/ei-demo-client.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/ei-demo-client.c b/tools/ei-demo-client.c index c69b81e..4bc8739 100644 --- a/tools/ei-demo-client.c +++ b/tools/ei-demo-client.c @@ -320,7 +320,8 @@ int main(int argc, char **argv) if (!e) break; - switch(ei_event_get_type(e)) { + enum ei_event_type type = ei_event_get_type(e); + switch(type) { case EI_EVENT_CONNECT: colorprint("connected\n"); break; @@ -486,7 +487,7 @@ int main(int argc, char **argv) case EI_EVENT_TOUCH_MOTION: { colorprint("touch %s %u %.2f/%.2f\n", - ei_event_get_type(e) == EI_EVENT_TOUCH_DOWN ? "down" : "motion", + type == EI_EVENT_TOUCH_DOWN ? "down" : "motion", ei_event_touch_get_id(e), ei_event_touch_get_x(e), ei_event_touch_get_y(e)); @@ -503,7 +504,11 @@ int main(int argc, char **argv) } break; default: - abort(); + { + colorprint("ERROR: Unhandled event type %u (%s)\n", + type, ei_event_type_to_string(type)); + } + break; } }