diff --git a/legacy/eeze/src/lib/udev/eeze_udev_find.c b/legacy/eeze/src/lib/udev/eeze_udev_find.c index 1d100a69f0..d239170022 100644 --- a/legacy/eeze/src/lib/udev/eeze_udev_find.c +++ b/legacy/eeze/src/lib/udev/eeze_udev_find.c @@ -244,13 +244,24 @@ eeze_udev_find_by_type(const Eeze_Udev_Type etype, const char *name) device = udev_device_new_from_syspath(udev, devname); if (etype == EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR) - { - parent = udev_device_get_parent(device);/*check for right subsystem*/ - if ((!(test = udev_device_get_subsystem(parent))) || (strcmp("platform", test)) || - /*check for a temp reading*/ - (!(test = udev_device_get_sysattr_value(parent, "temp1_input")))) + {/* ensure that temp input exists somewhere in this device chain */ + if (!_walk_parents_for_attr(device, "temp1_input", NULL)) goto out; - devname = udev_device_get_syspath(parent); + /* if device is not the one which has the temp input, we must go up the chain */ + if (!(test = udev_device_get_sysattr_value(device, "temp1_input"))) + { + devname = NULL; + for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent))/*check for parent*/ + if (((test = udev_device_get_sysattr_value(parent, "temp1_input")))) + { + devname = udev_device_get_syspath(parent); + break; + } + + if (!devname) + goto out; + } + } if (name) if (!strstr(devname, name)) diff --git a/legacy/eeze/src/lib/udev/eeze_udev_watch.c b/legacy/eeze/src/lib/udev/eeze_udev_watch.c index 89083b2f57..06be96b51b 100644 --- a/legacy/eeze/src/lib/udev/eeze_udev_watch.c +++ b/legacy/eeze/src/lib/udev/eeze_udev_watch.c @@ -142,11 +142,22 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler *fd_handler) 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 (!(parent = (udev_device_get_parent(device))) || - (!(test = (udev_device_get_subsystem(parent)))) || - (strcmp("platform", test))) - goto error; - if (!(test = udev_device_get_action(device)) || (!(ret = udev_device_get_syspath(parent)))) + if (!_walk_parents_for_attr(device, "temp1_input", NULL)) + goto error; + /* if device is not the one which has the temp input, we must go up the chain */ + if (!(test = udev_device_get_sysattr_value(device, "temp1_input"))) + { + tmpdev = NULL; + for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent))/*check for parent*/ + if (((test = udev_device_get_sysattr_value(parent, "temp1_input")))) + { + tmpdev = parent; + break; + } + } + else + tmpdev = device; + if ((!tmpdev) || !(test = udev_device_get_action(device)) || (!(ret = udev_device_get_syspath(tmpdev)))) goto error; (*func)(eina_stringshare_add(ret), test, sdata, watch);