summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-09-27 15:11:22 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-30 18:58:11 +0000
commit5ee634b1a576fd41a5f25f8bf75e2974001894b0 (patch)
tree930c63b1503762889212c0a5dc06545babd4cffe
parent734916edfdde3ec2894a75a3c84bd90e4626a77d (diff)
downloadchrome-ec-5ee634b1a576fd41a5f25f8bf75e2974001894b0.tar.gz
Battery command needs to delay between iterations
The battery command takes a long time to run if given a high repeat count. Since it doesn't sleep at all between iterations by default, this will unsurprisingly starve all other tasks and cause a watchdog timeout. Reset the watchdog between iterations, to give the rest of the system time to do things. This is similar to what we do in the i2cscan command. BUG=chrome-os-partner:22232 BRANCH=none TEST=apshutdown, then battery 1000 = no watchdog Change-Id: I3ce55e15d90a6dfda34b1e2e332d7f7828922e78 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/170968
-rw-r--r--common/battery.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/battery.c b/common/battery.c
index f61c2585ef..0c25486101 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -9,6 +9,7 @@
#include "console.h"
#include "timer.h"
#include "util.h"
+#include "watchdog.h"
static const char *get_error_text(int rv)
{
@@ -169,6 +170,13 @@ static int command_battery(int argc, char **argv)
for (loop = 0; loop < repeat; loop++) {
rv = print_battery_info();
+ /*
+ * Running with a high repeat count will take so long the
+ * watchdog timer fires. So reset the watchdog timer each
+ * iteration.
+ */
+ watchdog_reload();
+
if (sleep_ms)
msleep(sleep_ms);