From 9361e9f12e4266d4536d0baba438d6b2ace77cb9 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Tue, 21 Feb 2023 08:59:19 -0800 Subject: Fan: print 'stalled' for rpm == 0xfffe This patch makes 'ectool pwmgetfanrpm' print 'stalled' in case the EC returns 0xfffe. This value used to be used for the EC to indicate a stalled fan but has been deprecated. ectool needs to continue to support old ECs. BUG=b:269241655 BRANCH=None TEST=buildall Signed-off-by: Daisuke Nojiri Change-Id: I252f35880859847b524857b6c2c44adb4b118b88 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4275601 Commit-Queue: Diana Z Reviewed-by: Diana Z --- include/ec_commands.h | 4 +++- util/ectool.cc | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/ec_commands.h b/include/ec_commands.h index 8c3f3c442e..87985175a5 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -252,7 +252,9 @@ extern "C" { /* Report 0 for fan stalled so userspace applications can take * an appropriate action based on this value to control the fan. */ -#define EC_FAN_SPEED_STALLED 0x0 /* Fan stalled */ +#define EC_FAN_SPEED_STALLED 0x0 +/* This should be used only for ectool to support old ECs. */ +#define EC_FAN_SPEED_STALLED_DEPRECATED 0xfffe /* Battery bit flags at EC_MEMMAP_BATT_FLAG. */ #define EC_BATT_FLAG_AC_PRESENT 0x01 diff --git a/util/ectool.cc b/util/ectool.cc index f0da13dd51..86c4210fba 100644 --- a/util/ectool.cc +++ b/util/ectool.cc @@ -3649,6 +3649,9 @@ static int print_fan(int idx) switch (rv) { case EC_FAN_SPEED_NOT_PRESENT: return -1; + case EC_FAN_SPEED_STALLED_DEPRECATED: + printf("Fan %d stalled (RPM: %d)\n", idx, rv); + break; default: printf("Fan %d RPM: %d\n", idx, rv); break; -- cgit v1.2.1