mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] input: usb keyboard: fix BACKSPACE
@ 2016-02-20 14:27 Peter Mamonov
  2016-02-20 14:27 ` [PATCH 2/2] input: usb keyboard: fix CTRL+C Peter Mamonov
  2016-02-23  7:50 ` [PATCH 1/2] input: usb keyboard: fix BACKSPACE Sascha Hauer
  0 siblings, 2 replies; 14+ messages in thread
From: Peter Mamonov @ 2016-02-20 14:27 UTC (permalink / raw)
  To: barebox, s.hauer; +Cc: Peter Mamonov

Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
---
 drivers/input/keymap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keymap.c b/drivers/input/keymap.c
index a07b3a8..79ca461 100644
--- a/drivers/input/keymap.c
+++ b/drivers/input/keymap.c
@@ -19,7 +19,7 @@ uint8_t keycode_bb_keys[NR_KEYS] = {
 	[KEY_0] =		'0',
 	[KEY_MINUS] =		'-',
 	[KEY_EQUAL] =		'=',
-	[KEY_BACKSPACE] =	0xff,
+	[KEY_BACKSPACE] =	8,
 	[KEY_TAB] =		'\t',
 	[KEY_Q] =		'q',
 	[KEY_W] =		'w',
@@ -101,7 +101,7 @@ uint8_t keycode_bb_shift_keys[NR_KEYS] = {
 	[KEY_0] =		')',
 	[KEY_MINUS] =		'_',
 	[KEY_EQUAL] =		'+',
-	[KEY_BACKSPACE] =	0xff,
+	[KEY_BACKSPACE] =	8,
 	[KEY_TAB] =		'\t',
 	[KEY_Q] =		'Q',
 	[KEY_W] =		'W',
-- 
2.1.4


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/2] input: usb keyboard: fix CTRL+C
  2016-02-20 14:27 [PATCH 1/2] input: usb keyboard: fix BACKSPACE Peter Mamonov
@ 2016-02-20 14:27 ` Peter Mamonov
  2016-02-20 16:51   ` Sam Ravnborg
                     ` (2 more replies)
  2016-02-23  7:50 ` [PATCH 1/2] input: usb keyboard: fix BACKSPACE Sascha Hauer
  1 sibling, 3 replies; 14+ messages in thread
From: Peter Mamonov @ 2016-02-20 14:27 UTC (permalink / raw)
  To: barebox, s.hauer; +Cc: Peter Mamonov

Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] input: usb keyboard: fix CTRL+C
  2016-02-20 14:27 ` [PATCH 2/2] input: usb keyboard: fix CTRL+C Peter Mamonov
@ 2016-02-20 16:51   ` Sam Ravnborg
  2016-02-23  7:55   ` Sascha Hauer
  2016-02-24 10:48   ` [PATCH v2] " Peter Mamonov
  2 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2016-02-20 16:51 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox

On Sat, Feb 20, 2016 at 05:27:45PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> ---
>  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,
Reading readkey.h it loks like the following definition
would be more descriptive:

#define [KEY_C] =               CTL_CH('c'),

The result is in the end the same.

This patch alrady use other definitions from the same
file (BB_*). So CTL_CH() is availabale.

	Sam

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] input: usb keyboard: fix BACKSPACE
  2016-02-20 14:27 [PATCH 1/2] input: usb keyboard: fix BACKSPACE Peter Mamonov
  2016-02-20 14:27 ` [PATCH 2/2] input: usb keyboard: fix CTRL+C Peter Mamonov
@ 2016-02-23  7:50 ` Sascha Hauer
  1 sibling, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2016-02-23  7:50 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox

On Sat, Feb 20, 2016 at 05:27:44PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> ---
>  drivers/input/keymap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied this one with '\b' instead of 8.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] input: usb keyboard: fix CTRL+C
  2016-02-20 14:27 ` [PATCH 2/2] input: usb keyboard: fix CTRL+C Peter Mamonov
  2016-02-20 16:51   ` Sam Ravnborg
@ 2016-02-23  7:55   ` Sascha Hauer
  2016-02-24 10:48   ` [PATCH v2] " Peter Mamonov
  2 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2016-02-23  7:55 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox

