summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-08-09 13:47:09 -0700
committerChromeBot <chrome-bot@google.com>2013-08-09 13:52:06 -0700
commit066da0693463b609556445bb797f5a31bcf5bf60 (patch)
tree657047c3aaafa4968b11823624d577eb461f5ff2 /util
parent76e74eea760aedb424912a2c98e7c650094dcb9e (diff)
downloadchrome-ec-066da0693463b609556445bb797f5a31bcf5bf60.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> Original-Change-Id: Ia33b8285fb048b256f0668b709573e86c15f1162 Reviewed-on: https://gerrit.chromium.org/gerrit/64686 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit e98bde3fec5e53314a15fd031c83ee630973483f) Change-Id: I64cbb6c2c63ccc77fb750448dd2a68d37f396125 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65374
Diffstat (limited to 'util')
-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;