From 7ef6291e33c31388652e66ebf0f96ec6d836d528 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Wed, 8 Aug 2018 12:35:37 +0800 Subject: keyboard: Change scan code magic values to enum. The key codes are now always scan code set 2 so we can create a list of scan codes and use them easily. BUG=None TEST=make buildall -j; boots properly BRANCH=None Change-Id: I1fdd7ab81bc13c97c4139afc19d71f5898e22f96 Signed-off-by: Hung-Te Lin Reviewed-on: https://chromium-review.googlesource.com/1166743 --- include/keyboard_8042_sharedlib.h | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'include') diff --git a/include/keyboard_8042_sharedlib.h b/include/keyboard_8042_sharedlib.h index e475288ad5..adf2932231 100644 --- a/include/keyboard_8042_sharedlib.h +++ b/include/keyboard_8042_sharedlib.h @@ -31,4 +31,53 @@ extern uint8_t scancode_translate_set2_to_1(uint8_t code); /* Button scancodes (Power, Volume Down, Volume Up, etc.) */ extern const struct button_8042_t buttons_8042[KEYBOARD_BUTTON_COUNT]; +/* Scan code set 2 table. */ +enum scancode_values { + SCANCODE_1 = 0x0016, + SCANCODE_2 = 0x001e, + SCANCODE_3 = 0x0026, + SCANCODE_4 = 0x0025, + SCANCODE_5 = 0x002e, + SCANCODE_6 = 0x0036, + SCANCODE_7 = 0x003d, + SCANCODE_8 = 0x003e, + + SCANCODE_A = 0x001c, + SCANCODE_B = 0x0032, + SCANCODE_T = 0x002c, + + SCANCODE_F1 = 0x0005, + SCANCODE_F2 = 0x0006, + SCANCODE_F3 = 0x0004, + SCANCODE_F4 = 0x000c, + SCANCODE_F5 = 0x0003, + SCANCODE_F6 = 0x000b, + SCANCODE_F7 = 0x0083, + SCANCODE_F8 = 0x000a, + + SCANCODE_UP = 0xe075, + SCANCODE_DOWN = 0xe072, + SCANCODE_LEFT = 0xe06b, + SCANCODE_RIGHT = 0xe074, + + SCANCODE_LEFT_CTRL = 0x0014, + SCANCODE_RIGHT_CTRL = 0xe014, + SCANCODE_LEFT_ALT = 0x0011, + SCANCODE_RIGHT_ALT = 0xe011, + + SCANCODE_LEFT_WIN = 0xe01f, /* Also known as GUI or Super key. */ + SCANCODE_RIGHT_WIN = 0xe027, + SCANCODE_MENU = 0xe02f, + + SCANCODE_POWER = 0xe037, + SCANCODE_VOLUME_DOWN = 0xe021, + SCANCODE_VOLUME_UP = 0xe032, + + SCANCODE_NUMLOCK = 0x0077, + SCANCODE_CAPSLOCK = 0x0058, + SCANCODE_SCROLL_LOCK = 0x007e, + + SCANCODE_CTRL_BREAK = 0xe07e, +}; + #endif /* __CROS_EC_KEYBOARD_8042_SHAREDLIB_H */ -- cgit v1.2.1