summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2013-08-05 15:08:52 -0700
committerDave Parker <dparker@chromium.org>2013-08-13 16:42:36 -0700
commit8c791cd7634c1164175df47f52c83d2bd1fc6146 (patch)
tree47d683a9d86af434589c547ef874d8721baf907d
parente8191bc0eafdf8387767c05f7ca0a5134987dd07 (diff)
downloadchrome-ec-8c791cd7634c1164175df47f52c83d2bd1fc6146.tar.gz
CHERRY-PICK: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. Change-Id: I738c640756288a4aaffcdb4afa05c0bf3ba47429 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Original-Change-Id: Ia33b8285fb048b256f0668b709573e86c15f1162 Reviewed-on: https://gerrit.chromium.org/gerrit/64686 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65769 Reviewed-by: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
-rw-r--r--util/comm-dev.c1
-rw-r--r--util/comm-host.h3
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;