summaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1e8f6e178e..1a47929351 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1,13 +1,6 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; version 2.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0-only
+
+#define pr_fmt(fmt) "input: " fmt
#include <common.h>
#include <init.h>
@@ -42,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
@@ -165,6 +167,9 @@ static void input_console_notify(struct input_notifier *in,
if (ic->modstate[4] || ic->modstate[5])
modstate |= 1 << 2;
+ if (ev->code >= NR_KEYS)
+ return;
+
if (modstate & (1 << 1)) {
ascii = keycode_bb_keys[ev->code];
ascii = ascii >= 'a' ? CTL_CH(ascii) : 0;
@@ -201,7 +206,7 @@ static int input_init(void)
ic->fifo = kfifo_alloc(32);
ic->notifier.notify = input_console_notify;
input_register_notfier(&ic->notifier);
- poller_async_register(&ic->poller);
+ poller_async_register(&ic->poller, "input");
return console_register(&ic->console);
}