Bug 33140 - evdev USB input devices which get briefly disconnected become unusable in kdrive/Xephyr
Summary: evdev USB input devices which get briefly disconnected become unusable in kdr...
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/DDX/Xephyr (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: Matthew Allum
QA Contact: Xorg Project Team
Depends on:
Reported: 2011-01-14 20:54 UTC by Andrew Miller
Modified: 2016-03-01 16:23 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Patch (as described in comment 0), against xorg-server-1.9.3 (6.00 KB, patch)
2011-01-14 20:54 UTC, Andrew Miller
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Miller 2011-01-14 20:54:59 UTC
Created attachment 42068 [details] [review]
Patch (as described in comment 0), against xorg-server-1.9.3

kdrive / Xephyr adds all the evdev devices to the server at the beginning. If a device disappears, the kernel returns ENODEV, and the evdev driver removes the device permanently.

Brief disappearances are quite common for USB devices - I have a problem where devices on a particular USB hub will disappear for less than a second and reappear once every few hours. People also sometimes unplug USB devices to re-route the cable. In both cases, it would be good if the originally configured device would come back up when it is reconnected.

The solution is fairly simple: rather than deleting devices which fail, set their evdev fd to -1, and deregister and close the original fd. Periodically check all devices with -1 fds to see if they can be re-opened, and if this succeeds, start processing events from the device again.

I've made a simple patch which achieves this; I've tested the patch to confirm that unplugging USB devices and then plugging them back in means the devices are usable again.
Comment 1 Peter Hutterer 2011-01-18 18:38:29 UTC
wouldn't it be better to add hotplugging support to Xephyr instead of adding essentially the same thing with a hack like the timer function?
Comment 2 Laércio de Sousa 2016-03-01 16:23:13 UTC
Evdev input hot-plugging support in kdrive/Xephyr was introduced in commit 0cf3d72be6bd99cd2c66b7885339322c7e5bf73d.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.