diff options
author | Louis Yung-Chieh Lo <yjlou@chromium.org> | 2014-03-28 14:42:53 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-01 02:46:37 +0000 |
commit | 71766a39262b6ed4fec51cba19f10c6bec7e9f19 (patch) | |
tree | b95f11f41fce63376e3b2566ae926c2f00abc084 | |
parent | be17ca9d91d097f2ec742393e7c69928f46f1e17 (diff) | |
download | chrome-ec-71766a39262b6ed4fec51cba19f10c6bec7e9f19.tar.gz |
ectool: "temps all" lists nothing if no sensor connects to EC.
On some boards, the temperature sensor doesn't route to EC.
Thus the 'ectool temps all' would get "200" for every temp sensor.
This is misleading information.
So, check the EC_MEMMAP_THERMAL_VERSION before we dump. If it is 0,
then the temp data is not filled (and properly will not be filled).
BUG=chrome-os-partner:27460
BRANCH=all
TEST=Tested on big, which doesn't have sensor routed to EC.
Change-Id: I03e9736054ed602b7cc126e9fd958e0cecea79b4
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192149
Reviewed-by: Mao Huang <littlecvr@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | util/ectool.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/util/ectool.c b/util/ectool.c index abe05e7dcb..d989f34995 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -779,7 +779,13 @@ int read_mapped_temperature(int id) { int rv; - if (id < EC_TEMP_SENSOR_ENTRIES) + if (!read_mapped_mem8(EC_MEMMAP_THERMAL_VERSION)) { + /* + * The temp_sensor_init() is not called, which implies no + * temp sensor is defined. + */ + rv = EC_TEMP_SENSOR_NOT_PRESENT; + } else if (id < EC_TEMP_SENSOR_ENTRIES) rv = read_mapped_mem8(EC_MEMMAP_TEMP_SENSOR + id); else if (read_mapped_mem8(EC_MEMMAP_THERMAL_VERSION) >= 2) rv = read_mapped_mem8(EC_MEMMAP_TEMP_SENSOR_B + |