summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-07-15 11:21:08 -0700
committerChromeBot <chrome-bot@google.com>2013-07-16 10:59:06 -0700
commit1eeafbacbf06b0b2668beb8c35472e98a8f49d55 (patch)
tree73be3b33f358653d8403c9c4edb6b8ddc3697981 /util
parenta8cda83a2771a261e6ce1b37e61a14ed8407cd62 (diff)
downloadchrome-ec-1eeafbacbf06b0b2668beb8c35472e98a8f49d55.tar.gz
Add 'version' option to ectool test command.
This is just handy to be sure we're correclty passing the command version to the EC. BUG=chromium:242706 BRANCH=falco, peppy TEST=manual Run "hcdebug params" the EC console (using ToT EC) Compare the output on the EC console when you run these two commands on the host: ectool test 0 13 ectool test 0 13 1 You should see these two lines (among other things): [5728.756652 HC 0x0a.0:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] [5730.809596 HC 0x0a.1:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] The "0x0a.0" and "0x0a.1" indicate that the version is being passed correctly. Change-Id: I23b97ac6622274a157717f9375945d0866691a37 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61920 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 70edcf3329..1faf78f814 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -262,11 +262,12 @@ int cmd_test(int argc, char *argv[])
.buf = "0123456789abcdef0123456789ABCDEF"
};
struct ec_response_test_protocol r;
- int rv;
+ int rv, version = 0;
char *e;
if (argc < 3) {
- fprintf(stderr, "Usage: %s result length\n", argv[0]);
+ fprintf(stderr, "Usage: %s result length [version]\n",
+ argv[0]);
return -1;
}
@@ -281,7 +282,16 @@ int cmd_test(int argc, char *argv[])
return -1;
}
- rv = ec_command(EC_CMD_TEST_PROTOCOL, 0, &p, sizeof(p), &r, sizeof(r));
+ if (argc > 3) {
+ version = strtol(argv[3], &e, 0);
+ if (e && *e) {
+ fprintf(stderr, "invalid param (version)\n");
+ return -1;
+ }
+ }
+
+ rv = ec_command(EC_CMD_TEST_PROTOCOL, version,
+ &p, sizeof(p), &r, sizeof(r));
printf("rv = %d\n", rv);
return rv;