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>
This commit is contained in:
Douglas Anderson
2016-01-04 09:58:12 -08:00
committed by chrome-bot
parent 8d99bd9345
commit ec7927a20d

View File

@@ -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);