From e580c44cbb8af882596d8c45c3859cfb8df99dab Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 6 Sep 2011 19:09:36 +0000 Subject: [PATCH] fix temp sensor detection with very new kernels SVN revision: 63229 --- legacy/eeze/src/lib/eeze_udev_find.c | 13 +++++++++---- legacy/eeze/src/lib/eeze_udev_watch.c | 16 +++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/legacy/eeze/src/lib/eeze_udev_find.c b/legacy/eeze/src/lib/eeze_udev_find.c index ec5194ada0..2835d759fc 100644 --- a/legacy/eeze/src/lib/eeze_udev_find.c +++ b/legacy/eeze/src/lib/eeze_udev_find.c @@ -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; diff --git a/legacy/eeze/src/lib/eeze_udev_watch.c b/legacy/eeze/src/lib/eeze_udev_watch.c index ab3a57c224..7697427bf6 100644 --- a/legacy/eeze/src/lib/eeze_udev_watch.c +++ b/legacy/eeze/src/lib/eeze_udev_watch.c @@ -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")))