diff options
author | Simon Glass <sjg@chromium.org> | 2011-06-28 16:44:08 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:42 -0700 |
commit | 74e4881db3e0bc6d56eb07b79d98cb4758e83f58 (patch) | |
tree | 9deab0bb724595d6d3241e3f94308fa9dcacca5b /drivers/input | |
parent | 6394181379106bf4e43236da416603ffed02d74d (diff) |
fdt: Add ctrl key support
This adds support for the Ctrl modifier. The left and right ctrl keys are
dealt with in the same way.
BUG=chromium-os:11623
TEST=boot U-Boot modified to print hex codes of input characters. Run through
ctrl-A to ctrl-Z and see that correct output results
Change-Id: Ibcaa2f401fce7f2ace457d4068a823caf74a8e9b
Reviewed-on: http://gerrit.chromium.org/gerrit/3354
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/input')
-rwxr-xr-x | drivers/input/tegra-kbc.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c index db5bc28972..9a2740c3af 100755 --- a/drivers/input/tegra-kbc.c +++ b/drivers/input/tegra-kbc.c @@ -68,6 +68,7 @@ int kbc_last_keypress; u8 *kbc_plain_keycode; u8 *kbc_fn_keycode; u8 *kbc_shift_keycode; +u8 *kbc_ctrl_keycode; #ifdef CONFIG_OF_CONTROL struct fdt_kbc config; /* Our keyboard config */ @@ -75,12 +76,19 @@ struct fdt_kbc config; /* Our keyboard config */ static int tegra_kbc_keycode(int r, int c, int modifier) { + int entry = r * KBC_MAX_COL + c; + if (modifier == KEY_FN) - return kbc_fn_keycode[(r * KBC_MAX_COL) + c]; + return kbc_fn_keycode[entry]; + + /* Put ctrl keys ahead of shift */ + else if ((modifier == KEY_LEFT_CTRL || modifier == KEY_RIGHT_CTRL) + && kbc_ctrl_keycode) + return kbc_ctrl_keycode[entry]; else if (modifier == KEY_SHIFT) - return kbc_shift_keycode[(r * KBC_MAX_COL) + c]; + return kbc_shift_keycode[entry]; else - return kbc_plain_keycode[(r * KBC_MAX_COL) + c]; + return kbc_plain_keycode[entry]; } /* determines if current keypress configuration can cause key ghosting */ @@ -139,7 +147,7 @@ static int tegra_kbc_find_keys(int *fifo) } for (i = 0; i < valid; i++) { k = tegra_kbc_keycode(rows_val[i], cols_val[i], 0); - if ((k == KEY_FN) || (k == KEY_SHIFT)) { + if (KEY_IS_MODIFIER(k)) { modifier = k; break; } @@ -418,6 +426,7 @@ int drv_keyboard_init(void) kbc_plain_keycode = config.plain_keycode; kbc_shift_keycode = config.shift_keycode; kbc_fn_keycode = config.fn_keycode; + kbc_ctrl_keycode = config.ctrl_keycode; #else kbc_plain_keycode = board_keyboard_config.plain_keycode; kbc_shift_keycode = board_keyboard_config.shift_keycode; |