From 7c0fb2e980af93923f2071e1af087010962e06bd Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Fri, 26 Aug 2011 09:24:25 +0200 Subject: Import upstream version 0.11.0~svn1158 --- plugin_i2c_sensors.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'plugin_i2c_sensors.c') diff --git a/plugin_i2c_sensors.c b/plugin_i2c_sensors.c index ce70e35..397e52c 100644 --- a/plugin_i2c_sensors.c +++ b/plugin_i2c_sensors.c @@ -1,4 +1,4 @@ -/* $Id: plugin_i2c_sensors.c 1082 2010-01-17 14:40:03Z volker $ +/* $Id: plugin_i2c_sensors.c 1150 2011-07-27 02:53:04Z michael $ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_i2c_sensors.c $ * * I2C sensors plugin @@ -223,6 +223,8 @@ static void my_i2c_sensors_path(const char *method) int done; if (!strcmp(method, "sysfs")) { + base = "/sys/class/hwmon/"; + } else if (!strcmp(method, "sysfs-old")) { base = "/sys/bus/i2c/devices/"; } else if (!strcmp(method, "procfs")) { base = "/proc/sys/dev/sensors/"; @@ -259,6 +261,16 @@ static void my_i2c_sensors_path(const char *method) done = 1; break; } + if (!strcmp(file->d_name, "device")) { + char fname[PATH_MAX]; + snprintf(fname, PATH_MAX, "%sdevice/temp1_input", dname); + if (access(fname, R_OK) == 0) { + path = realloc(path, strlen(dname) + 7); + sprintf(path, "%sdevice/", dname); + done = 1; + break; + } + } } closedir(fd2); if (done) @@ -280,6 +292,8 @@ static int configure_i2c_sensors(void) if (path_cfg == NULL || *path_cfg == '\0') { /* debug("No path to i2c sensors found in the conf, calling my_i2c_sensors_path()"); */ my_i2c_sensors_path("sysfs"); + if (!path) + my_i2c_sensors_path("sysfs-old"); if (!path) my_i2c_sensors_path("procfs"); -- cgit v1.2.3