Quick Stats
Release Date July 11, 2006
License MIT / X11

When configuring the X.org server, the preferred way to access all the buttons on a USB mouse is to use the evdev driver on a /dev/input/event* device. The preferred way to be able to unplug and replug mouses is to use the mouse driver on the /dev/input/mice device. Linux helpfully multiplexes all mouse communication into that one device for you, but it's not an event device. If you don't use this, the specific mouse or event device you were using will "disappear" when it's unplugged.

This patch is not technically perfect (I have a limited understanding of the X server), but it will now attempt to reopen an event device after it's been unplugged. Unfortunately, because the X server won't try to read from any devices until there is data on one of them, you have to move another device before it can reconnect. Tapping a key on the keyboard will work, and it's much faster than restarting the X server or switching to a virtual terminal and then switching back.

You will need to patch both the evdev driver and the X server to use this feature. The X server had to be made more permissive about calling the unplugged event read function, or it would never get the chance to reconnect.

Note: You probably shouldn't use this yet. If any other input comes in while an evdev mouse is unplugged, the X server will freeze up until it gets replugged.

Note: This is no longer necessary in X11R7.1, since evdev inputs can glob based on the device name after a replug.


The latest version was released on July 11, 2006.

Post a Comment