diff options
author | B R, Harsha <harsha.b.r@intel.com> | 2022-01-07 03:38:19 +0530 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-31 07:26:09 +0000 |
commit | c182ea76fa2272de9363a0c43b68fbe079c8b514 (patch) | |
tree | 50bd7f14189fe61e62e6e23c4e1818a196e84242 | |
parent | bc634d12208469033f77c63c0fa0ff9fcc579014 (diff) | |
download | chrome-ec-c182ea76fa2272de9363a0c43b68fbe079c8b514.tar.gz |
ectool: fix "ectool thermalget" ioctl error
thermalget throws ioctl error as looping exceeds
the valid sensor count/id. Add condition to check if
the loop count/sensor_id is valid or invalid based on
the flag EC_TEMP_SENSOR_NOT_PRESENT.
CPU Console:
localhost ~ # ectool thermalget
sensor warn high halt fan_off fan_max name
0 0 358 363 308 333 DDR and SOC
1 0 358 363 308 333 Ambient
2 0 378 393 308 338 Charger
3 0 403 403 308 333 WWAN
(all temps in degrees Kelvin)
BUG=none
BRANCH=none
TEST=make buildall -j, zmake testall,
Run ectool thermalget on CPU console (on brya & gimble)
Signed-off-by: B R, Harsha <harsha.b.r@intel.com>
Change-Id: I400e6159bfe8593a93c37de8d6413be2e20fab4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3369162
Reviewed-by: Harsha BR <harsha.b.r@intel.corp-partner.google.com>
Tested-by: Harsha BR <harsha.b.r@intel.corp-partner.google.com>
Reviewed-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | util/ectool.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c index 8ea43bfb7d..723a9b7f12 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -3271,6 +3271,10 @@ int cmd_thermal_get_threshold_v1(int argc, char *argv[]) printf("sensor warn high halt fan_off fan_max name\n"); for (i = 0; i < EC_MAX_TEMP_SENSOR_ENTRIES; i++) { + if (read_mapped_temperature(i) == + EC_TEMP_SENSOR_NOT_PRESENT) + continue; + /* ask for one */ p.sensor_num = i; rv = ec_command(EC_CMD_THERMAL_GET_THRESHOLD, 1, |