summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2013-02-10 23:07:40 +0800
committerChromeBot <chrome-bot@google.com>2013-02-23 17:34:20 -0800
commitc1b16d21e6315d6de9f697ff5a41eca288f4f754 (patch)
treef37c6ecbcfec9af8d094cd2d36520fa1bdbe63e6
parent17e84f1589f7f4fabff1b1a10a7f1b7e4faf9754 (diff)
downloadchrome-ec-c1b16d21e6315d6de9f697ff5a41eca288f4f754.tar.gz
Change the I8042_CMD_ENABLE (0xf4) for keystroke (not for KBC).
Old code treat following commands as the same: 1. I8042_CMD_ENABLE in include/i8042_protocol.h 2. I8042_ENA_KB (0xae) in include/i8042_protocol.h 3. bit 4 of command byte, see I8042_KBD_DIS in include/i8042_protocol.h New code changes 1 in keystroke_enabled variable. Signed-off-by: Yung-Chieh Lo <yjlou@chromium.org> BUG=chrome-os-partner:17005,chrome-os-partner:17810 BRANCH=link TEST=Tested vincent's script with following scenario: 1. not-workarounded kernel: PASS more than 2767, 2946, and 7300 loops. 2. workarounded kernel: PASS more than 5000 loops. Change-Id: I879a1b1f0186594e4b9dd7fc4320232ebab4a1e1 Reviewed-on: https://gerrit.chromium.org/gerrit/43006 Commit-Queue: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
-rw-r--r--common/keyboard.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/common/keyboard.c b/common/keyboard.c
index 2a68986a23..a9d0a38623 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -54,6 +54,7 @@ enum scancode_set_list {
* i8042 global settings.
*/
static int keyboard_enabled = 0; /* default the keyboard is disabled. */
+static int keystroke_enabled; /* output keystrokes */
static uint8_t resend_command[MAX_SCAN_CODE_LEN];
static uint8_t resend_command_len = 0;
static uint8_t controller_ram_address;
@@ -280,7 +281,7 @@ void keyboard_state_changed(int row, int col, int is_pressed)
&len);
if (ret == EC_SUCCESS) {
ASSERT(len > 0);
- if (keyboard_enabled)
+ if (keystroke_enabled)
i8042_send_to_host(len, scan_code);
}
@@ -309,6 +310,16 @@ static void keyboard_enable(int enable)
keyboard_enabled = enable;
}
+static void keystroke_enable(int enable)
+{
+ if (!keystroke_enabled && enable)
+ CPRINTF("[%T KS enable]\n");
+ else if (keystroke_enabled && !enable)
+ CPRINTF("[%T KS disable]\n");
+
+ keystroke_enabled = enable;
+}
+
static uint8_t read_ctl_ram(uint8_t addr)
{
@@ -482,13 +493,13 @@ int handle_keyboard_data(uint8_t data, uint8_t *output)
case I8042_CMD_ENABLE:
output[out_len++] = I8042_RET_ACK;
- keyboard_enable(1);
+ keystroke_enable(1);
keyboard_clear_underlying_buffer();
break;
case I8042_CMD_RESET_DIS:
output[out_len++] = I8042_RET_ACK;
- keyboard_enable(0);
+ keystroke_enable(0);
reset_rate_and_delay();
keyboard_clear_underlying_buffer();
break;
@@ -711,7 +722,7 @@ void keyboard_set_power_button(int pressed)
return;
code_set = acting_code_set(scancode_set);
- if (keyboard_enabled) {
+ if (keystroke_enabled) {
i8042_send_to_host(
(code_set == SCANCODE_SET_2 && !pressed) ? 3 : 2,
code[code_set - SCANCODE_SET_1][pressed]);
@@ -740,7 +751,7 @@ void keyboard_typematic_task(void)
if (typematic_delay <= 0) {
/* re-send to host */
- if (keyboard_enabled)
+ if (keystroke_enabled)
i8042_send_to_host(typematic_len,
typematic_scan_code);
typematic_delay = refill_inter_delay * 1000;