]> git.baikalelectronics.ru Git - uboot.git/commit
sandbox: cros_ec: Basic support for EC_CMD_GET_NEXT_EVENT
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>
Fri, 13 Nov 2020 22:01:42 +0000 (01:01 +0300)
committerSimon Glass <sjg@chromium.org>
Mon, 30 Nov 2020 20:14:43 +0000 (13:14 -0700)
commitba8182fb3b27ff004f582a6ca7911fbacb6df795
treeddddf05b787a0d5eba9491f2746679bc8b2ca7af
parenta97b07960b90a27ce052878c864e45e8aa8844a2
sandbox: cros_ec: Basic support for EC_CMD_GET_NEXT_EVENT

Since commit dc4ecf03bfd4 ("cros_ec: Support keyboard scanning with
EC_CMD_GET_NEXT_EVENT") the cros-ec-keyb driver has started using this
command, but the sandbox EC emulator does not recognize it and
continuously prints:

    ** Unknown EC command 0x67

This patch makes the sandbox driver send basic responses to the command,
but the response only supports keyboard scans for now.

The EC side of this command stores and returns events from a queue, and
returns -EC_RES_UNAVAILABLE when there are no new events. This should be
possible to implement by hooking into the SDL event queue (perhaps via
sandbox_sdl_poll_events). Implementing that is a bit harder to do since
the existing sandbox code is discarding pending keyboard events, then
reading the current keyboard state.

Since the EC emulator never explicitly fails to work on this command,
the fallback to the older command will not trigger and will not be
tested anymore.

Fixes: dc4ecf03bfd4 ("cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT")
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/misc/cros_ec_sandbox.c