On Sat, Feb 20, 2016 at 05:27:45PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> ---
>  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',

Do we really want to copy the keymap without modifier here thus
effectively ignoring the ctrl key? I would assume the ctrl keymap
is almost empty with only ctrl-c supported. Then we would add support
for whatever ctrl char we might need aswell.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-20 14:27 ` [PATCH 2/2] input: usb keyboard: fix CTRL+C Peter Mamonov
  2016-02-20 16:51   ` Sam Ravnborg
  2016-02-23  7:55   ` Sascha Hauer
@ 2016-02-24 10:48   ` Peter Mamonov
  2016-02-24 14:21     ` Antony Pavlov
  2016-02-25 10:05     ` [PATCH v3] input: usb keyboard: fix CTRL+ combinations Peter Mamonov
  2 siblings, 2 replies; 14+ messages in thread
From: Peter Mamonov @ 2016-02-24 10:48 UTC (permalink / raw)
  To: barebox, s.hauer; +Cc: Sam Ravnborg, Peter Mamonov

Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sam Ravnborg <sam@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


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-24 10:48   ` [PATCH v2] " Peter Mamonov
@ 2016-02-24 14:21     ` Antony Pavlov
  2016-02-24 15:07       ` Peter Mamonov
  2016-02-25 10:05     ` [PATCH v3] input: usb keyboard: fix CTRL+ combinations Peter Mamonov
  1 sibling, 1 reply; 14+ messages in thread
From: Antony Pavlov @ 2016-02-24 14:21 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox, Sam Ravnborg

On Wed, 24 Feb 2016 13:48:45 +0300
Peter Mamonov <pmamonov@gmail.com> wrote:

> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> Signed-off-by: Sam Ravnborg <sam@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'),
> +};


It looks like we still have empty array with NR_KEYS bytes in it.

Can we just drop it and satisfy with short "special case" C-code for control modifier handling?


> 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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


-- 
-- 
Best regards,
  Antony Pavlov

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-24 14:21     ` Antony Pavlov
@ 2016-02-24 15:07       ` Peter Mamonov
  2016-02-24 18:12         ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Peter Mamonov @ 2016-02-24 15:07 UTC (permalink / raw)
  To: Antony Pavlov, s.hauer; +Cc: barebox, Sam Ravnborg

On Wed, 24 Feb 2016 17:21:48 +0300
Antony Pavlov <antonynpavlov@gmail.com> wrote:

> On Wed, 24 Feb 2016 13:48:45 +0300
> Peter Mamonov <pmamonov@gmail.com> wrote:
> 
> > Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> > Signed-off-by: Sam Ravnborg <sam@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'),
> > +};
> 
> 
> It looks like we still have empty array with NR_KEYS bytes in it.
> 
> Can we just drop it and satisfy with short "special case" C-code for
> control modifier handling?

Probably I've misunderstood Sasha.

Sasha, did you mean to eliminate the CTRL-keymap completely?

> 
> 
> > 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@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> 
> 


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-24 15:07       ` Peter Mamonov
@ 2016-02-24 18:12         ` Sascha Hauer
  2016-02-24 18:53           ` Trent Piepho
  2016-02-25 10:15           ` Peter Mamonov
  0 siblings, 2 replies; 14+ messages in thread
From: Sascha Hauer @ 2016-02-24 18:12 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox, Sam Ravnborg

On Wed, Feb 24, 2016 at 06:07:01PM +0300, Peter Mamonov wrote:
> On Wed, 24 Feb 2016 17:21:48 +0300
> Antony Pavlov <antonynpavlov@gmail.com> wrote:
> 
> > On Wed, 24 Feb 2016 13:48:45 +0300
> > Peter Mamonov <pmamonov@gmail.com> wrote:
> > 
> > > Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> > > Signed-off-by: Sam Ravnborg <sam@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'),
> > > +};
> > 
> > 
> > It looks like we still have empty array with NR_KEYS bytes in it.
> > 
> > Can we just drop it and satisfy with short "special case" C-code for
> > control modifier handling?
> 
> Probably I've misunderstood Sasha.
> 
> Sasha, did you mean to eliminate the CTRL-keymap completely?

