evdev: A joystick could be ignored before opening input device 85/277685/5 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_7.0 tizen_7.0_hotfix tizen_bkup_20230126 accepted/tizen/7.0/unified/20221110.061709 accepted/tizen/7.0/unified/hotfix/20221116.110953 accepted/tizen/unified/20220721.135044 submit/tizen/20220720.055550 tizen_7.0_m2_release
authorduna.oh <duna.oh@samsung.com>
Tue, 12 Jul 2022 06:17:52 +0000 (15:17 +0900)
committerduna.oh <duna.oh@samsung.com>
Wed, 20 Jul 2022 03:52:42 +0000 (12:52 +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 0bd21ef0a78912f446d32e6889b3de19c02f2c46..84c2a6bd4284b125e9ad982868f143b47d174c9a 100644 (file)
@@ -2254,6 +2254,7 @@ libevdev_log_func(const struct libevdev *evdev,
        log_msg_va(libinput, pri, fmt, args);
 }
 
+#if 0
 static bool
 udev_device_should_be_ignored(struct udev_device *udev_device)
 {
@@ -2264,6 +2265,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,
@@ -2292,7 +2317,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);
                return NULL;
        }