diff options
author | Mihail Konev <k.mvc@ya.ru> | 2016-10-15 17:59:05 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-10-15 13:39:26 -0700 |
commit | 5dcb0666b82f5ab00f3d22e86f05ac14b0d5341e (patch) | |
tree | ba2af9d3b1ef2a6fa7640a480dac1386359a947e /os | |
parent | 9cf0bd4d4507dca6234024605b14724713f2109e (diff) |
os/inputthread: Ensure pollfd refreshing
When putting a device node into a poll-request list, do not overwrite a
"please-remove" element with the same fd, so that a closed device file
is ospoll_remove'd prior to being ospoll_add'ed.
Before, the opposite order was possible, resulting in ospoll_add
considering the newly opened file being already polled, should it have a
fd for which the "please-remove" has not been procesed yet. In this
case, no further events would be seen from the device.
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
Regressed-in: 52d6a1e832a5e62289dd4f32824ae16a78dfd7e8
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97880
Patchwork: https://patchwork.freedesktop.org/patch/113763/
Hit-and-Reduced-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-and-Reduced-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/inputthread.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/os/inputthread.c b/os/inputthread.c index 6aa0a9ce6..ddafa7fe8 100644 --- a/os/inputthread.c +++ b/os/inputthread.c @@ -197,7 +197,7 @@ InputThreadRegisterDev(int fd, dev = NULL; xorg_list_for_each_entry(old, &inputThreadInfo->devs, node) { - if (old->fd == fd) { + if (old->fd == fd && old->state != device_state_removed) { dev = old; break; } @@ -218,6 +218,9 @@ InputThreadRegisterDev(int fd, dev->readInputProc = readInputProc; dev->readInputArgs = readInputArgs; dev->state = device_state_added; + + /* Do not prepend, so that any dev->state == device_state_removed + * with the same dev->fd get processed first. */ xorg_list_append(&dev->node, &inputThreadInfo->devs); } |