[PATCH v2] input: usb keyboard: fix CTRL+C

Peter Mamonov pmamonov at gmail.com
Wed Feb 24 02:48:45 PST 2016


Signed-off-by: Peter Mamonov <pmamonov at gmail.com>
Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
---
 drivers/input/input.c    | 4 +++-
 drivers/input/keymap.c   | 4 ++++
 include/input/keyboard.h | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index ad7400f..1c6891c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -164,7 +164,9 @@ static void input_console_notify(struct input_notifier *in,
 	if (ic->modstate[4] || ic->modstate[5])
 		modstate |= 1 << 2;
 
-	if (modstate & (1 << 0))
+	if (modstate & (1 << 1))
+		ascii = keycode_bb_ctrl_keys[ev->code];
+	else if (modstate & (1 << 0))
 		ascii = keycode_bb_shift_keys[ev->code];
 	else
 		ascii = keycode_bb_keys[ev->code];
diff --git a/drivers/input/keymap.c b/drivers/input/keymap.c
index 79ca461..7e443d1 100644
--- a/drivers/input/keymap.c
+++ b/drivers/input/keymap.c
@@ -167,3 +167,7 @@ uint8_t keycode_bb_shift_keys[NR_KEYS] = {
 	[KEY_KPEQUAL] =		'=',
 	[KEY_KPCOMMA] =		',',
 };
+
+uint8_t keycode_bb_ctrl_keys[NR_KEYS] = {
+	[KEY_C] =		CTL_CH('c'),
+};
diff --git a/include/input/keyboard.h b/include/input/keyboard.h
index d1f5bf5..8ccdf31 100644
--- a/include/input/keyboard.h
+++ b/include/input/keyboard.h
@@ -7,5 +7,6 @@
 
 extern uint8_t keycode_bb_keys[NR_KEYS];
 extern uint8_t keycode_bb_shift_keys[NR_KEYS];
+extern uint8_t keycode_bb_ctrl_keys[NR_KEYS];
 
 #endif
-- 
2.1.4




More information about the barebox mailing list