From: Ray Strode Date: Mon, 4 Dec 2023 12:59:38 +0000 (-0500) Subject: ply-input-device: Add new plymouth.debug-input-devices kernel option X-Git-Tag: 23.51.283~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2decd9fcffae355bf52be2b50ad340eb83f3620;p=thirdparty%2Fplymouth.git ply-input-device: Add new plymouth.debug-input-devices kernel option Right now we don't have a lot of debugging information when processing keyboard events. I mean we don't want passwords to show up in logs after all. Still, it would be useful to have a way to turn the valve on to the firehose. This commit adds a plymouth.debug-input-devices kernel option. --- diff --git a/src/libply-splash-core/ply-input-device.c b/src/libply-splash-core/ply-input-device.c index 19daa394..db826ab9 100644 --- a/src/libply-splash-core/ply-input-device.c +++ b/src/libply-splash-core/ply-input-device.c @@ -161,6 +161,19 @@ on_input (ply_input_device_t *input_device) int rc; unsigned int flags; ply_buffer_t *input_buffer = ply_buffer_new (); + static enum { PLY_INPUT_DEVICE_DEBUG_UNKNOWN = -1, + PLY_INPUT_DEVICE_DEBUG_DISABLED, + PLY_INPUT_DEVICE_DEBUG_ENABLED } debug_key_events = PLY_INPUT_DEVICE_DEBUG_UNKNOWN; + + if (debug_key_events == PLY_INPUT_DEVICE_DEBUG_UNKNOWN) { + if (ply_kernel_command_line_has_argument ("plymouth.debug-input-devices")) { + ply_trace ("WARNING: Input device debugging enabled. Passwords will be in log!"); + debug_key_events = PLY_INPUT_DEVICE_DEBUG_ENABLED; + } else { + ply_trace ("Input device debugging disabled"); + debug_key_events = PLY_INPUT_DEVICE_DEBUG_DISABLED; + } + } flags = LIBEVDEV_READ_FLAG_NORMAL; for (;;) { @@ -183,6 +196,14 @@ on_input (ply_input_device_t *input_device) break; } + if (debug_key_events == PLY_INPUT_DEVICE_DEBUG_ENABLED) { + ply_trace ("Received event from input device %s, type=%s code=%s value=%d.", + libevdev_get_name (input_device->dev), + libevdev_event_type_get_name (ev.type), + libevdev_event_code_get_name (ev.type, ev.code), + ev.value); + } + if (!libevdev_event_is_type (&ev, EV_KEY)) continue;