Skip to content
Snippets Groups Projects
Commit 71191a88 authored by Nandor Han's avatar Nandor Han Committed by Peter Hutterer
Browse files

udev: validate input devices during cold-plug


During libinput initialization a list of existing input devices is
retrieved from udev. This can lead to a situation where libinput can
end up processing un-configured devices because of the race generated
by udev events and libinput startup.
Sequence example:
weston - start
udev - device 1 added
weston - get a list of input devices
weston - process device 1 -- undefined behavior
udev - device 1 added - finalized

The problem was found because of incorrect touchscreen association
when in a dual monitor system the secondary touchscreen was
incorrectly associated with output one since udev didn't finish the
device initialization and WL_OUTPUT was missing.

To avoid this situation we skip un-configured devices during libinput
initialization, relying on udev to send events when devices are
fully configured.

Note: due to the peculiarities of udev_device_get_is_initialized(), the
input device is still processed if the call fails. If there are no udev
rules defined for the device, it will never be reported as initialized,
but this is not a problem, because all input devices handled by libinput
must have some udev properties set, therefore they always have rules.

Signed-off-by: default avatarNandor Han <nandor.han@ge.com>
[Pekka: change log to debug, unref device]
Signed-off-by: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 23d543b7)
parent f2cfd8a6
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment