fix temp sensor detection with very new kernels
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 6 Sep 2011 19:09:36 +0000 (19:09 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 6 Sep 2011 19:09:36 +0000 (19:09 +0000)
SVN revision: 63229

legacy/eeze/src/lib/eeze_udev_find.c
legacy/eeze/src/lib/eeze_udev_watch.c

index ec5194ada0011c68b2f17075b69517ee4072eb70..2835d759fc191b008a68cf701c9a83de38f0d0b7 100644 (file)
@@ -250,16 +250,21 @@ eeze_udev_find_by_type(Eeze_Udev_Type etype,
 
         if (etype == EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR) /* ensure that temp input exists somewhere in this device chain */
           {
-             if (!_walk_parents_test_attr(device, "temp1_input", NULL))
-               goto out;
+             Eina_Bool one, two;
+             const char *t;
 
+             one = _walk_parents_test_attr(device, "temp1_input", NULL);
+             two = _walk_parents_test_attr(device, "temp2_input", NULL);
+             if ((!one) && (!two)) goto out;
+
+             t = one ? "temp1_input" : "temp2_input";
              /* if device is not the one which has the temp input, we must go up the chain */
-             if (!udev_device_get_sysattr_value(device, "temp1_input"))
+             if (!udev_device_get_sysattr_value(device, t))
                {
                   devname = NULL;
 
                   for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent)) /*check for parent */
-                    if ((udev_device_get_sysattr_value(parent, "temp1_input")))
+                    if ((udev_device_get_sysattr_value(parent, t)))
                       {
                          devname = udev_device_get_syspath(parent);
                          break;
index ab3a57c22410bd480f42c7801ec3ecd9261c9671..7697427bf6066c445822752b2fb93cc4599dfbe6 100644 (file)
@@ -239,19 +239,25 @@ _get_syspath_from_watch(void             *data,
         break;
 
       case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR:
+      {
+        Eina_Bool one, two;
+        const char *t;
+
 #ifdef OLD_UDEV_RRRRRRRRRRRRRR
         if ((!(test = udev_device_get_subsystem(device)))
             || (strcmp(test, "hwmon")))
           goto error;
 #endif /* have to do stuff up here since we need info from the parent */
-        if (!_walk_parents_test_attr(device, "temp1_input", NULL))
-          goto error;
+        one = _walk_parents_test_attr(device, "temp1_input", NULL);
+        two = _walk_parents_test_attr(device, "temp2_input", NULL);
+        if ((!one) && (!two)) goto error;
 
+        t = one ? "temp1_input" : "temp2_input";
         /* if device is not the one which has the temp input, we must go up the chain */
-        if (!udev_device_get_sysattr_value(device, "temp1_input"))
+        if (!udev_device_get_sysattr_value(device, t))
           {
              for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent)) /*check for parent */
-               if (udev_device_get_sysattr_value(parent, "temp1_input"))
+               if (udev_device_get_sysattr_value(parent, t))
                  {
                     tmpdev = device;
 
@@ -264,7 +270,7 @@ _get_syspath_from_watch(void             *data,
           }
 
         break;
-
+      }
       case EEZE_UDEV_TYPE_V4L:
         if ((!(test = udev_device_get_subsystem(device)))
             || (strcmp(test, "video4linux")))