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.
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?
Evdev input hot-plugging support in kdrive/Xephyr was introduced in commit 0cf3d72be6bd99cd2c66b7885339322c7e5bf73d.