diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-06-21 18:19:28 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-03 14:22:00 -0700 |
commit | 34e5148a45f33c41ded184660ce4f013592c46dc (patch) | |
tree | cbb68c7c6af1570a174f6eea6b735b1074e814b1 /util/comm-dev.c | |
parent | c7005a4d95e25144666d44cc410bb0f561adb958 (diff) | |
download | chrome-ec-34e5148a45f33c41ded184660ce4f013592c46dc.tar.gz |
Retry ectool commands that return EC_RES_IN_PROGRESS
This came up when testing issue 242706. If you tell the EC to return
EC_RES_IN_PROGRESS, then the EC gets stuck and times out on the next
command.
I'm not entirely sure what the correct response should be, but I think that
the EC might not be doing the right thing either. In any event, this keeps
it from getting stuck.
BUG=none
BRANCH=none
TEST=manual
Try
ectool test 8 14
ectool test 0 14
The first command fails because we told it to, but the second command also
fails because the EC is expecting something else.
After this change, the second command works.
Change-Id: I513294396cff872018316c354d2c41953eb6fdf6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59661
Diffstat (limited to 'util/comm-dev.c')
-rw-r--r-- | util/comm-dev.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/util/comm-dev.c b/util/comm-dev.c index 6dac13fde3..3e45ab866e 100644 --- a/util/comm-dev.c +++ b/util/comm-dev.c @@ -38,12 +38,18 @@ static int ec_command_dev(int command, int version, if (r < 0) { fprintf(stderr, "ioctl %d, errno %d (%s), EC result %d\n", r, errno, strerror(errno), s_cmd.result); - return r; - } - if (s_cmd.result != EC_RES_SUCCESS) + if (errno == EAGAIN && s_cmd.result == EC_RES_IN_PROGRESS) { + s_cmd.command = EC_CMD_RESEND_RESPONSE; + r = ioctl(fd, CROS_EC_DEV_IOCXCMD, &s_cmd); + fprintf(stderr, + "ioctl %d, errno %d (%s), EC result %d\n", + r, errno, strerror(errno), s_cmd.result); + } + } else if (s_cmd.result != EC_RES_SUCCESS) { fprintf(stderr, "EC result %d\n", s_cmd.result); + } - return s_cmd.insize; + return r ? r : s_cmd.insize; } static int ec_readmem_dev(int offset, int bytes, void *dest) |