I intent to fix this bug by an NMU if it is not done in the next 7
days. Please fine below the patch I am planning to use.

diff -u wmtemp-0.0.6/debian/changelog wmtemp-0.0.6/debian/changelog
--- wmtemp-0.0.6/debian/changelog
+++ wmtemp-0.0.6/debian/changelog
@@ -1,3 +1,11 @@
+wmtemp (0.0.6-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Switch to libsensors4 api, thanks to Hugo Vanwoerkom for the patch.
+    (Closes: #610816).
+
+ -- Aurelien Jarno <[email protected]>  Sat, 12 Mar 2011 22:13:32 +0100
+
 wmtemp (0.0.6-3) unstable; urgency=low
 
   * Fix "backlight color change incomplete" changing the xpm files
diff -u wmtemp-0.0.6/debian/control wmtemp-0.0.6/debian/control
--- wmtemp-0.0.6/debian/control
+++ wmtemp-0.0.6/debian/control
@@ -2,7 +2,7 @@
 Section: x11
 Priority: extra
 Maintainer: Riccardo Stagni <[email protected]>
-Build-Depends: debhelper (>= 7.0.50~), libsensors-dev (>= 2.8.4), libxpm-dev, 
libxext-dev, x11proto-xext-dev, libx11-dev
+Build-Depends: debhelper (>= 7.0.50~), libsensors4-dev (>= 3.1.2), libxpm-dev, 
libxext-dev, x11proto-xext-dev, libx11-dev
 Standards-Version: 3.8.3
 Homepage: http://gnodde.org/wmtemp/
 
only in patch2:
unchanged:
--- wmtemp-0.0.6.orig/main.c
+++ wmtemp-0.0.6/main.c
@@ -419,9 +419,9 @@
    printf("  -c <path>                      location of the sensors.conf 
file\n");
    printf("                                 ('/etc/sensors.conf' is 
default)\n");
    printf("  -cf <feature>                  which feature to use for cpu 
temperature\n");
-   printf("                                 ('temp1' is default)\n");
+   printf("                                 ('temp1_input' is default)\n");
    printf("  -sf <feature>                  which feature to use for sys 
temperature\n");
-   printf("                                 ('temp2' is default)\n");
+   printf("                                 ('temp2_input' is default)\n");
    printf("  -s                             swap the cpu and sys 
temperatures\n");
    printf("                                 (/etc/sensors.conf is default)\n");
    printf("  -f                             show temperatures in 
Fahrenheit\n");
only in patch2:
unchanged:
--- wmtemp-0.0.6.orig/temp.c
+++ wmtemp-0.0.6/temp.c
@@ -1,3 +1,4 @@
+#define        DEBUG(x) x                 
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -10,10 +11,10 @@
 static char sensors = 0;
 
 static const sensors_chip_name *chip_name = NULL;
-static const sensors_feature_data *feature;
+static const sensors_feature *feature;
 
-char *cpu_feature_name = "temp1";
-char *sys_feature_name = "temp2";
+char *cpu_feature_name = "temp1_input";
+char *sys_feature_name = "temp2_input";
 
 temperature_t t_type = CELCIUS;
 
@@ -33,7 +34,13 @@
 void temp_init(const char *filename) {
        const sensors_chip_name *name;
        int chip_nr = 0, f1, f2;
-       
+
+       char str[256];
+       int len;
+
+       char *feattext = NULL;
+       const sensors_subfeature *subfeature;
+
        atexit(temp_deinit);
 
        f = fopen(filename, "r");
@@ -49,21 +56,29 @@
        }
 
        sensors = 1;
-
-       while ((name = sensors_get_detected_chips(&chip_nr)) != NULL &&
+       while ((name = sensors_get_detected_chips(NULL, &chip_nr)) != NULL &&
                        chip_name == NULL) {
                f1 = f2 = 0;
+               DEBUG(printf("chip_nr=%d %d\n",chip_nr,__LINE__);)
+
+               len = sensors_snprintf_chip_name(str, 256, name);
+               DEBUG(printf("chip name = %s (%d)\n",str,__LINE__);)
+
+               while ((feature = sensors_get_features( name, &f1)) != NULL) {
 
-               while ((feature = sensors_get_all_features(*name, &f1, &f2)) != 
NULL) {
-                       if (sensors_get_ignored(*name, feature->number) != 0) {
-                               if (strcmp(feature->name, cpu_feature_name) == 
0) {
-                                       cpu_feature = feature->number;
-                                       chip_name = name;
-                               } else if (strcmp(feature->name, 
sys_feature_name) == 0) {
-                                       sys_feature = feature->number;
-                                       chip_name = name;
-                               }
+                   feattext = sensors_get_label( name, feature );
+                   DEBUG(printf("f1=%d feattext=%s (%d) 
\n",f1,feattext,__LINE__);)
+  
+                   if ( (subfeature = sensors_get_subfeature (name, feature, 
SENSORS_SUBFEATURE_TEMP_INPUT)) ) {
+                       DEBUG(printf("subfeature name =%s (%d) 
\n",subfeature->name,__LINE__);)
+                       if (strcmp(subfeature->name, cpu_feature_name) == 0) {
+                           cpu_feature = subfeature->number;
+                           chip_name = name;
+                       } 
+                       else if (strcmp(subfeature->name, sys_feature_name) == 
0) {
+                           sys_feature = subfeature->number;
                        }
+                   }
                }
        }
 
@@ -76,8 +91,8 @@
 void temp_getusage(unsigned int *cpu_temp, unsigned int *sys_temp) {
        double cpu, sys;
 
-       sensors_get_feature(*chip_name, cpu_feature, &cpu);
-       sensors_get_feature(*chip_name, sys_feature, &sys);
+       sensors_get_value(chip_name, cpu_feature, &cpu);
+       sensors_get_value(chip_name, sys_feature, &sys);
 
        if (t_type == FAHRENHEIT) {
                cpu = TO_FAHRENHEIT(cpu);



-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to