diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2011-07-27 02:19:58 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2011-07-27 02:19:58 +0000 |
commit | f86dd50a614e0666e2c61331bee684d1a519562b (patch) | |
tree | 569db2035f6c66881e82b161ddce484276c17164 | |
parent | 1d611354c3a8bf7de4c487fe4af7f72778035477 (diff) | |
download | lcd4linux-f86dd50a614e0666e2c61331bee684d1a519562b.tar.gz |
hwmon patch from Hans de Goede
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1146 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r-- | plugin_i2c_sensors.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugin_i2c_sensors.c b/plugin_i2c_sensors.c index 989f97c..8ac9534 100644 --- a/plugin_i2c_sensors.c +++ b/plugin_i2c_sensors.c @@ -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) @@ -281,6 +293,8 @@ static int configure_i2c_sensors(void) /* 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"); if (!path) { |