summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-23 10:10:51 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-24 06:42:02 +0000
commit342499a6d001eb6a442f0b6a8ea333d495da8f85 (patch)
treedc997c5566611453b9227504a001d807dae3bd8f
parent0ef55f5899481249a073cfecea53fea3ab154ea6 (diff)
downloadchrome-ec-342499a6d001eb6a442f0b6a8ea333d495da8f85.tar.gz
samus: change charge override hot keys to ctrl+search+0|1|2
Change the charge override hot keys to ctrol+search+0|1|2 BUG=none BRANCH=samus TEST=use the hot keys and verify that the PD console shows charge override host command Change-Id: I5551190743ea064a967164b9d95143cc966662e1 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/242832 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--common/keyboard_scan.c68
-rw-r--r--include/keyboard_config.h12
2 files changed, 41 insertions, 39 deletions
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index df9e9064ff..e67fe81b1b 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -278,18 +278,44 @@ static int check_runtime_keys(const uint8_t *state)
* be done at higher level than this.
*/
/*
- * All runtime key combos are (right or left ) alt + volume up|down +
- * (some key NOT on the same col as alt or volume up|down )
+ * On samus, ctrl + search + 0|1|2 sets the active charge port
+ * by sending the charge override host command. Should only be sent
+ * when chipset is in S0. Note that 'search' and '1' keys are on
+ * the same column.
*/
- if (state[KEYBOARD_COL_VOL_UP] != KEYBOARD_MASK_VOL_UP &&
- state[KEYBOARD_COL_VOL_DOWN] != KEYBOARD_MASK_VOL_DOWN)
-#else
+ if ((state[KEYBOARD_COL_LEFT_CTRL] == KEYBOARD_MASK_LEFT_CTRL ||
+ state[KEYBOARD_COL_RIGHT_CTRL] == KEYBOARD_MASK_RIGHT_CTRL) &&
+ ((state[KEYBOARD_COL_SEARCH] & KEYBOARD_MASK_SEARCH) ==
+ KEYBOARD_MASK_SEARCH) &&
+ chipset_in_state(CHIPSET_STATE_ON)) {
+ if (state[KEYBOARD_COL_KEY_0] == KEYBOARD_MASK_KEY_0) {
+ /* Charge from neither port */
+ chg_override = -2;
+ pd_host_command(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0,
+ &chg_override, 2, NULL, 0);
+ return 0;
+ } else if (state[KEYBOARD_COL_KEY_1] ==
+ (KEYBOARD_MASK_KEY_1 | KEYBOARD_MASK_SEARCH)) {
+ /* Charge from port 0 (left side) */
+ chg_override = 0;
+ pd_host_command(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0,
+ &chg_override, 2, NULL, 0);
+ return 0;
+ } else if (state[KEYBOARD_COL_KEY_2] == KEYBOARD_MASK_KEY_2) {
+ /* Charge from port 1 (right side) */
+ chg_override = 1;
+ pd_host_command(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0,
+ &chg_override, 2, NULL, 0);
+ return 0;
+ }
+ }
+#endif
+
/*
* All runtime key combos are (right or left ) alt + volume up + (some
* key NOT on the same col as alt or volume up )
*/
if (state[KEYBOARD_COL_VOL_UP] != KEYBOARD_MASK_VOL_UP)
-#endif
return 0;
if (state[KEYBOARD_COL_RIGHT_ALT] != KEYBOARD_MASK_RIGHT_ALT &&
@@ -322,36 +348,6 @@ static int check_runtime_keys(const uint8_t *state)
system_hibernate(0, 0);
return 1;
}
-#ifdef BOARD_SAMUS
- /*
- * TODO(crosbug.com/p/34850): remove these hot-keys for samus, should
- * be done at higher level than this.
- */
- /*
- * On samus, alt + volume down + 0|1|2 sets the active charge port
- * by sending the charge override host command. Should only be sent
- * when chipset is in S0.
- */
- else if (state[KEYBOARD_COL_VOL_DOWN] == KEYBOARD_MASK_VOL_DOWN &&
- chipset_in_state(CHIPSET_STATE_ON)) {
- if (state[KEYBOARD_COL_KEY_0] == KEYBOARD_MASK_KEY_0) {
- /* Charge from neither port */
- chg_override = -2;
- pd_host_command(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0,
- &chg_override, 2, NULL, 0);
- } else if (state[KEYBOARD_COL_KEY_1] == KEYBOARD_MASK_KEY_1) {
- /* Charge from port 0 (left side) */
- chg_override = 0;
- pd_host_command(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0,
- &chg_override, 2, NULL, 0);
- } else if (state[KEYBOARD_COL_KEY_2] == KEYBOARD_MASK_KEY_2) {
- /* Charge from port 1 (right side) */
- chg_override = 1;
- pd_host_command(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0,
- &chg_override, 2, NULL, 0);
- }
- }
-#endif
return 0;
}
diff --git a/include/keyboard_config.h b/include/keyboard_config.h
index 2c44259929..286b6d7560 100644
--- a/include/keyboard_config.h
+++ b/include/keyboard_config.h
@@ -41,9 +41,15 @@
#define KEYBOARD_COL_VOL_UP 4
#define KEYBOARD_ROW_VOL_UP 0
#define KEYBOARD_MASK_VOL_UP KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_VOL_UP)
-#define KEYBOARD_COL_VOL_DOWN 9
-#define KEYBOARD_ROW_VOL_DOWN 1
-#define KEYBOARD_MASK_VOL_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_VOL_DOWN)
+#define KEYBOARD_COL_LEFT_CTRL 0
+#define KEYBOARD_ROW_LEFT_CTRL 2
+#define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL)
+#define KEYBOARD_COL_RIGHT_CTRL 0
+#define KEYBOARD_ROW_RIGHT_CTRL 4
+#define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL)
+#define KEYBOARD_COL_SEARCH 1
+#define KEYBOARD_ROW_SEARCH 0
+#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
#define KEYBOARD_COL_KEY_0 8
#define KEYBOARD_ROW_KEY_0 6
#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)