diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-06-14 18:11:46 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-06-15 13:39:22 -0700 |
commit | 9c08e8994e8e09709b096a7e6f1cb17faa0ce52c (patch) | |
tree | 61f969958882fd5bc793ec838e9089a171271625 | |
parent | b4d996a5ea2cfeb8358a83bc1698a23b819e9242 (diff) | |
download | chrome-ec-9c08e8994e8e09709b096a7e6f1cb17faa0ce52c.tar.gz |
Add kbd command to print/set keyboard enable status
(And maybe other keyboard status in the future...)
BUG=chrome-os-partner:10358
TEST=manual
reboot
kbd -> should show disabled
power on system, wait for it to boot
ctrl+alt+F2 -> should be able to type at console
kbd -> should show enabled
kbd disable -> should no longer be able to type at console
kbd enable -> should again be able to type at console
Change-Id: Icdb38b09f318a47b0413609294b44cd810e8f389
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25353
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | common/keyboard.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/common/keyboard.c b/common/keyboard.c index 209fb3b8e6..7ef263df37 100644 --- a/common/keyboard.c +++ b/common/keyboard.c @@ -308,12 +308,12 @@ void keyboard_state_changed(int row, int col, int is_pressed) } -void keyboard_enable(int enable) +static void keyboard_enable(int enable) { if (!keyboard_enabled && enable) { - /* enable */ + CPRINTF("[%T KB enable]\n"); } else if (keyboard_enabled && !enable) { - /* disable */ + CPRINTF("[%T KB disable]\n"); reset_rate_and_delay(); typematic_len = 0; /* stop typematic */ } @@ -321,7 +321,7 @@ void keyboard_enable(int enable) } -uint8_t read_ctl_ram(uint8_t addr) +static uint8_t read_ctl_ram(uint8_t addr) { if (addr < ARRAY_SIZE(controller_ram)) return controller_ram[addr]; @@ -332,7 +332,7 @@ uint8_t read_ctl_ram(uint8_t addr) /* Manipulate the controller_ram[]. Some bits change may trigger internal * state change. */ -void update_ctl_ram(uint8_t addr, uint8_t data) +static void update_ctl_ram(uint8_t addr, uint8_t data) { uint8_t orig; @@ -708,6 +708,8 @@ void keyboard_typematic_task(void) } } +/*****************************************************************************/ +/* Console commands */ static int command_typematic(int argc, char **argv) { @@ -867,6 +869,28 @@ DECLARE_CONSOLE_COMMAND(kblog, command_keyboard_log, NULL); +static int command_keyboard(int argc, char **argv) +{ + if (argc > 1) { + if (!strcasecmp(argv[1], "enable")) + keyboard_enable(1); + else if (!strcasecmp(argv[1], "disable")) + keyboard_enable(0); + else + return EC_ERROR_PARAM1; + } + + ccprintf("Enabled: %d\n", keyboard_enabled); + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(kbd, command_keyboard, + "[enable | disable]", + "Print or toggle keyboard info", + NULL); + +/*****************************************************************************/ +/* Host commands */ + static int mkbp_command_simulate_key(uint8_t *data, int *resp_size) { struct ec_params_mkbp_simulate_key *p = @@ -883,6 +907,8 @@ static int mkbp_command_simulate_key(uint8_t *data, int *resp_size) } DECLARE_HOST_COMMAND(EC_CMD_MKBP_SIMULATE_KEY, mkbp_command_simulate_key); +/*****************************************************************************/ +/* Hooks */ /* Preserves the states of keyboard controller to keep the initialized states * between reboot_ec commands. Saving info include: |