summaryrefslogtreecommitdiff
path: root/common/keyboard_mkbp.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/keyboard_mkbp.c')
-rw-r--r--common/keyboard_mkbp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index 277e63dc03..e592addf2f 100644
--- a/common/keyboard_mkbp.c
+++ b/common/keyboard_mkbp.c
@@ -90,6 +90,7 @@ static int get_data_size(enum ec_mkbp_event e)
case EC_MKBP_EVENT_HOST_EVENT:
case EC_MKBP_EVENT_BUTTON:
case EC_MKBP_EVENT_SWITCH:
+ case EC_MKBP_EVENT_SYSRQ:
return sizeof(uint32_t);
default:
/* For unknown types, say it's 0. */
@@ -258,6 +259,15 @@ void keyboard_update_button(enum keyboard_button_type button, int is_pressed)
(const uint8_t *)&mkbp_button_state);
}
+#ifdef CONFIG_EMULATED_SYSRQ
+void send_sysrq(uint8_t key)
+{
+ uint32_t value = key;
+
+ mkbp_fifo_add(EC_MKBP_EVENT_SYSRQ, (const uint8_t *)&value);
+}
+#endif
+
#ifdef CONFIG_POWER_BUTTON
/**
* Handle power button changing state.
@@ -325,6 +335,14 @@ static int switch_get_next_event(uint8_t *out)
}
DECLARE_EVENT_SOURCE(EC_MKBP_EVENT_SWITCH, switch_get_next_event);
+#ifdef CONFIG_EMULATED_SYSRQ
+static int sysrq_get_next_event(uint8_t *out)
+{
+ return get_next_event(out, EC_MKBP_EVENT_SYSRQ);
+}
+DECLARE_EVENT_SOURCE(EC_MKBP_EVENT_SYSRQ, sysrq_get_next_event);
+#endif
+
void keyboard_send_battery_key(void)
{
uint8_t state[KEYBOARD_COLS];