diff options
author | Simon Glass <sjg@chromium.org> | 2013-07-01 20:06:30 +0900 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-02 14:34:43 -0700 |
commit | c7005a4d95e25144666d44cc410bb0f561adb958 (patch) | |
tree | 7f49c30f6e6c00343162e500acfbc8d7dff35a2c | |
parent | b5dcfef79f16fa37038ad68e1259159266c9ac1d (diff) | |
download | chrome-ec-c7005a4d95e25144666d44cc410bb0f561adb958.tar.gz |
ectool: Correct the empty console check
ectool is waiting for an empty response from the EC to tell it to stop
requesting console data. However, the EC only sends an empty response when
there is no snapshot data. In particular, it seems to send a 1 byte response
(containing just a \0 byte) when there is an empty string.
Adjust the check to stop when no data is provided.
BUG=chrome-os-partner:20639
BRANCH=none
TEST=manual
Run on test device and see that 'ectool console' now completes and does not
run forever.
Change-Id: I565f1be506833c823e5e7eca09be8b2420c8190c
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60640
Reviewed-by: Vadim Bendebury <vbendeb@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 39e49d16f5..702f8298b3 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -2790,8 +2790,9 @@ int cmd_console(int argc, char *argv[]) if (rv < 0) return rv; - if (rv == 0) - break; /* Empty response means done */ + /* Empty response means done */ + if (!rv || !*out) + break; /* Make sure output is null-terminated, then dump it */ out[ec_max_insize - 1] = '\0'; |