summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2021-03-09 09:05:39 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-26 00:27:57 +0000
commitf7e2b7ec38b416ce5965521ac2984b97ab38ecc1 (patch)
treecac85cba31f0d1a4eb2899a1e1d581135449c6b1 /util
parent71f8dd80c9380a839365dc82ac5ed4ce87e116b4 (diff)
downloadchrome-ec-release-R90-13816.B-main.tar.gz
This patch makes ctn730 driver print the firmware version. EC_CMD_PCHG is updated to version 1 and returns firmware version of a charger chip. Version 0 of EC_CMD_PCHG is deprecated. BUG=b:182600604, b:173235954, b:183151376 BRANCH=Trogdor TEST=Verify firmware version is printed on EC console. TEST=ectool pchg 0 (for version 1) TEST=cat /sys/class/power_supply/PCHG0/* (for version 0) "ERR kernel: [ 33.394847] cros-ec-pchg cros-ec-pchg.13.auto: Unable to get port.0 status (err:-524)" Cq-Depend: chromium:2786072 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ib7bb9a7225fe914bc6c8d600d0f4766dbf75ace8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757098 (cherry picked from commit 774ff171f1ff84e7f3daa2f367b9563e00656488) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787469
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/util/ectool.c b/util/ectool.c
index a85166ebe7..4200f3f143 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -9389,7 +9389,7 @@ int cmd_pchg(int argc, char *argv[])
struct ec_response_pchg *r = ec_inbuf;
p->port = port;
- rv = ec_command(EC_CMD_PCHG, 0, ec_outbuf, sizeof(*p),
+ rv = ec_command(EC_CMD_PCHG, 1, ec_outbuf, sizeof(*p),
ec_inbuf, ec_max_insize);
if (rv < 0) {
fprintf(stderr, "Error code: %d\n", rv);
@@ -9400,8 +9400,10 @@ int cmd_pchg(int argc, char *argv[])
r->state < sizeof(pchg_state_text) ?
pchg_state_text[r->state] : "UNDEF",
r->state);
- printf("Battery: %d%%\n", r->battery_percentage);
- printf("Flags: 0x%x\n", r->error);
+ printf("Battery: %u%%\n", r->battery_percentage);
+ printf("Errors: 0x%x\n", r->error);
+ printf("FW Version: 0x%x\n", r->fw_version);
+ printf("Dropped events: %u\n", r->dropped_event_count);
return 0;
}