summaryrefslogtreecommitdiff
path: root/common/keyboard_8042.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-03-22 09:35:00 -0700
committerChromeBot <chrome-bot@google.com>2013-03-29 11:40:34 -0700
commitfe3ccdf70a002e651bc1a13bcc305ae1e3422154 (patch)
treea4e1f70850c720d2a1599285304816269fc489f1 /common/keyboard_8042.c
parent4311bc5ccf666d7425f1ea50eee08e3a032e2508 (diff)
downloadchrome-ec-fe3ccdf70a002e651bc1a13bcc305ae1e3422154.tar.gz
Merge lm4 and stm32 implementations of keyboard_scan
Scanning is now performed identically on all platforms. keyboard_scan talks to chip-specific keyboard_raw on the bottom end, and 8042 or mkbp keyboard protocol on the top end. 8042 can now take advantage of CONFIG_KEYBOARD_TEST to simulate scan results. BUG=chrome-os-partner:18360 BRANCH=none TEST=compile all boards; test keyboard on spring and link 1) Type on keyboard. Should produce keystrokes. 2) At EC console: kbpress 3 7 1 kbpress 3 7 0 Should produce 'r' keystroke(s); key repeat should kick in if you wait a while between the commands. 3) Hold power button while typing. Should not produce keystrokes. 4) Reboot with power+refresh+esc. Should go to recovery mode. 5) While the system is up, alt+volup+R should reboot the AP. Change-Id: I48e0bca15b869162672b5f54ffcb561f6fcf0f45 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46666 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r--common/keyboard_8042.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 1a991d7075..54cc5d0310 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -146,11 +146,6 @@ static const uint16_t scancode_set2[KEYBOARD_ROWS][KEYBOARD_COLS] = {
0x0044, 0x0000, 0xe075, 0xe06b},
};
-
-/* Recording which key is being simulated pressed. */
-static uint8_t simulated_key[KEYBOARD_COLS];
-
-
/* Log the traffic between EC and host -- for debug only */
#define MAX_KBLOG 512 /* Max events in keyboard log */
struct kblog_t {
@@ -834,53 +829,6 @@ DECLARE_CONSOLE_COMMAND(ctrlram, command_controller_ram,
"Get/set keyboard controller RAM",
NULL);
-
-static int command_keyboard_press(int argc, char **argv)
-{
- if (argc == 1) {
- int i, j;
-
- ccputs("Simulated key:\n");
- for (i = 0; i < KEYBOARD_COLS; ++i) {
- if (simulated_key[i] == 0)
- continue;
- for (j = 0; j < KEYBOARD_ROWS; ++j)
- if (simulated_key[i] & (1 << j))
- ccprintf("\t%d %d\n", i, j);
- }
-
- } else if (argc == 4) {
- int r, c, p;
- char *e;
-
- c = strtoi(argv[1], &e, 0);
- if (*e || c < 0 || c >= KEYBOARD_COLS)
- return EC_ERROR_PARAM1;
-
- r = strtoi(argv[2], &e, 0);
- if (*e || r < 0 || r >= KEYBOARD_ROWS)
- return EC_ERROR_PARAM2;
-
- p = strtoi(argv[3], &e, 0);
- if (*e || p < 0 || p > 1)
- return EC_ERROR_PARAM3;
-
- if ((simulated_key[c] & (1 << r)) == (p << r))
- return EC_SUCCESS;
-
- simulated_key[c] = (simulated_key[c] & ~(1 << r)) | (p << r);
-
- keyboard_state_changed(r, c, p);
- }
-
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(kbpress, command_keyboard_press,
- "[col] [row] [0 | 1]",
- "Simulate keypress",
- NULL);
-
-
static int command_keyboard_log(int argc, char **argv)
{
int i;
@@ -940,30 +888,6 @@ DECLARE_CONSOLE_COMMAND(kbd, command_keyboard,
NULL);
/*****************************************************************************/
-/* Host commands */
-
-static int mkbp_command_simulate_key(struct host_cmd_handler_args *args)
-{
- const struct ec_params_mkbp_simulate_key *p = args->params;
-
- /* Only available on unlocked systems */
- if (system_is_locked())
- return EC_RES_ACCESS_DENIED;
-
- if (p->col >= ARRAY_SIZE(simulated_key))
- return EC_RES_INVALID_PARAM;
-
- simulated_key[p->col] = (simulated_key[p->col] & ~(1 << p->row)) |
- (p->pressed << p->row);
-
- keyboard_state_changed(p->row, p->col, p->pressed);
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_MKBP_SIMULATE_KEY,
- mkbp_command_simulate_key,
- EC_VER_MASK(0));
-
-/*****************************************************************************/
/* Hooks */
/**