chiark / gitweb /
input_id: Do not tag non-input devices with ID_INPUT
[elogind.git] / extras / input_id / input_id.c
index 3754cdefee2faf6bbeaae2597c2d1b834fa6c0e8..8024524681d65619cd2aa91bf2300f4197c08402 100644 (file)
@@ -143,9 +143,13 @@ 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 (udev_device_get_sysattr_value(dev, "capabilities/key") == NULL)
+       while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL)
                dev = udev_device_get_parent(dev);
 
+       /* not an "input" class device */
+       if (dev == NULL)
+               return 0;
+
        /* Use this as a flag that input devices were detected, so that this
         * program doesn't need to be called more than once per device */
        puts("ID_INPUT=1");