summaryrefslogtreecommitdiff
path: root/include/ec_commands.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2016-07-08 09:24:20 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-19 18:33:39 -0700
commit824f9fadc257ecbbaab2e2296f56dfc72325dd7f (patch)
treef4a10fbe74837a5a29dd053869dc3fa7aebe078c /include/ec_commands.h
parent0325284e17c04dbd03552f2b152cf3e079d7148f (diff)
downloadchrome-ec-824f9fadc257ecbbaab2e2296f56dfc72325dd7f.tar.gz
mkbp: Extend EC_CMD_MKBP_GET_INFO.
- Added ability to query the buttons and switches. - Added ability to report the available buttons or switches. BUG=chromium:626863 BRANCH=None TEST=make -j buildall CQ-DEPEND=CL:358633 CQ-DEPEND=CL:358634 CQ-DEPEND=CL:358989 Change-Id: Ie821491269e8d09578eba92127895c0b6b8e91a9 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/358926 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/ec_commands.h')
-rw-r--r--include/ec_commands.h57
1 files changed, 54 insertions, 3 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index f724a56458..660a432b35 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -2382,18 +2382,69 @@ struct ec_response_tmp006_get_raw {
*
* Returns raw data for keyboard cols; see ec_response_mkbp_info.cols for
* expected response size.
+ *
+ * NOTE: This has been superseded by EC_CMD_MKBP_GET_NEXT_EVENT. If you wish
+ * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type
+ * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX.
*/
#define EC_CMD_MKBP_STATE 0x60
-/* Provide information about the matrix : number of rows and columns */
+/*
+ * Provide information about various MKBP things. See enum ec_mkbp_info_type.
+ */
#define EC_CMD_MKBP_INFO 0x61
struct ec_response_mkbp_info {
uint32_t rows;
uint32_t cols;
- uint8_t switches;
+ /* Formerly "switches", which was 0. */
+ uint8_t reserved;
+} __packed;
+
+struct ec_params_mkbp_info {
+ uint8_t info_type;
+ uint8_t event_type;
} __packed;
+enum ec_mkbp_info_type {
+ /*
+ * Info about the keyboard matrix: number of rows and columns.
+ *
+ * Returns struct ec_response_mkbp_info.
+ */
+ EC_MKBP_INFO_KBD = 0,
+
+ /*
+ * For buttons and switches, info about which specifically are
+ * supported. event_type must be set to one of the values in enum
+ * ec_mkbp_event.
+ *
+ * For EC_MKBP_EVENT_BUTTON and EC_MKBP_EVENT_SWITCH, returns a 4 byte
+ * bitmask indicating which buttons or switches are present. See the
+ * bit inidices below.
+ */
+ EC_MKBP_INFO_SUPPORTED = 1,
+
+ /*
+ * Instantaneous state of buttons and switches.
+ *
+ * event_type must be set to one of the values in enum ec_mkbp_event.
+ *
+ * For EC_MKBP_EVENT_KEY_MATRIX, returns uint8_t key_matrix[13]
+ * indicating the current state of the keyboard matrix.
+ *
+ * For EC_MKBP_EVENT_HOST_EVENT, return uint32_t host_event, the raw
+ * event state.
+ *
+ * For EC_MKBP_EVENT_BUTTON, returns uint32_t buttons, indicating the
+ * state of supported buttons.
+ *
+ * For EC_MKBP_EVENT_SWITCH, returns uint32_t switches, indicating the
+ * state of supported switches.
+ */
+ EC_MKBP_INFO_CURRENT = 2,
+};
+
/* Simulate key press */
#define EC_CMD_MKBP_SIMULATE_KEY 0x62
@@ -2559,7 +2610,7 @@ struct ec_response_get_next_event {
union ec_response_get_next_data data;
} __packed;
-/* Bit definitions for buttons and switches.*/
+/* Bit indices for buttons and switches.*/
/* Buttons */
#define EC_MKBP_POWER_BUTTON 0
#define EC_MKBP_VOL_UP 1