From d46cfba8b4be76b1f93a37b6fd5c3944289539f7 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 6 Jan 2026 23:11:06 -0500 Subject: Human-readable EV_* types in debug output. --- marsond.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/marsond.c b/marsond.c index 8ce061c..59c2fee 100644 --- a/marsond.c +++ b/marsond.c @@ -352,6 +352,15 @@ void release_key(int code) { write_event(&ev); } +const char *event_type(int type) { + switch(type) { + case EV_SYN: return "EV_SYN"; + case EV_MSC: return "EV_MSC"; + case EV_KEY: return "EV_KEY"; + default: return "???"; + } +} + void shift_timing(long long *last, const char *name, int code) { if(*last && (gettime_millis() < (*last + shift_ms))) { debug_fg("!!! Enter pressed; last %s shift press < %dms ago, sending %s shift release", name, shift_ms, name); @@ -461,8 +470,8 @@ int main(int argc, char **argv) { } } - debug_fg("got event: type %d, code 0x%02x, value %d", - ev.type, ev.code, ev.value); + debug_fg("got event: type %d (%s), code 0x%02x, value %d", + ev.type, event_type(ev.type), ev.code, ev.value); /* ev.value: 0 == release, 1 == initial press, 2 == repeat */ if(ev.type == EV_KEY) { -- cgit v1.2.3