summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-09 14:27:46 -0800
committerGerrit <chrome-bot@google.com>2012-01-09 16:25:34 -0800
commit1b1b0c65f4bb6d39cb749f3cb11b2e55f4cae682 (patch)
tree7320ba2c69ecf4a31aa515c376bb1999afbe6074 /common
parentcfe74144652a78eb993ccaf2c82a1ec701231b57 (diff)
usb: add numeric keypad support to HID driver
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> BUG=chrome-os-partner:7436 TEST=On lumpy with USB keyboard activated, boot in dev mode and press enter (on the numeric keypad) to boot. Change-Id: I4a50a26c8dca17c015743c16475833447769765b Reviewed-on: https://gerrit.chromium.org/gerrit/13890 Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_kbd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 6f2f944d9d..d73a5d132b 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -88,6 +88,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!
@@ -219,6 +225,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;