aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-01-06 23:11:06 -0500
committerB. Watson <urchlay@slackware.uk>2026-01-06 23:11:06 -0500
commitd46cfba8b4be76b1f93a37b6fd5c3944289539f7 (patch)
treedcafb32ce525859518aaa5d0717b2f453dce7013
parentf764da4483d3d462731a376e5c92ffc9e144187d (diff)
downloadmarsond-d46cfba8b4be76b1f93a37b6fd5c3944289539f7.tar.gz
Human-readable EV_* types in debug output.
-rw-r--r--marsond.c13
1 files 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) {