Re: gkrellm vs asus mobo's

Stefan Gehn <[email protected]> Tue, 20 Jul 2010 10:41:09 +0200
Newsgroups gmane.comp.gnome.apps.gkrellm
Message-ID <[email protected]>
Heya,

On 05/14/2010 05:36 AM, Gene Heskett wrote:
>
> I am hoping that at some point, the sensors in gkrellm can make use of the
> regular kernels choice of sensor monitors such as the asus_atk0110 sensor
> reader.

Found the reason for this, the directory-layout for hwmon-sensors has 
changed. Some drivers now put their sensor-files below 
/sys/class/hwmon/hwmonX/ instead of /sys/class/hwmon/hwmonX/device/. The 
atk0110-driver is one of them.

Attached patch fixes the problem on my Asus P5B by also looking into the 
hwmon-dir if nothing was found in the device-dir.

Bye,
Stefan Gehn
gkrellm-linux-hwmon.patch (text/x-diff, 742 B)
Index: linux.c
===================================================================
--- linux.c	(revision 102)
+++ linux.c	(working copy)
@@ -3403,7 +3403,18 @@
 		if ((chip_name = sysfs_get_chip_name(path)) == NULL)
 			{
 			g_dir_close(chip_dir);
-			continue;
+			if (using_i2c_dir)
+				continue;
+			/* Newer hwmon drivers keep their files directly in the hwmon dir
+			   and not in the device-subdir. */
+			snprintf(path, sizeof(path), "%s/%s", SYSFS_HWMON_DIR, bus_name);
+			if ((chip_dir = g_dir_open(path, 0, NULL)) == NULL)
+				continue;
+			if ((chip_name = sysfs_get_chip_name(path)) == NULL)
+				{
+				g_dir_close(chip_dir);
+				continue;
+				}
 			}
 		have_sysfs_sensors = TRUE;
 		if (_GK.debug_level & DEBUG_SENSORS)