summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2016-01-04 09:58:12 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-01-04 16:26:21 -0800
commitec7927a20d4fd1db35e482a69da1e9915552322f (patch)
treebb9d480a0c2fca64cdf24bb6c8b7230cc57d54f0
parent8d99bd934541cafc2a151bf4765877b10b4df0e9 (diff)
downloadchrome-ec-ec7927a20d4fd1db35e482a69da1e9915552322f.tar.gz
keyboard: Fix kbpress after recent keyboard change
After commit 98ab7484d331 ("keyboard: prevent races enabling/disabling kb scanning") kbpress was totally broken, which wasn't so good for FAFT. Fix it by making sure we go into polling mode for simulated keyboard presses. BUG=chrome-os-partner:48849 TEST=kbpress works Change-Id: Icd663c2ee7a184e6af4438368595087b35724a4f Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/319586 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/keyboard_scan.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index 5d93f28fc9..cad5bb559a 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -101,6 +101,9 @@ static volatile uint32_t __bss_slow disable_scanning_mask;
/* Constantly incrementing counter of the number of times we polled */
static volatile int kbd_polls;
+/* If true, we'll force a keyboard poll */
+static volatile int force_poll;
+
static int keyboard_scan_is_enabled(void)
{
/* NOTE: this is just an instantaneous glimpse of the variable. */
@@ -184,6 +187,9 @@ static void simulate_key(int row, int col, int pressed)
print_state(simulated_key, "simulated ");
+ /* Force a poll even though no keys are pressed */
+ force_poll = 1;
+
/* Wake the task to handle changes in simulated keys */
task_wake(TASK_ID_KEYSCAN);
@@ -664,12 +670,16 @@ void keyboard_scan_task(void)
* user pressing a key and enable_interrupt()
* starting to pay attention to edges.
*/
- if (!local_disable_scanning && keyboard_raw_read_rows())
+ if (!local_disable_scanning &&
+ (keyboard_raw_read_rows() || force_poll))
break;
else
task_wait_event(-1);
}
+ /* We're about to poll, so any existing forces are fulfilled */
+ force_poll = 0;
+
/* Enter polling mode */
CPRINTS("KB poll");
keyboard_raw_enable_interrupt(0);