diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-01-20 17:18:17 -0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-01-22 14:49:01 -0800 |
commit | d0076d861920a2aa12ec007b29acca869c7d0cfd (patch) | |
tree | 6bad51cde8d200603115c2d6a2345ed677a66fe5 /common | |
parent | 43a5c8d49f543dd2559d6e1cd383dcfab1a8b290 (diff) |
usb: add special keys handling to the HID driver
Generate ANSI 3.64 sequences to handle arrow keys, Fx and other special
keyboard keys.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:7666
TEST=on Stumpy in recovery mode, press arrow keys and see the language
of the message change.
Change-Id: I4560ca0c68ea5a9da4cde8247ea5ecc74938f84a
Reviewed-on: https://gerrit.chromium.org/gerrit/14596
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Terry Lambert <tlambert@chromium.org>
Commit-Ready: Terry Lambert <tlambert@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
(cherry picked from commit 93954c89f388f3f36149504ebbcd6f6a70fd3a8f)
Reviewed-on: https://gerrit.chromium.org/gerrit/14606
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_kbd.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/common/usb_kbd.c b/common/usb_kbd.c index cb471b9d309..89d8dee0681 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -94,6 +94,34 @@ static const unsigned char usb_kbd_num_keypad[] = { '.', 0, 0, 0, '=' }; +static char *usb_kbd_special[] = { + /* 0x3A */ "\033[OP", /* F1 */ + /* 0x3B */ "\033[OQ", /* F2 */ + /* 0x3C */ "\033[OR", /* F3 */ + /* 0x3D */ "\033[OS", /* F4 */ + /* 0x3E */ "\033[15~", /* F5 */ + /* 0x3F */ "\033[17~", /* F6 */ + /* 0x40 */ "\033[18~", /* F7 */ + /* 0x41 */ "\033[19~", /* F8 */ + /* 0x42 */ "\033[20~", /* F9 */ + /* 0x43 */ "\033[21~", /* F10 */ + /* 0x44 */ "\033[23~", /* F11 */ + /* 0x45 */ "\033[24~", /* F12 */ + /* 0x46 */ NULL, /* - */ + /* 0x47 */ NULL, /* - */ + /* 0x48 */ NULL, /* - */ + /* 0x49 */ "\033[2~", /* Insert */ + /* 0x4A */ "\033[0H", /* Home */ + /* 0x4B */ "\033[5~", /* Page Up */ + /* 0x4C */ "\033[3~", /* Delete Forward */ + /* 0x4D */ "\033[0F", /* End */ + /* 0x4E */ "\033[3~", /* Page Down */ + /* 0x4F */ "\033[C", /* Right */ + /* 0x50 */ "\033[D", /* Left */ + /* 0x51 */ "\033[B", /* Down */ + /* 0x52 */ "\033[A", /* Up */ +}; + /* * NOTE: It's important for the NUM, CAPS, SCROLL-lock bits to be in this * order. See usb_kbd_setled() function! @@ -225,6 +253,14 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode, keycode = usb_kbd_numkey[scancode - 0x1e]; } + /* Special keys translated to ANSI 3.64 sequences */ + if ((scancode >= 0x3a) && (scancode <= 0x52)) + if (usb_kbd_special[scancode - 0x3a]) { + char *c; + for (c = usb_kbd_special[scancode - 0x3a]; *c; c++) + usb_kbd_put_queue(data, *c); + } + /* Numeric keypad */ if ((scancode >= 0x54) && (scancode <= 0x67)) keycode = usb_kbd_num_keypad[scancode - 0x54]; |