diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2013-08-05 15:08:52 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-08-07 13:35:48 -0700 |
commit | e98bde3fec5e53314a15fd031c83ee630973483f (patch) | |
tree | bd37149b03284da58795d74088183f1df71ada9b | |
parent | 63a71a6adce21a0354cf8d2245170da824f7d8c2 (diff) | |
download | chrome-ec-e98bde3fec5e53314a15fd031c83ee630973483f.tar.gz |
ectool: Return non-success exit code on bad EC status.
When running certain ectool commands, our ioctl may succeed, yet our
command may not be successful for a variety of reasons (see ec_status
enum). In this case, we should return a non-success exit code so that we
can easily detect such failures in scripts.
BUG=chrome-os-partner:21171.
TEST=Pass FAFT suite on Peppy. Pass factory tests on Peppy.
BRANCH=None.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ia33b8285fb048b256f0668b709573e86c15f1162
Reviewed-on: https://gerrit.chromium.org/gerrit/64686
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | util/comm-dev.c | 1 | ||||
-rw-r--r-- | util/comm-host.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/util/comm-dev.c b/util/comm-dev.c index a9c2157d64..1175f92555 100644 --- a/util/comm-dev.c +++ b/util/comm-dev.c @@ -47,6 +47,7 @@ static int ec_command_dev(int command, int version, } } else if (s_cmd.result != EC_RES_SUCCESS) { fprintf(stderr, "EC result %d\n", s_cmd.result); + return -EECRESULT - s_cmd.result; } return r; diff --git a/util/comm-host.h b/util/comm-host.h index 695fc33c4f..1e01d58e40 100644 --- a/util/comm-host.h +++ b/util/comm-host.h @@ -12,6 +12,9 @@ #include "common.h" #include "ec_commands.h" +/* ec_command return value for non-success result from EC */ +#define EECRESULT 1000 + /* Maximum output and input sizes for EC command, in bytes */ extern int ec_max_outsize, ec_max_insize; |