From f31e83d6cf44fccd25be48b67dd69aaff6c5e1f4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 9 Nov 2020 07:45:02 -0700 Subject: [PATCH 1/4] binman: Handle tool paths containing '~' correctly At present if CROSS_COMPILE contains a tilde, such as ~/.buildman-toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-gcc then binman gives a confusing error: binman: Error 255 running '~/..buildman-toolchains/gcc-7.3.0- ... Fix this by expanding it out before running the tool. Signed-off-by: Simon Glass --- tools/patman/tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/patman/tools.py b/tools/patman/tools.py index bbb157da87..05b1a1d4b0 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -333,6 +333,7 @@ def Run(name, *args, **kwargs): elif for_host: name, extra_args = GetHostCompileTool(name) args = tuple(extra_args) + args + name = os.path.expanduser(name) # Expand paths containing ~ all_args = (name,) + args result = command.RunPipe([all_args], capture=True, capture_stderr=True, env=env, raise_on_error=False, binary=binary) From 87d07ccc237a5bfd8be119af46140a4467122ca7 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Sat, 14 Nov 2020 01:01:42 +0300 Subject: [PATCH 2/4] sandbox: cros_ec: Basic support for EC_CMD_GET_NEXT_EVENT Since commit 690079767803 ("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: 690079767803 ("cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT") Reported-by: Heinrich Schuchardt Signed-off-by: Alper Nebi Yasak Tested-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- drivers/misc/cros_ec_sandbox.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index ff7f782742..d72db3eace 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -460,16 +460,14 @@ 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; + case EC_CMD_GET_NEXT_EVENT: { + struct ec_response_get_next_event *resp = resp_data; + + resp->event_type = EC_MKBP_EVENT_KEY_MATRIX; + cros_ec_keyscan(ec, resp->data.key_matrix); + len = sizeof(*resp); + break; + } default: printf(" ** Unknown EC command %#02x\n", req_hdr->command); return -1; From e7e7e1093b5243b058c420eaebf9373cf2d3f270 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 15 Nov 2020 21:22:53 +0100 Subject: [PATCH 3/4] dm: core: Fix incorrect flag check The test should be checking whether $flags are non-zero and $drv_flags contain specific flags, however these two sets of flags are separate, and the two tests should be logically ANDed, not bitwise ANDed. Signed-off-by: Marek Vasut Cc: Simon Glass Reviewed-by: Simon Glass --- drivers/core/device-remove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index efdb0f2905..0924a575f5 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -152,7 +152,7 @@ void device_free(struct udevice *dev) static bool flags_remove(uint flags, uint drv_flags) { if ((flags & DM_REMOVE_NORMAL) || - (flags & (drv_flags & (DM_FLAG_ACTIVE_DMA | DM_FLAG_OS_PREPARE)))) + (flags && (drv_flags & (DM_FLAG_ACTIVE_DMA | DM_FLAG_OS_PREPARE)))) return true; return false; From a9e73d287bfd6bfc778c532128a20767ee305193 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 23 Nov 2020 09:08:19 +0100 Subject: [PATCH 4/4] binman: Remove additional backslash The origin patch didn't have this change and it was caused by manual resolution where additional backslash was added. Fixes: 6723b4c6ca7b ("binman: Call helper function binman_set_rom_offset() to fill offset") Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- lib/binman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/binman.c b/lib/binman.c index d395b1cf70..f027d1b304 100644 --- a/lib/binman.c +++ b/lib/binman.c @@ -104,6 +104,6 @@ int binman_init(void) binman->image = node; } binman_set_rom_offset(ROM_OFFSET_NONE); -\ + return 0; }