diff options
author | Andrew McRae <amcrae@google.com> | 2022-04-08 04:39:41 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-08 05:59:54 +0000 |
commit | 95d619a9a02e5d980296c2b61d859fdd0f64d30a (patch) | |
tree | 54eb7d928b0c9597d48ea7e9140923264f3ca84f | |
parent | d9d2917bf49b0dc5c38e95dd257cb0ac9b80d9e5 (diff) | |
download | chrome-ec-95d619a9a02e5d980296c2b61d859fdd0f64d30a.tar.gz |
Revert "ectool: Allow a negative value for battery charge rate"
This reverts commit cd70889abfe59865efa29ce47bd1bff11dbb9acd.
Reason for revert: ACPI disallows negative rate values
Original change's description:
> ectool: Allow a negative value for battery charge rate
>
> A negative value indicates the battery is discharging, so
> allow ectool to display it.
>
> BUG=b:227275730
> TEST=cros deploy dut1 ec-utils
> BRANCH=none
>
> Signed-off-by: Andrew McRae <amcrae@google.com>
> Change-Id: I17191691d5e0eb29180cfed39b9991fa48797930
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3555952
> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Bug: b:227275730
Change-Id: I48913d7947fe1ded0ac45b79a0525427f5cf80d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577320
Auto-Submit: Andrew McRae <amcrae@google.com>
Commit-Queue: Andrew McRae <amcrae@google.com>
Tested-by: Andrew McRae <amcrae@google.com>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Commit-Queue: Peter Marheine <pmarheine@chromium.org>
-rw-r--r-- | util/ectool.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/ectool.c b/util/ectool.c index 479e7096a9..af116160e5 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -8033,8 +8033,9 @@ int cmd_battery(int argc, char *argv[]) printf(" Present voltage %u mV\n", val); val = read_mapped_mem32(EC_MEMMAP_BATT_RATE); - /* Current can be negative */ - printf(" Present current %d mA\n", val); + if (!is_battery_range(val)) + goto cmd_error; + printf(" Present current %u mA\n", val); val = read_mapped_mem32(EC_MEMMAP_BATT_CAP); if (!is_battery_range(val)) |