From e71899a5734b151b79db896b88f00cac14b8e50a Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 17 Jan 2018 11:53:12 +0800 Subject: ectool: battery: Allow negative present current Battery interface over host command is different, as it allows negative current values to indicate discharge, let's not fail in that case. BRANCH=none BUG=b:65697620 TEST=ectool battery 1 does not fail when battery is discharging. Change-Id: I89ca750e24706f55a0589201aeaf9fea50f3132f Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/869552 Reviewed-by: Randall Spangler --- util/ectool.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/ectool.c b/util/ectool.c index 200b2faacf..c241b885c1 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -5977,9 +5977,8 @@ int get_battery_command(int index) goto cmd_error; printf(" Present voltage %u mV\n", dynamic_r.actual_voltage); - if (!is_battery_range(dynamic_r.actual_current)) - goto cmd_error; - printf(" Present current %u mA\n", dynamic_r.actual_current); + /* current can be negative */ + printf(" Present current %d mA\n", dynamic_r.actual_current); if (!is_battery_range(dynamic_r.remaining_capacity)) goto cmd_error; -- cgit v1.2.1