From: duna.oh Date: Tue, 12 Jul 2022 06:17:52 +0000 (+0900) Subject: evdev: A joystick could be ignored before opening input device X-Git-Tag: submit/tizen/20220720.055550^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_7.0;p=platform%2Fupstream%2Flibinput.git evdev: A joystick could be ignored before opening input device 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 --- diff --git a/src/evdev.c b/src/evdev.c index 0bd21ef0..84c2a6bd 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -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; }