- Make libsensors work with hwmon class entries without a device link such

as the acpi thermal_zone driver (bz 437637)
This commit is contained in:
Hans de Goede 2008-03-16 10:14:31 +00:00
parent a3cedd6b7e
commit 3a7e0ed487
3 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,31 @@
Index: lib/sysfs.c
===================================================================
--- lib/sysfs.c (revision 5142)
+++ lib/sysfs.c (working copy)
@@ -524,19 +524,19 @@
/* SPI */
entry.chip.bus.type = SENSORS_BUS_TYPE_SPI;
} else
+ if ((!subsys || !strcmp(subsys, "pci")) &&
+ sscanf(dev_name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn) == 4) {
+ /* PCI */
+ entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn;
+ entry.chip.bus.type = SENSORS_BUS_TYPE_PCI;
+ entry.chip.bus.nr = 0;
+ } else
if ((!subsys || !strcmp(subsys, "platform"))) {
/* must be new ISA (platform driver) */
if (sscanf(dev_name, "%*[a-z0-9_].%d", &entry.chip.addr) != 1)
entry.chip.addr = 0;
entry.chip.bus.type = SENSORS_BUS_TYPE_ISA;
entry.chip.bus.nr = 0;
- } else
- if ((!subsys || !strcmp(subsys, "pci")) &&
- sscanf(dev_name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn) == 4) {
- /* PCI */
- entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn;
- entry.chip.bus.type = SENSORS_BUS_TYPE_PCI;
- entry.chip.bus.nr = 0;
} else {
/* Ignore unknown device */
err = 0;

View File

@ -0,0 +1,21 @@
Index: lib/sysfs.c
===================================================================
--- lib/sysfs.c (revision 5142)
+++ lib/sysfs.c (working copy)
@@ -591,8 +591,14 @@
snprintf(linkpath, NAME_MAX, "%s/device", path);
dev_len = readlink(linkpath, device, NAME_MAX - 1);
- if (dev_len < 0)
- return -SENSORS_ERR_KERNEL;
+ if (dev_len < 0) {
+ /* virtual device without a device link (for example
+ the acpi thermalzone driver) */
+ err = sensors_read_one_sysfs_chip(path, "virtual", path);
+ if (err < 0)
+ return err;
+ return 0;
+ }
device[dev_len] = '\0';
device_p = strrchr(device, '/') + 1;

View File

@ -1,6 +1,6 @@
Name: lm_sensors
Version: 3.0.1
Release: 4%{?dist}
Release: 5%{?dist}
URL: http://www.lm-sensors.org/
Source: http://dl.lm-sensors.org/lm-sensors/releases/%{name}-%{version}.tar.bz2
Source1: lm_sensors.sysconfig
@ -10,6 +10,8 @@ Source3: sensord.init
Patch0: lm_sensors-3.0.1-service-default-off.patch
Patch1: lm_sensors-3.0.1-lsb-retcodes.patch
Patch2: lm_sensors-3.0.1-sensors-detect-special-chips.patch
Patch3: lm_sensors-3.0.1-virtual-dev.patch
Patch4: lm_sensors-3.0.1-pci-without-subsys.patch
Summary: Hardware monitoring tools
Group: Applications/System
License: GPLv2+
@ -54,6 +56,8 @@ database, and warns of sensor alarms.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p0
%patch4 -p0
mv prog/init/README prog/init/README.initscripts
chmod -x prog/init/fancontrol.init
@ -167,6 +171,10 @@ fi
%changelog
* Sun Mar 16 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.1-5
- Make libsensors work with hwmon class entries without a device link
such as the acpi thermal_zone driver (bz 437637)
* Wed Mar 12 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.1-4
- One (last) minor cosmetical fix to the initscript