evdev: A joystick could be ignored before opening input device
authorduna.oh <duna.oh@samsung.com>
Tue, 12 Jul 2022 06:17:52 +0000 (15:17 +0900)
committerduna.oh <duna.oh@samsung.com>
Fri, 27 Jan 2023 05:46:47 +0000 (14:46 +0900)
add checking if the builtin property 'ID_INPUT_JOYSTICK' is set.
Because 'LIBINPUT_IGNORE_DEVICE' is usually set by udev rule,
it may not be determined until the udev rule is parsed.

A joystick is not supported in libinput for now.

Change-Id: I19cc67538dd1ccc6f1c6f2a2dccbb96d344d40ac

src/evdev.c

index 32602ff..5e8f000 100644 (file)
@@ -2434,6 +2434,7 @@ libevdev_log_func(const struct libevdev *evdev,
 #pragma GCC diagnostic pop
 }
 
+#if 0
 static bool
 udev_device_should_be_ignored(struct udev_device *udev_device)
 {
@@ -2444,6 +2445,30 @@ udev_device_should_be_ignored(struct udev_device *udev_device)
 
        return value && !streq(value, "0");
 }
+#else // for TIZEN
+static bool
+udev_device_should_be_ignored(struct udev_device *udev_device)
+{
+       const char *value;
+       char *env;
+
+       value = udev_device_get_property_value(udev_device,
+                                              "LIBINPUT_IGNORE_DEVICE");
+
+       if (value && !streq(value, "0")) return true;
+
+       // for TIZEN, add checking if joystick should be ignored or not.
+       env = getenv("LIBINPUT_IGNORE_JOYSTICK");
+       if (env && atoi(env) == 1) {
+               value = udev_device_get_property_value(udev_device,
+                                                      "ID_INPUT_JOYSTICK");
+       }
+
+       if (value && !streq(value, "0")) return true;
+
+       return false;
+}
+#endif
 
 struct evdev_device *
 evdev_device_create(struct libinput_seat *seat,
@@ -2472,7 +2497,7 @@ evdev_device_create(struct libinput_seat *seat,
        }
 
        if (udev_device_should_be_ignored(udev_device)) {
-               log_debug(libinput, "%s: device is ignored\n", sysname);
+               log_info(libinput, "%s: device is ignored\n", sysname);
                goto err;
        }