public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: add numeric keypad support to HID driver
Date: Tue, 10 Jan 2012 00:13:31 +0100	[thread overview]
Message-ID: <201201100013.31557.marek.vasut@gmail.com> (raw)
In-Reply-To: <1326149976-19976-1-git-send-email-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(-)
> 
> 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

  reply	other threads:[~2012-01-09 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-01-09 23:33   ` Vincent Palatin
2012-01-15 19:49 ` Remy Bohmer
2012-02-26 23:10 ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201201100013.31557.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox