summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFiras Sammoura <fsammoura@google.com>2022-06-01 22:07:17 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-16 01:01:41 +0000
commit143747a4577966c56143a04303db5b8f58f05256 (patch)
tree517139213972371f68fa573d60d0d3b0ca2a4a40
parent981fb88cf8438f43a989aec27d85c15c112c9282 (diff)
downloadchrome-ec-143747a4577966c56143a04303db5b8f58f05256.tar.gz
common: Fix host command print formatting
Modify the format of how the host commands are being printed. Change the zero paddings from 2 to 4 to conform with the command, which is defined as a 16-bit value. The previous method will not result in incorrect output for commands requiring more than two digits. BUG=b:231975323 BRANCH=None TEST=./test/run_device_test.py --board bloonchipper TEST=make buildall Signed-off-by: Firas Sammoura <fsammoura@google.com> Change-Id: I4dd5507096a5a02f9554a164cae610683aebfec0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3705694 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--common/host_command.c6
-rw-r--r--common/host_command_controller.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/common/host_command.c b/common/host_command.c
index 0edd188984..e05475ce48 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -660,11 +660,11 @@ static void host_command_debug_request(struct host_cmd_handler_args *args)
}
if (hcdebug >= HCDEBUG_PARAMS && args->params_size)
- CPRINTS("HC 0x%02x.%d:%ph", args->command,
+ CPRINTS("HC 0x%04x.%d:%ph", args->command,
args->version,
HEX_BUF(args->params, args->params_size));
else
- CPRINTS("HC 0x%02x", args->command);
+ CPRINTS("HC 0x%04x", args->command);
}
uint16_t host_command_process(struct host_cmd_handler_args *args)
@@ -717,7 +717,7 @@ uint16_t host_command_process(struct host_cmd_handler_args *args)
}
if (rv != EC_RES_SUCCESS)
- CPRINTS("HC 0x%02x err %d", args->command, rv);
+ CPRINTS("HC 0x%04x err %d", args->command, rv);
if (hcdebug >= HCDEBUG_PARAMS && args->response_size)
CPRINTS("HC resp:%ph",
diff --git a/common/host_command_controller.c b/common/host_command_controller.c
index befa1865a6..eb35622ab3 100644
--- a/common/host_command_controller.c
+++ b/common/host_command_controller.c
@@ -119,7 +119,7 @@ static int pd_host_command_internal(int command, int version,
/* Check for host command error code */
ret = resp_buf[0];
if (ret) {
- CPRINTS("command 0x%02x returned error %d", command, ret);
+ CPRINTS("command 0x%04x returned error %d", command, ret);
return -ret;
}
@@ -154,7 +154,7 @@ static int pd_host_command_internal(int command, int version,
if ((uint8_t)sum) {
- CPRINTS("command 0x%02x bad checksum returned: %d",
+ CPRINTS("command 0x%04x bad checksum returned: %d",
command, sum);
return -EC_RES_INVALID_CHECKSUM;
}