summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-09 12:59:36 +0000
committerWolfgang Denk <wd@denx.de>2012-03-03 16:56:15 +0100
commitd53da847cf274b8fd3ea362a3dfff68ea6206613 (patch)
tree81756728624564690f675c95a6a1e62435b3a0fc
parent3d17308e405e6a3eb4de869b36218d2f95c0e546 (diff)
downloadu-boot-imx-d53da847cf274b8fd3ea362a3dfff68ea6206613.zip
u-boot-imx-d53da847cf274b8fd3ea362a3dfff68ea6206613.tar.gz
u-boot-imx-d53da847cf274b8fd3ea362a3dfff68ea6206613.tar.bz2
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>
-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 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;