summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB R, Harsha <harsha.b.r@intel.com>2022-01-04 08:52:08 +0530
committerCommit Bot <commit-bot@chromium.org>2022-01-05 07:58:51 +0000
commite7b2f800b0c0c6995efbe2704f177d1ffb544ad2 (patch)
tree7d6592e0afe253b364f6ae26fb8d4cac0664edfd
parentd0c43e191f06ecde79f13e0e129de1329e622cf8 (diff)
downloadchrome-ec-e7b2f800b0c0c6995efbe2704f177d1ffb544ad2.tar.gz
ectool: fix "ectool temps all" ioctl error
temps all throws ioctl error for the random sensor_num. Initialize sensor_num of ec_params struct with a valid sensor id before call to EC_CMD_THERMAL_GET_THRESHOLD CPU Console: localhost ~ # ectool temps all --sensor name -------- temperature -------- fan speed -- DDR and SOC 311 K (= 38 C) 20% Fan 300 K (= 27 C) 0% Charger 308 K (= 35 C) 0% BUG=b:207724639 BRANCH=none TEST=make buildall -j, zmake testall, Run ectool temps all on CPU console (on brya & gimble) Signed-off-by: B R, Harsha <harsha.b.r@intel.com> Change-Id: I6c5826f5ddc94c687a1b2e402349efd039d30453 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3364072 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> 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> Commit-Queue: caveh jalali <caveh@chromium.org>
-rw-r--r--util/ectool.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 3eaac876fd..ea11dced61 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -3023,12 +3023,13 @@ int read_mapped_temperature(int id)
return rv;
}
-static int get_thermal_fan_percent(int temp)
+static int get_thermal_fan_percent(int temp, int sensor_id)
{
struct ec_params_thermal_get_threshold_v1 p;
struct ec_thermal_config r;
int rv = 0;
+ p.sensor_num = sensor_id;
rv = ec_command(EC_CMD_THERMAL_GET_THRESHOLD, 1, &p, sizeof(p),
&r, sizeof(r));
@@ -3055,7 +3056,7 @@ static int cmd_temperature_print(int id, int mtemp)
if (rc < 0)
return rc;
printf("%-20s %d K (= %d C) %11d%%\n", r.sensor_name, temp,
- K_TO_C(temp), get_thermal_fan_percent(temp));
+ K_TO_C(temp), get_thermal_fan_percent(temp, id));
return 0;
}