summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-04-24 15:37:53 +0800
committerChromeBot <chrome-bot@google.com>2013-04-24 20:30:15 -0700
commitd13318a1eab569cea44b087a785803cca682c3d4 (patch)
treeef95df59fd97a289a2fc3cd5d7e22ca683121a12
parent4e0d75d952d3f38925d634dd4a05459cac0a600f (diff)
downloadchrome-ec-d13318a1eab569cea44b087a785803cca682c3d4.tar.gz
spring: Disable keyboard when lid is closed
When lid is closed, any key press is very likely bogus. Let's disable keyboard in this case. BUG=chrome-os-partner:17653 TEST=Check keyboard still works. Use a magnet to suspend the system, and check any keypress is discarded. BRANCH=spring Change-Id: I24d40059b851f020ff1f93fe3282e955eeb0e526 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49034 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/keyboard_scan.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index 03ae1e790c..2c35a59eb6 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -463,7 +463,8 @@ static int check_keys_changed(uint8_t *state)
/* Swallow special keys */
if (check_runtime_keys(state))
return 0;
- else if (kb_fifo_add(state) == EC_SUCCESS)
+ else if (gpio_get_level(GPIO_LID_OPEN) &&
+ kb_fifo_add(state) == EC_SUCCESS)
board_interrupt_host(1);
else
CPRINTF("dropped keystroke\n");