diff options
-rw-r--r-- | drivers/input/Kconfig | 11 | ||||
-rw-r--r-- | drivers/input/input.c | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 52234c0ecc..01e0b722c2 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -12,6 +12,17 @@ config INPUT config INPUT_MATRIXKMAP bool +config INPUT_EVBUG + bool "Event debugging" + help + Say Y here if you have a problem with the input subsystem and + want all events (keypresses), to be output to + the barebox log. While this is useful for debugging, it's also + a security threat - your keypresses include your passwords, of + course and could be visible to userspace if pstore is configured. + + If unsure, say N. + config KEYBOARD_GPIO bool "GPIO Buttons" depends on GENERIC_GPIO diff --git a/drivers/input/input.c b/drivers/input/input.c index deef5ddd22..1a47929351 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only +#define pr_fmt(fmt) "input: " fmt + #include <common.h> #include <init.h> #include <kfifo.h> @@ -33,6 +35,15 @@ void input_report_key_event(struct input_device *idev, unsigned int code, int va if (code > KEY_MAX) return; + /* + * We don't use pr_debug here as we want to output the message + * to the log, even if CONFIG_COMPILE_LOGLEVEL < MSG_DEBUG and + * the DEBUG mcro wasn't defined for the file. + */ + if (IS_ENABLED(CONFIG_INPUT_EVBUG)) + pr_print(MSG_DEBUG, "Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", + dev_name(idev->parent), EV_KEY, code, value); + if (value) set_bit(code, idev->keys); else |