summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-10-16 17:00:59 -0700
committerGerrit <chrome-bot@google.com>2012-10-17 15:23:49 -0700
commit8f73372cefb375c60e0003e0c5839f014e2ca4fa (patch)
treee382abe9e199c591a102dc30c14cf7f315a032e1
parentf574f1c37c2d72d2cb064bda6546fa7d1f047cea (diff)
downloadchrome-ec-8f73372cefb375c60e0003e0c5839f014e2ca4fa.tar.gz
stm32: Swallow special keys instead of passing them to AP
During the debounce refactor we unintentionally adjusted the behavior of special keys so that they are no longer swallowed (as per commit 9332d76). The LM4's keyboard behaves differently so this code cannot be brought over as is. Bring back the required behavior for STM32. BUG=chrome-os-partner:14496 TEST=hit alt-volume_up-r keys together. See that the AP does not see this keypress in U-Boot by checking the EC console has no 0x60 messages. BRANCH=snow Change-Id: I043fbba4d9be5941e550257b99bdb2137792c133 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35767 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/keyboard_scan.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index 243292287a..a16bd09edb 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -243,8 +243,9 @@ void enter_polling_mode(void)
* Check special runtime key combinations.
*
* @param state Keyboard state to use when checking keys.
+ * @return 1 if a special key was pressed, 0 if not
*/
-static void check_runtime_keys(const uint8_t *state)
+static int check_runtime_keys(const uint8_t *state)
{
int num_press;
int c;
@@ -256,7 +257,7 @@ static void check_runtime_keys(const uint8_t *state)
}
if (num_press != 3)
- return;
+ return 0;
if (state[MASK_INDEX_KEYR] == MASK_VALUE_KEYR &&
state[MASK_INDEX_VOL_UP] == MASK_VALUE_VOL_UP &&
@@ -264,7 +265,10 @@ static void check_runtime_keys(const uint8_t *state)
state[MASK_INDEX_LEFT_ALT] == MASK_VALUE_LEFT_ALT)) {
keyboard_clear_state();
system_warm_reboot();
+ return 1;
}
+
+ return 0;
}
/* Print the keyboard state. */
@@ -441,9 +445,10 @@ static int check_keys_changed(uint8_t *state)
CPRINTF("\n");
#endif
- check_runtime_keys(state);
-
- if (kb_fifo_add(state) == EC_SUCCESS)
+ /* Swallow special keys */
+ if (check_runtime_keys(state))
+ return 0;
+ else if (kb_fifo_add(state) == EC_SUCCESS)
board_interrupt_host(1);
else
CPRINTF("dropped keystroke\n");