cros_ec: Handling EC_CMD_GET_NEXT_EVENT

With commit 6900797678 ("cros_ec: Support keyboard scanning with
EC_CMD_GET_NEXT_EVENT") check_for_keys() tries to read keyboard
strokes using EC_CMD_GET_NEXT_EVENT. But the sandbox driver does
not understand this command. We need to reply with
-EC_RES_INVALID_COMMAND to force check_for_keys() to fall back to
use EC_CMD_MKBP_STATE. Currently the driver prints

    ** Unknown EC command 0x67

in this case. With the patch the message is suppressed.

In a future patch we should upgrade the sandbox driver to provide
EC_CMD_GET_NEXT_EVENT support.

Fixes: 6900797678 ("cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt 2020-11-09 21:34:25 +01:00 committed by Simon Glass
parent 4cb862fe28
commit a3e458524c

View File

@ -460,6 +460,16 @@ static int process_cmd(struct ec_state *ec,
case EC_CMD_ENTERING_MODE:
len = 0;
break;
case EC_CMD_GET_NEXT_EVENT:
/*
* TODO:
* This driver emulates an old keyboard device supporting
* EC_CMD_MKBP_STATE. Current Chrome OS keyboards use
* EC_CMD_GET_NEXT_EVENT. Cf.
* "mkbp: Add support for buttons and switches"
* https://chromium.googlesource.com/chromiumos/platform/ec/+/87a071941b89e3f7fd3eb329b682e60b3fbd6c73
*/
return -EC_RES_INVALID_COMMAND;
default:
printf(" ** Unknown EC command %#02x\n", req_hdr->command);
return -1;