summaryrefslogtreecommitdiff
path: root/chip/stm32/keyboard_scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/keyboard_scan.c')
-rw-r--r--chip/stm32/keyboard_scan.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index db4263fd91..1e7298e3e7 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -678,6 +678,24 @@ void keyboard_enable_scanning(int enable)
}
}
+/* Changes to col,row here need to also be reflected in kernel.
+ * drivers/input/mkbp.c ... see KEY_BATTERY.
+ */
+#define BATTERY_KEY_COL 0
+#define BATTERY_KEY_ROW 7
+#define BATTERY_KEY_ROW_MASK (1 << BATTERY_KEY_ROW)
+
+void keyboard_send_battery_key()
+{
+ mutex_lock(&scanning_enabled);
+ debounced_state[BATTERY_KEY_COL] ^= BATTERY_KEY_ROW_MASK;
+ if (kb_fifo_add(debounced_state) == EC_SUCCESS)
+ board_interrupt_host(1);
+ else
+ CPRINTF("dropped battery keystroke\n");
+ mutex_unlock(&scanning_enabled);
+}
+
static int command_keyboard_press(int argc, char **argv)
{
int r, c, p;