public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: add numeric keypad support to HID driver
@ 2012-01-09 22:59 Vincent Palatin
  2012-01-09 23:13 ` Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vincent Palatin @ 2012-01-09 22:59 UTC (permalink / raw)
  To: u-boot

When keys are pressed on the numeric keypad, emit key codes for the numbers,
operators, dot and enter.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
---
 common/usb_kbd.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index aaf7d6f..2472d25 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -87,6 +87,12 @@ static const unsigned char usb_kbd_numkey_shifted[] = {
 	'|', '~', ':', '"', '~', '<', '>', '?'
 };
 
+static const unsigned char usb_kbd_num_keypad[] = {
+	'/', '*', '-', '+', '\r',
+	'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
+	'.', 0, 0, 0, '='
+};
+
 /*
  * NOTE: It's important for the NUM, CAPS, SCROLL-lock bits to be in this
  *       order. See usb_kbd_setled() function!
@@ -218,6 +224,10 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode,
 			keycode = usb_kbd_numkey[scancode - 0x1e];
 	}
 
+	/* Numeric keypad */
+	if ((scancode >= 0x54) && (scancode <= 0x67))
+		keycode = usb_kbd_num_keypad[scancode - 0x54];
+
 	if (data->flags & USB_KBD_CTRL)
 		keycode = scancode - 0x3;
 
-- 
1.7.3.1

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

* [U-Boot] [PATCH] usb: add numeric keypad support to HID driver
  2012-01-09 22:59 [U-Boot] [PATCH] usb: add numeric keypad support to HID driver Vincent Palatin
@ 2012-01-09 23:13 ` Marek Vasut
  2012-01-09 23:33   ` Vincent Palatin
  2012-01-15 19:49 ` Remy Bohmer
  2012-02-26 23:10 ` Marek Vasut
  2 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2012-01-09 23:13 UTC (permalink / raw)
  To: u-boot

> When keys are pressed on the numeric keypad, emit key codes for the
> numbers, operators, dot and enter.
> 
> Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
> ---
>  common/usb_kbd.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
> index aaf7d6f..2472d25 100644
> --- a/common/usb_kbd.c
> +++ b/common/usb_kbd.c
> @@ -87,6 +87,12 @@ static const unsigned char usb_kbd_numkey_shifted[] = {
>  	'|', '~', ':', '"', '~', '<', '>', '?'
>  };
> 
> +static const unsigned char usb_kbd_num_keypad[] = {
> +	'/', '*', '-', '+', '\r',
> +	'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
> +	'.', 0, 0, 0, '='
> +};
> +
>  /*
>   * NOTE: It's important for the NUM, CAPS, SCROLL-lock bits to be in this
>   *       order. See usb_kbd_setled() function!
> @@ -218,6 +224,10 @@ static int usb_kbd_translate(struct usb_kbd_pdata
> *data, unsigned char scancode, keycode = usb_kbd_numkey[scancode - 0x1e];
>  	}
> 
> +	/* Numeric keypad */
> +	if ((scancode >= 0x54) && (scancode <= 0x67))
> +		keycode = usb_kbd_num_keypad[scancode - 0x54];
> +
>  	if (data->flags & USB_KBD_CTRL)
>  		keycode = scancode - 0x3;

This is good, but what happens if you press "Ctrl + numpad_key" ? Check line 221 
in usb_kbd.c for what I mean.

M

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

* [U-Boot] [PATCH] usb: add numeric keypad support to HID driver
  2012-01-09 23:13 ` Marek Vasut
@ 2012-01-09 23:33   ` Vincent Palatin
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Palatin @ 2012-01-09 23:33 UTC (permalink / raw)
  To: u-boot

On Mon, Jan 9, 2012 at 15:13, Marek Vasut <marek.vasut@gmail.com> wrote:
>> + ? ? /* Numeric keypad */
>> + ? ? if ((scancode >= 0x54) && (scancode <= 0x67))
>> + ? ? ? ? ? ? keycode = usb_kbd_num_keypad[scancode - 0x54];
>> +
>> ? ? ? if (data->flags & USB_KBD_CTRL)
>> ? ? ? ? ? ? ? keycode = scancode - 0x3;
>
> This is good, but what happens if you press "Ctrl + numpad_key" ? Check line 221
> in usb_kbd.c for what I mean.

As before the patch, it returns some random uppercase letters.
This is broken : IMO not only for those keys, but for all keys excepted A-Z.

-- 
Vincent

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

* [U-Boot] [PATCH] usb: add numeric keypad support to HID driver
  2012-01-09 22:59 [U-Boot] [PATCH] usb: add numeric keypad support to HID driver Vincent Palatin
  2012-01-09 23:13 ` Marek Vasut
@ 2012-01-15 19:49 ` Remy Bohmer
  2012-02-26 23:10 ` Marek Vasut
  2 siblings, 0 replies; 5+ messages in thread
From: Remy Bohmer @ 2012-01-15 19:49 UTC (permalink / raw)
  To: u-boot

Hi,

2012/1/9 Vincent Palatin <vpalatin@chromium.org>:
> When keys are pressed on the numeric keypad, emit key codes for the numbers,
> operators, dot and enter.
>
> Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
> ---
> ?common/usb_kbd.c | ? 10 ++++++++++
> ?1 files changed, 10 insertions(+), 0 deletions(-)

Applied to u-boot-usb. Thanks.

Kind regards,

Remy

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

* [U-Boot] [PATCH] usb: add numeric keypad support to HID driver
  2012-01-09 22:59 [U-Boot] [PATCH] usb: add numeric keypad support to HID driver Vincent Palatin
  2012-01-09 23:13 ` Marek Vasut
  2012-01-15 19:49 ` Remy Bohmer
@ 2012-02-26 23:10 ` Marek Vasut
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2012-02-26 23:10 UTC (permalink / raw)
  To: u-boot

> When keys are pressed on the numeric keypad, emit key codes for the
> numbers, operators, dot and enter.
> 
> Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
> ---

Hi,

what's the status of this patch/patchset?

Thanks
M

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

end of thread, other threads:[~2012-02-26 23:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 22:59 [U-Boot] [PATCH] usb: add numeric keypad support to HID driver Vincent Palatin
2012-01-09 23:13 ` Marek Vasut
2012-01-09 23:33   ` Vincent Palatin
2012-01-15 19:49 ` Remy Bohmer
2012-02-26 23:10 ` Marek Vasut

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