summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-04-10 12:32:05 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-11 20:02:30 +0000
commit3344c8e2e64fd4985f6fbb55810452f195b7b7eb (patch)
tree648fae08de74b86d43a8430b523ec52ac701ab5c /test
parent2dc7016541daf1bf7e9e96131eced09fe6a94776 (diff)
downloadchrome-ec-3344c8e2e64fd4985f6fbb55810452f195b7b7eb.tar.gz
Refactored keyboard scan enable flag to allow for multiple disable reasons
Refactored keyboard scan enable/disable flag such that it is a mask of potential disable sources. When all disable sources are off, scanning is enabled, otherwise scanning is disabled. This fixes a recently introduced bug in which enabling/disabling keyboard scanning due to lid angle in S3 was interfering with enabling/disabling keyboard scanning due to power button. This also allows for easy expansion for future causes for disabling keyboard scanning. BUG=chrome-os-partner:27851 BRANCH=rambi TEST=Manual tests with a glimmer. Used the ksstate console command to check state of keyboard scanning under all permutations of power button pressed/unpressed, lid switch open/closed, and lid angle in tablet position vs. laptop positon. Change-Id: Ied4c5ebb94510b1078cd81d71373c0f1bd0d6678 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194287 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/kb_scan.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/kb_scan.c b/test/kb_scan.c
index e0e73d17f5..926b0a27df 100644
--- a/test/kb_scan.c
+++ b/test/kb_scan.c
@@ -9,6 +9,7 @@
#include "common.h"
#include "console.h"
#include "gpio.h"
+#include "hooks.h"
#include "host_command.h"
#include "keyboard_raw.h"
#include "keyboard_scan.h"
@@ -330,12 +331,14 @@ static int runtime_key_test(void)
static int lid_test(void)
{
lid_open = 0;
+ hook_notify(HOOK_LID_CHANGE);
mock_key(1, 1, 1);
TEST_ASSERT(expect_no_keychange() == EC_SUCCESS);
mock_key(1, 1, 0);
TEST_ASSERT(expect_no_keychange() == EC_SUCCESS);
lid_open = 1;
+ hook_notify(HOOK_LID_CHANGE);
mock_key(1, 1, 1);
TEST_ASSERT(expect_keychange() == EC_SUCCESS);
mock_key(1, 1, 0);
@@ -375,6 +378,7 @@ void test_init(void)
static void run_test_step1(void)
{
lid_open = 1;
+ hook_notify(HOOK_LID_CHANGE);
test_reset();
RUN_TEST(deghost_test);
@@ -396,6 +400,7 @@ static void run_test_step1(void)
static void run_test_step2(void)
{
lid_open = 1;
+ hook_notify(HOOK_LID_CHANGE);
test_reset();
RUN_TEST(test_check_boot_esc);
@@ -409,6 +414,7 @@ static void run_test_step2(void)
static void run_test_step3(void)
{
lid_open = 1;
+ hook_notify(HOOK_LID_CHANGE);
test_reset();
RUN_TEST(test_check_boot_down);