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>
This commit is contained in:
Shawn Nematbakhsh
2013-08-05 15:08:52 -07:00
committed by ChromeBot
parent 63a71a6adc
commit e98bde3fec
2 changed files with 4 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;