diff options
author | Vic Yang <victoryang@chromium.org> | 2013-07-23 06:52:18 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-23 16:06:22 -0700 |
commit | 74abf3697109b2719d0dbc4e60667740de872fb3 (patch) | |
tree | c711bf33700f82793833930c8dc73ec8de0ee272 /test/kb_8042.c | |
parent | 64e38af781a42a346f59ef27c352f4818bfa1516 (diff) | |
download | chrome-ec-74abf3697109b2719d0dbc4e60667740de872fb3.tar.gz |
Test sysjump tag in kb_8042 test
This checks that keyboard state is preserved across system jump.
BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None
Change-Id: I53c5bb68246fd117b351d89c3907daf028bc4ef3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62908
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test/kb_8042.c')
-rw-r--r-- | test/kb_8042.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/test/kb_8042.c b/test/kb_8042.c index 8fa3158dd7..a0fbaad4d5 100644 --- a/test/kb_8042.c +++ b/test/kb_8042.c @@ -14,6 +14,7 @@ #include "keyboard_protocol.h" #include "keyboard_scan.h" #include "lpc.h" +#include "system.h" #include "test_util.h" #include "timer.h" #include "util.h" @@ -193,14 +194,47 @@ static int test_scancode_set2(void) return EC_SUCCESS; } +static int test_sysjump(void) +{ + set_scancode(2); + enable_keystroke(1); + + system_run_image_copy(SYSTEM_IMAGE_RW); + + /* Shouldn't reach here */ + return EC_ERROR_UNKNOWN; +} + +static int test_sysjump_cont(void) +{ + write_cmd_byte(read_cmd_byte() | I8042_XLATE); + press_key(1, 1, 1); + VERIFY_LPC_CHAR("\x01"); + press_key(1, 1, 0); + VERIFY_LPC_CHAR("\x81"); + + write_cmd_byte(read_cmd_byte() & ~I8042_XLATE); + press_key(1, 1, 1); + VERIFY_LPC_CHAR("\x76"); + press_key(1, 1, 0); + VERIFY_LPC_CHAR("\xf0\x76"); + + return EC_SUCCESS; +} + void run_test(void) { test_reset(); - RUN_TEST(test_single_key_press); - RUN_TEST(test_disable_keystroke); - RUN_TEST(test_typematic); - RUN_TEST(test_scancode_set2); + if (system_get_image_copy() == SYSTEM_IMAGE_RO) { + RUN_TEST(test_single_key_press); + RUN_TEST(test_disable_keystroke); + RUN_TEST(test_typematic); + RUN_TEST(test_scancode_set2); + RUN_TEST(test_sysjump); + } else { + RUN_TEST(test_sysjump_cont); + } test_print_result(); } |