From 3a7e0ed4875e56ace84cd353d6451dc1cd5677eb Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 16 Mar 2008 10:14:31 +0000 Subject: [PATCH] - Make libsensors work with hwmon class entries without a device link such as the acpi thermal_zone driver (bz 437637) --- lm_sensors-3.0.1-pci-without-subsys.patch | 31 +++++++++++++++++++++++ lm_sensors-3.0.1-virtual-dev.patch | 21 +++++++++++++++ lm_sensors.spec | 10 +++++++- 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 lm_sensors-3.0.1-pci-without-subsys.patch create mode 100644 lm_sensors-3.0.1-virtual-dev.patch diff --git a/lm_sensors-3.0.1-pci-without-subsys.patch b/lm_sensors-3.0.1-pci-without-subsys.patch new file mode 100644 index 0000000..d2d8a5c --- /dev/null +++ b/lm_sensors-3.0.1-pci-without-subsys.patch @@ -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; diff --git a/lm_sensors-3.0.1-virtual-dev.patch b/lm_sensors-3.0.1-virtual-dev.patch new file mode 100644 index 0000000..85eb98c --- /dev/null +++ b/lm_sensors-3.0.1-virtual-dev.patch @@ -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; + diff --git a/lm_sensors.spec b/lm_sensors.spec index 1e5c912..f16e526 100644 --- a/lm_sensors.spec +++ b/lm_sensors.spec @@ -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 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 3.0.1-4 - One (last) minor cosmetical fix to the initscript