No, I didn't, although that would be an option aswell. It would safe us
a few more bytes in the binary. The question is, how many more keys are
in the CTRL map that are interesting for us? Are there more than CTRL-C?
If yes, then it's probably better to keep the map. If not, a special
CTRL-C case in code might be the better option.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-24 18:12         ` Sascha Hauer
@ 2016-02-24 18:53           ` Trent Piepho
  2016-02-25  6:05             ` Sascha Hauer
  2016-02-25 10:15           ` Peter Mamonov
  1 sibling, 1 reply; 14+ messages in thread
From: Trent Piepho @ 2016-02-24 18:53 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Sam Ravnborg, Peter Mamonov

On Wed, 2016-02-24 at 19:12 +0100, Sascha Hauer wrote:
> > > >  
> > > > -	if (modstate & (1 << 0))
> > > > +	if (modstate & (1 << 1))
> > > > +		ascii = keycode_bb_ctrl_keys[ev->code];
                
           ascii = keycode_bb_keys[ev->code];
           ascii = ascii >= 'a' ? CTL_CH(ascii): 0;

> > Sasha, did you mean to eliminate the CTRL-keymap completely?
> 
> No, I didn't, although that would be an option aswell. It would safe us
> a few more bytes in the binary. The question is, how many more keys are
> in the CTRL map that are interesting for us? Are there more than CTRL-C?
> If yes, then it's probably better to keep the map. If not, a special
> CTRL-C case in code might be the better option.

Would the above, or a slight modification, be ok?  It gets almost all
the controls keys one could care about.

Ignoring control for all keys other than c doesn't make sense to me.
Does anything else do that?
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-24 18:53           ` Trent Piepho
@ 2016-02-25  6:05             ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2016-02-25  6:05 UTC (permalink / raw)
  To: Trent Piepho; +Cc: barebox, Sam Ravnborg, Peter Mamonov

On Wed, Feb 24, 2016 at 06:53:23PM +0000, Trent Piepho wrote:
> On Wed, 2016-02-24 at 19:12 +0100, Sascha Hauer wrote:
> > > > >  
> > > > > -	if (modstate & (1 << 0))
> > > > > +	if (modstate & (1 << 1))
> > > > > +		ascii = keycode_bb_ctrl_keys[ev->code];
>                 
>            ascii = keycode_bb_keys[ev->code];
>            ascii = ascii >= 'a' ? CTL_CH(ascii): 0;
> 
> > > Sasha, did you mean to eliminate the CTRL-keymap completely?
> > 
> > No, I didn't, although that would be an option aswell. It would safe us
> > a few more bytes in the binary. The question is, how many more keys are
> > in the CTRL map that are interesting for us? Are there more than CTRL-C?
> > If yes, then it's probably better to keep the map. If not, a special
> > CTRL-C case in code might be the better option.
> 
> Would the above, or a slight modification, be ok?  It gets almost all
> the controls keys one could care about.

Yes, this looks good.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3] input: usb keyboard: fix CTRL+ combinations
  2016-02-24 10:48   ` [PATCH v2] " Peter Mamonov
  2016-02-24 14:21     ` Antony Pavlov
@ 2016-02-25 10:05     ` Peter Mamonov
  2016-02-26  6:52       ` Sascha Hauer
  1 sibling, 1 reply; 14+ messages in thread
From: Peter Mamonov @ 2016-02-25 10:05 UTC (permalink / raw)
  To: barebox, s.hauer; +Cc: Sam Ravnborg, Peter Mamonov, Trent Piepho

Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
---
 drivers/input/input.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index ad7400f..31a9c22 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -18,6 +18,7 @@
 #include <linux/bitmap.h>
 #include <input/keyboard.h>
 #include <dt-bindings/input/linux-event-codes.h>
+#include <readkey.h>
 
 static LIST_HEAD(input_consumers);
 
@@ -164,7 +165,10 @@ 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_keys[ev->code];
+		ascii = ascii >= 'a' ? CTL_CH(ascii) : 0;
+	} else if (modstate & (1 << 0))
 		ascii = keycode_bb_shift_keys[ev->code];
 	else
 		ascii = keycode_bb_keys[ev->code];
-- 
2.1.4


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] input: usb keyboard: fix CTRL+C
  2016-02-24 18:12         ` Sascha Hauer
  2016-02-24 18:53           ` Trent Piepho
@ 2016-02-25 10:15           ` Peter Mamonov
  1 sibling, 0 replies; 14+ messages in thread
