summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2013-06-24 10:40:48 -0700
committerYung-chieh Lo <yjlou@chromium.org>2014-04-30 01:23:57 +0000
commite4a9915dddc4357201a853cc2ffff3398e1b110a (patch)
tree536183c671f8a7e069c1dce1851baebea83a33fa
parentef9a9cad9a9f076b3f2ab30c21c9cab3da8d1351 (diff)
downloadchrome-ec-e4a9915dddc4357201a853cc2ffff3398e1b110a.tar.gz
keyboard: Preserve keystroke enable state.
Preserve the state of keystroke_enabled to prevent keystrokes from being initially disabled on RO --> RW transition. This will allow us to use the keyboard on EC cold boot. BUG=chrome-os-partner:20430. TEST=Manual. Verify keyboard works on EC cold boot on Peppy. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59798 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> (cherry picked from commit 6957684d304825cc6fd926c8ee7a2ccb1edb6839) Change-Id: Ide0a798c20948e8db24e1bb74b58b4d4337d2147 Original-Change-Id: Ia26ff7fc6e314f50b92d85a97f1b2cfdc7163b6e Reviewed-on: https://chromium-review.googlesource.com/197527 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--common/keyboard.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/common/keyboard.c b/common/keyboard.c
index c65d3679be..98ebe5121f 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -98,12 +98,13 @@ static uint8_t typematic_scan_code[MAX_SCAN_CODE_LEN];
#define KB_SYSJUMP_TAG 0x4b42 /* "KB" */
-#define KB_HOOK_VERSION 1
+#define KB_HOOK_VERSION 2
/* the previous keyboard state before reboot_ec. */
struct kb_state {
uint8_t codeset;
uint8_t ctlram;
- uint8_t pad[2]; /* Pad to 4 bytes for system_add_jump_tag(). */
+ uint8_t keystroke_enabled;
+ uint8_t pad; /* Pad to 4 bytes for system_add_jump_tag(). */
};
@@ -1001,6 +1002,7 @@ static int keyboard_preserve_state(void)
state.codeset = scancode_set;
state.ctlram = controller_ram[0];
+ state.keystroke_enabled = keystroke_enabled;
system_add_jump_tag(KB_SYSJUMP_TAG, KB_HOOK_VERSION,
sizeof(state), &state);
@@ -1022,6 +1024,15 @@ static int keyboard_restore_state(void)
/* Coming back from a sysjump, so restore settings. */
scancode_set = prev->codeset;
update_ctl_ram(0, prev->ctlram);
+ keystroke_enabled = prev->keystroke_enabled;
+ } else if (prev && version == 1) {
+ /*
+ * Some variables are kept. Assume keystroke_enabled is enabled.
+ * See #25 of crbug.com/362108.
+ */
+ scancode_set = prev->codeset;
+ update_ctl_ram(0, prev->ctlram);
+ keystroke_enabled = 1;
}
return EC_SUCCESS;