rpms/lm_sensors/devel lm_sensors-3.0.1-virtual-dev.patch,1.1,1.2
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Tue Mar 18 10:04:46 UTC 2008
Author: jwrdegoede
Update of /cvs/extras/rpms/lm_sensors/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27638
Modified Files:
lm_sensors-3.0.1-virtual-dev.patch
Log Message:
* Sun Mar 16 2008 Hans de Goede <j.w.r.degoede at 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)
lm_sensors-3.0.1-virtual-dev.patch:
Index: lm_sensors-3.0.1-virtual-dev.patch
===================================================================
RCS file: /cvs/extras/rpms/lm_sensors/devel/lm_sensors-3.0.1-virtual-dev.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lm_sensors-3.0.1-virtual-dev.patch 16 Mar 2008 10:14:31 -0000 1.1
+++ lm_sensors-3.0.1-virtual-dev.patch 18 Mar 2008 10:04:36 -0000 1.2
@@ -1,21 +1,114 @@
+Index: lib/sensors.h
+===================================================================
+--- lib/sensors.h (revision 5145)
++++ lib/sensors.h (working copy)
+@@ -30,7 +30,7 @@
+ when the API + ABI breaks), the third digit is incremented to track small
+ API additions like new flags / enum values. The second digit is for tracking
+ larger additions like new methods. */
+-#define SENSORS_API_VERSION 0x400
++#define SENSORS_API_VERSION 0x401
+
+ #define SENSORS_CHIP_NAME_PREFIX_ANY NULL
+ #define SENSORS_CHIP_NAME_ADDR_ANY -1
+@@ -40,6 +40,7 @@
+ #define SENSORS_BUS_TYPE_ISA 1
+ #define SENSORS_BUS_TYPE_PCI 2
+ #define SENSORS_BUS_TYPE_SPI 3
++#define SENSORS_BUS_TYPE_VIRT 4
+ #define SENSORS_BUS_NR_ANY (-1)
+ #define SENSORS_BUS_NR_IGNORE (-2)
+
+Index: lib/access.c
+===================================================================
+--- lib/access.c (revision 5145)
++++ lib/access.c (working copy)
+@@ -344,6 +344,8 @@
+ so we don't have any custom string to return. */
+ case SENSORS_BUS_TYPE_SPI:
+ return "SPI adapter";
++ case SENSORS_BUS_TYPE_VIRT:
++ return "Virtual device";
+ }
+
+ /* bus types with several instances */
Index: lib/sysfs.c
===================================================================
---- lib/sysfs.c (revision 5142)
+--- lib/sysfs.c (revision 5145)
+++ lib/sysfs.c (working copy)
-@@ -591,8 +591,14 @@
+@@ -475,6 +475,14 @@
+ if (!entry.chip.path)
+ sensors_fatal_error(__func__, "Out of memory");
+
++ if (dev_path == NULL) {
++ /* Virtual device */
++ entry.chip.addr = 0;
++ entry.chip.bus.type = SENSORS_BUS_TYPE_VIRT;
++ entry.chip.bus.nr = 0;
++ goto done;
++ }
++
+ /* Find bus type */
+ snprintf(linkpath, NAME_MAX, "%s/subsystem", dev_path);
+ sub_len = readlink(linkpath, subsys_path, NAME_MAX - 1);
+@@ -543,6 +551,7 @@
+ goto exit_free;
+ }
+
++done:
+ if (sensors_read_dynamic_chip(&entry, hwmon_path) < 0)
+ goto exit_free;
+ if (!entry.subfeature) { /* No subfeature, discard chip */
+@@ -591,16 +600,20 @@
snprintf(linkpath, NAME_MAX, "%s/device", path);
dev_len = readlink(linkpath, device, NAME_MAX - 1);
- if (dev_len < 0)
- return -SENSORS_ERR_KERNEL;
+- device[dev_len] = '\0';
+- device_p = strrchr(device, '/') + 1;
+ 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;
++ /* No device link? Treat as virtual */
++ err = sensors_read_one_sysfs_chip(NULL, NULL, path);
++ } else {
++ device[dev_len] = '\0';
++ device_p = strrchr(device, '/') + 1;
+
+- /* The attributes we want might be those of the hwmon class device,
+- or those of the device itself. */
+- err = sensors_read_one_sysfs_chip(linkpath, device_p, path);
+- if (err == 0)
+- err = sensors_read_one_sysfs_chip(linkpath, device_p, linkpath);
++ /* The attributes we want might be those of the hwmon class
++ device, or those of the device itself. */
++ err = sensors_read_one_sysfs_chip(linkpath, device_p, path);
++ if (err == 0)
++ err = sensors_read_one_sysfs_chip(linkpath, device_p,
++ linkpath);
+ }
- device[dev_len] = '\0';
- device_p = strrchr(device, '/') + 1;
+ if (err < 0)
+ return err;
+ return 0;
+Index: lib/data.c
+===================================================================
+--- lib/data.c (revision 5145)
++++ lib/data.c (working copy)
+@@ -108,6 +108,8 @@
+ res->bus.type = SENSORS_BUS_TYPE_PCI;
+ else if (!strncmp(name, "spi", dash - name))
+ res->bus.type = SENSORS_BUS_TYPE_SPI;
++ else if (!strncmp(name, "virtual", dash - name))
++ res->bus.type = SENSORS_BUS_TYPE_VIRT;
+ else
+ goto ERROR;
+ name = dash + 1;
+@@ -168,6 +170,9 @@
+ case SENSORS_BUS_TYPE_SPI:
+ return snprintf(str, size, "%s-spi-%hd-%x", chip->prefix,
+ chip->bus.nr, chip->addr);
++ case SENSORS_BUS_TYPE_VIRT:
++ return snprintf(str, size, "%s-virtual-%x", chip->prefix,
++ chip->addr);
+ }
+ return -SENSORS_ERR_CHIP_NAME;
More information about the fedora-extras-commits
mailing list