From: Peter Mamonov @ 2016-02-25 10:15 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Sam Ravnborg

On Wed, 24 Feb 2016 19:12:27 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Wed, Feb 24, 2016 at 06:07:01PM +0300, Peter Mamonov wrote:
> > On Wed, 24 Feb 2016 17:21:48 +0300
> > Antony Pavlov <antonynpavlov@gmail.com> wrote:
> > 
> > > On Wed, 24 Feb 2016 13:48:45 +0300
> > > Peter Mamonov <pmamonov@gmail.com> wrote:
> > > 
> > > > Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> > > > Signed-off-by: Sam Ravnborg <sam@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'),
> > > > +};
> > > 
> > > 
> > > It looks like we still have empty array with NR_KEYS bytes in it.
> > > 
> > > Can we just drop it and satisfy with short "special case" C-code
> > > for control modifier handling?
> > 
> > Probably I've misunderstood Sasha.
> > 
> > Sasha, did you mean to eliminate the CTRL-keymap completely?
> 
> No, I didn't, although that would be an option aswell. It would safe
> us a few more bytes in the binary. The question is, how many more
> keys are in the CTRL map that are interesting for us? Are there more
> than CTRL-C? 

The CTRL+D combo is used for "save & quit" in the edit program.

> If yes, then it's probably better to keep the map. If
> not, a special CTRL-C case in code might be the better option.
> 
> Sascha
> 


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3] input: usb keyboard: fix CTRL+ combinations
  2016-02-25 10:05     ` [PATCH v3] input: usb keyboard: fix CTRL+ combinations Peter Mamonov
@ 2016-02-26  6:52       ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2016-02-26  6:52 UTC (permalink / raw)
  To: Peter Mamonov; +Cc: barebox, Sam Ravnborg, Trent Piepho

On Thu, Feb 25, 2016 at 01:05:18PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
> ---
>  drivers/input/input.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index ad7400f..31a9c22 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -18,6 +18,7 @@
>  #include <linux/bitmap.h>
>  #include <input/keyboard.h>
>  #include <dt-bindings/input/linux-event-codes.h>
> +#include <readkey.h>
>  
>  static LIST_HEAD(input_consumers);
>  
> @@ -164,7 +165,10 @@ 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_keys[ev->code];
> +		ascii = ascii >= 'a' ? CTL_CH(ascii) : 0;
> +	} else if (modstate & (1 << 0))
>  		ascii = keycode_bb_shift_keys[ev->code];
>  	else
>  		ascii = keycode_bb_keys[ev->code];
> -- 
> 2.1.4
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-02-26  6:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-20 14:27 [PATCH 1/2] input: usb keyboard: fix BACKSPACE Peter Mamonov
2016-02-20 14:27 ` [PATCH 2/2] input: usb keyboard: fix CTRL+C Peter Mamonov
2016-02-20 16:51   ` Sam Ravnborg
2016-02-23  7:55   ` Sascha Hauer
2016-02-24 10:48   ` [PATCH v2] " Peter Mamonov
2016-02-24 14:21     ` Antony Pavlov
2016-02-24 15:07       ` Peter Mamonov
2016-02-24 18:12         ` Sascha Hauer
2016-02-24 18:53           ` Trent Piepho
2016-02-25  6:05             ` Sascha Hauer
2016-02-25 10:15           ` Peter Mamonov
2016-02-25 10:05     ` [PATCH v3] input: usb keyboard: fix CTRL+ combinations Peter Mamonov
2016-02-26  6:52       ` Sascha Hauer
2016-02-23  7:50 ` [PATCH 1/2] input: usb keyboard: fix BACKSPACE Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox