[PATCH 2/2] input: usb keyboard: fix CTRL+C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Mamonov <pmamonov@xxxxxxxxx>
---
 drivers/input/input.c    |  4 ++-
 drivers/input/keymap.c   | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/input/keyboard.h |  1 +
 3 files changed, 86 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..90f1818 100644
--- a/drivers/input/keymap.c
+++ b/drivers/input/keymap.c
@@ -167,3 +167,85 @@ uint8_t keycode_bb_shift_keys[NR_KEYS] = {
 	[KEY_KPEQUAL] =		'=',
 	[KEY_KPCOMMA] =		',',
 };
+
+uint8_t keycode_bb_ctrl_keys[NR_KEYS] = {
+	[KEY_RESERVED] =	0xff,
+	[KEY_ESC] =		0x1b,
+	[KEY_1] =		'1',
+	[KEY_2] =		'2',
+	[KEY_3] =		'3',
+	[KEY_4] =		'4',
+	[KEY_5] =		'5',
+	[KEY_6] =		'6',
+	[KEY_7] =		'7',
+	[KEY_8] =		'8',
+	[KEY_9] =		'9',
+	[KEY_0] =		'0',
+	[KEY_MINUS] =		'-',
+	[KEY_EQUAL] =		'=',
+	[KEY_BACKSPACE] =	8,
+	[KEY_TAB] =		'\t',
+	[KEY_Q] =		'q',
+	[KEY_W] =		'w',
+	[KEY_E] =		'e',
+	[KEY_R] =		'r',
+	[KEY_T] =		't',
+	[KEY_Y] =		'y',
+	[KEY_U] =		'u',
+	[KEY_I] =		'i',
+	[KEY_O] =		'o',
+	[KEY_P] =		'p',
+	[KEY_LEFTBRACE] =	'[',
+	[KEY_RIGHTBRACE] =	']',
+	[KEY_ENTER] =		'\n',
+	[KEY_A] =		'a',
+	[KEY_S] =		's',
+	[KEY_D] =		'd',
+	[KEY_F] =		'f',
+	[KEY_G] =		'g',
+	[KEY_H] =		'h',
+	[KEY_J] =		'j',
+	[KEY_K] =		'k',
+	[KEY_L] =		'l',
+	[KEY_SEMICOLON] =	';',
+	[KEY_APOSTROPHE] =	'`',
+	[KEY_GRAVE] =		'^',
+	[KEY_BACKSLASH] =	'\\',
+	[KEY_Z] =		'z',
+	[KEY_X] =		'x',
+	[KEY_C] =		3,
+	[KEY_V] =		'v',
+	[KEY_B] =		'b',
+	[KEY_N] =		'n',
+	[KEY_M] =		'm',
+	[KEY_COMMA] =		',',
+	[KEY_DOT] =		'.',
+	[KEY_SLASH] =		'/',
+	[KEY_SPACE] =		' ',
+	[KEY_KP7] =		'7',
+	[KEY_KP8] =		'8',
+	[KEY_KP9] =		'9',
+	[KEY_KPMINUS] =		'-',
+	[KEY_KP4] =		'4',
+	[KEY_KP5] =		'5',
+	[KEY_KP6] =		'6',
+	[KEY_KPPLUS] =		'+',
+	[KEY_KP1] =		'1',
+	[KEY_KP2] =		'2',
+	[KEY_KP3] =		'3',
+	[KEY_KP0] =		'0',
+	[KEY_KPDOT] =		'.',
+	[KEY_KPENTER] =		'\n',
+	[KEY_HOME] =		BB_KEY_HOME,
+	[KEY_UP] =		BB_KEY_UP,
+	[KEY_PAGEUP] =		BB_KEY_PAGEUP,
+	[KEY_LEFT] =		BB_KEY_LEFT,
+	[KEY_RIGHT] =		BB_KEY_RIGHT,
+	[KEY_END] =		BB_KEY_END,
+	[KEY_DOWN] =		BB_KEY_DOWN,
+	[KEY_PAGEDOWN] =	BB_KEY_PAGEDOWN,
+	[KEY_INSERT] =		BB_KEY_INSERT,
+	[KEY_DELETE] =		BB_KEY_DEL,
+	[KEY_KPEQUAL] =		'=',
+	[KEY_KPCOMMA] =		',',
+};
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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux