diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-07-25 21:17:13 -0500 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-26 14:07:45 -0700 |
commit | 1b4c5cf71e01ea89af8353eab5e4a62af6d3e894 (patch) | |
tree | c7c66f04bb34aa347b69f7ef53789d3f248bd6bd /util | |
parent | ac78e589af2fd74c36b570130dd0dde03f35e572 (diff) | |
download | chrome-ec-1b4c5cf71e01ea89af8353eab5e4a62af6d3e894.tar.gz |
ectool: fix console command
There are a few issues with console output:
1. The EC was returning more bytes than the message's insize. The
reason stems from a refacotring that the set the global
ec_max_insize variables to 'EC_PROTO2_MAX_PARAM_SIZE - 8'.
It really should be EC_PROTO2_MAX_PARAM_SIZE to cover the
maximum packet size returned from the EC.
2. A change was made to handle EAGAIN returning from the EC kernel
driver's ioctl() interface. That change prevented 0 bytes received
from being returned properly.
The first issue occurs because the EC console is always larger than
what the original ec_max_insize was set to. This caused no console
messages to be displayed. The second issue causes the console command
to potentially loop forever because the drain of the EC console is
never indicated because 0 could never be returned.
BUG=chrome-os-partner:21165
BRANCH=falco,peppy
TEST=Built and can now read 'ectool console' output as well
as not including gargabe.
Change-Id: I3114594f0020a5198532aa78ce126f4da6caf09a
Reviewed-on: https://gerrit.chromium.org/gerrit/63445
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/comm-dev.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/util/comm-dev.c b/util/comm-dev.c index 89b1cd9069..a9c2157d64 100644 --- a/util/comm-dev.c +++ b/util/comm-dev.c @@ -49,7 +49,7 @@ static int ec_command_dev(int command, int version, fprintf(stderr, "EC result %d\n", s_cmd.result); } - return r ? r : s_cmd.insize; + return r; } static int ec_readmem_dev(int offset, int bytes, void *dest) @@ -108,9 +108,13 @@ int comm_init_dev(void) /* * TODO: need a way to get this from the driver and EC. For now, - * pick a magic lowest common denominator value. + * pick a magic lowest common denominator value. The ec_max_outsize + * is set to handle v3 EC protocol. The ec_max_insize needs to be + * set to the largest value that can be returned from the EC, + * EC_PROTO2_MAX_PARAM_SIZE. */ - ec_max_insize = ec_max_outsize = EC_PROTO2_MAX_PARAM_SIZE - 8; + ec_max_outsize = EC_PROTO2_MAX_PARAM_SIZE - 8; + ec_max_insize = EC_PROTO2_MAX_PARAM_SIZE; return 0; } |