summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-03-13 09:46:00 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-14 00:45:41 +0000
commit911da8c150d9d38b9a9f14453098bd1e0f838b49 (patch)
tree584fd9f8b678dec7453db8a729ef59ae62822733
parent4c75ac48d3d366e950ebb0def90e661d70a13895 (diff)
downloadchrome-ec-911da8c150d9d38b9a9f14453098bd1e0f838b49.tar.gz
ectool: Always try v0 of GET_VERSIONS command if v1 fails
The ioctl return status for CROS_EC_DEV_IOCXCMD is inconsistent across kernel versions: - In 3.8 kernel, on INVALID_VERSION EC result, -EBADMSG is returned - In 3.14 kernel, on INVALID_VERSION EC result, success status is returned In both cases, the INVALID_VERSION result is written to the cros_ec_command.result parameter. The inconsistency here should be fixed with kernel patches. In any case, there is little harm with trying v0 of GET_VERSIONS on any failure of the v1 command. BUG=chrome-os-partner:37668,chromium:466896 TEST=Manual on peppy. Verify 'ectool thermalget 0 0' prints threshold info. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ic1eb3f8f2fa95711ec15a5afb740af8f18b88b55 Reviewed-on: https://chromium-review.googlesource.com/260004 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Bill Richardson <wfrichar@chromium.org> Trybot-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--util/misc_util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/misc_util.c b/util/misc_util.c
index 9699ac4a61..63c0fead2a 100644
--- a/util/misc_util.c
+++ b/util/misc_util.c
@@ -104,7 +104,7 @@ int ec_get_cmd_versions(int cmd, uint32_t *pmask)
rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 1, &pver_v1, sizeof(pver_v1),
&rver, sizeof(rver));
- if (rv == -EECRESULT - EC_RES_INVALID_VERSION) {
+ if (rv < 0) {
pver.cmd = cmd;
rv = ec_command(EC_CMD_GET_CMD_VERSIONS, 0, &pver, sizeof(pver),
&rver, sizeof(rver));