]> err.no Git - systemd/commitdiff
input_id: small optimization
authorMartin Pitt <martin.pitt@ubuntu.com>
Thu, 3 Dec 2009 11:46:22 +0000 (12:46 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 3 Dec 2009 11:46:22 +0000 (12:46 +0100)
In the parent traversal loop, use
udev_device_get_parent_with_subsystem_devtype() to only grab "input" class
devices.

extras/input_id/input_id.c

index 8024524681d65619cd2aa91bf2300f4197c08402..48097aa9772eebd4d6e977e587079d479fa30b67 100644 (file)
@@ -144,7 +144,7 @@ int main (int argc, char** argv)
        /* walk up the parental chain until we find the real input device; the
         * argument is very likely a subdevice of this, like eventN */
        while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL)
-               dev = udev_device_get_parent(dev);
+               dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
 
        /* not an "input" class device */
        if (dev == NULL)