[SF#727]Fix incorrect temperature sensors detection.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 1 May 2015 23:26:00 +0000 (02:26 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 1 May 2015 23:26:00 +0000 (02:26 +0300)
It hasn't really downed to /sys/class/hwmon/hwmonX if the directory
/sys/class/hwmon/hwmonX/device existed but no sensors found in it.

ChangeLog
plugins/thermal/thermal.c

index 07d3390..86aad7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
     which was not intended really.
 * Corrected background for 'indicator' plugin.
 * Fixed update 'indicator' plugin on configuration changes.
+* Fixed battery status: if discharge rate is 0 then it's charged.
+* Fixed incorrect cycle in netproc_devicelist_clear() leading to crash on
+    resume (after suspend).
+* Fixed scanning for temperature sensors which failed with some kernels.
 
 0.8.0
 -------------------------------------------------------------------------
index 839bf04..27204fb 100644 (file)
@@ -356,9 +356,10 @@ static gboolean try_hwmon_sensors(thermal* th, const char *path)
     const char *sensor_name;
     char sensor_path[100], buf[256];
     FILE *fp;
+    gboolean found = FALSE;
 
     if (!(sensorsDirectory = g_dir_open(path, 0, NULL)))
-        return FALSE;
+        return found;
 
     while ((sensor_name = g_dir_read_name(sensorsDirectory)))
     {
@@ -382,10 +383,11 @@ static gboolean try_hwmon_sensors(thermal* th, const char *path)
             snprintf(sensor_path, sizeof(sensor_path), "%s/%s", path, sensor_name);
             add_sensor(th, sensor_path, buf[0] ? buf : sensor_name,
                        hwmon_get_temperature, hwmon_get_critical);
+            found = TRUE;
         }
     }
     g_dir_close(sensorsDirectory);
-    return TRUE;
+    return found;
 }
 
 static void find_hwmon_sensors(thermal* th)
@@ -399,6 +401,7 @@ static void find_hwmon_sensors(thermal* th)
         snprintf(dir_path, sizeof(dir_path), "/sys/class/hwmon/hwmon%d/device", i);
         if (try_hwmon_sensors(th, dir_path))
             continue;
+        /* no sensors found under device/, try parent dir */
         c = strrchr(dir_path, '/');
         *c = '\0';
         try_hwmon_sensors(th, dir_path);