summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-12-25 17:18:23 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-06 02:33:04 +0000
commitc3adc315b3ba724bccafe7c97e2c1b8ab6120cf9 (patch)
tree1a7735730e1cc248fea742daef48c061e78c8652 /util
parent6fec4e4a69729cc715ceddaf9e8c6fad4ddacc80 (diff)
downloadchrome-ec-c3adc315b3ba724bccafe7c97e2c1b8ab6120cf9.tar.gz
Support command versioning of new host command range
We've extended host command range from 8-bit to 16-bit. Extend EC_CMD_GET_CMD_VERSIONS so that the host may query supported command versions of the new host commands. BRANCH=All BUG=chrome-os-partner:26577 TEST=Extend 'usbpd' to version 1. Test that we can check its version. TEST=Run 'ectool gpioget' with new ectool and old EC. TEST=Run 'ectool gpioget' with old ectool and new EC. Change-Id: I1651aaf21ac2604aea101244b5e53713ead8c1af Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237622 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/misc_util.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/misc_util.c b/util/misc_util.c
index 005c84e50c..9699ac4a61 100644
--- a/util/misc_util.c
+++ b/util/misc_util.c
@@ -93,16 +93,23 @@ int is_string_printable(const char *buf)
*/
int ec_get_cmd_versions(int cmd, uint32_t *pmask)
{
+ struct ec_params_get_cmd_versions_v1 pver_v1;
struct ec_params_get_cmd_versions pver;
struct ec_response_get_cmd_versions rver;
int rv;
*pmask = 0;
- pver.cmd = cmd;
- rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 0, &pver, sizeof(pver),
+ pver_v1.cmd = cmd;
+ rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 1, &pver_v1, sizeof(pver_v1),
&rver, sizeof(rver));
+ if (rv == -EECRESULT - EC_RES_INVALID_VERSION) {
+ pver.cmd = cmd;
+ rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 0, &pver, sizeof(pver),
+ &rver, sizeof(rver));
+ }
+
if (rv < 0)
return rv;