From a31bba2e452d179d70c043d0bfe22ae7f9f582cc Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 16 Feb 2026 14:33:30 +0100 Subject: [PATCH] Fix temperature gathering --- cmdline/support.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmdline/support.c b/cmdline/support.c index 725803cb..e68ec70e 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -1912,13 +1912,15 @@ int smartctl_flush(FILE* f, const char* file, const char* name) int smart_temp(devinfo_t* devinfo) { - uint64_t t = devinfo->smart[SMART_TEMPERATURE_CELSIUS].raw & 0xFFFF; + uint64_t t = devinfo->smart[SMART_TEMPERATURE_CELSIUS].raw; if (t == SMART_UNASSIGNED) - t = devinfo->smart[SMART_AIRFLOW_TEMPERATURE_CELSIUS].raw & 0xFFFF; - - /* validate temperature */ + t = devinfo->smart[SMART_AIRFLOW_TEMPERATURE_CELSIUS].raw; if (t == SMART_UNASSIGNED) return -1; + + /* mask out min/max values */ + t &= 0xFFFFUL; + if (t == 0) return -1; if (t > 100)