Hot swapping USB mouse in X window system

From: Brandon Stewart
Date: Sun Aug 17 2003 - 11:40:12 EST


My ohci adapter doesn't work on 2.4, so I can't tell if this is the 2.6 kernel, devfsd, or configuration related. There are two facts that make hot swapping a USB mouse in X windows fail:

1) If a mouse is not detected at the start of X windows, that mouse will not be checked for during the operation of X windows.
2) If a mouse is detected at the start of X windows, then the device corresponding to that mouse cannot be released until X windows is stopped.

So when I start X windows without the mouse plugged in, and then try to plug the mouse in, X windows will not even look at it, because it threw away it's InputDevice section at startup. I can verify that it is recognized by Linux proper because a /dev/input/mouse1 device will be created and catting this device while moving the mouse will result in junk on the screen.

But when I start X windows with the mouse, unplug it, and replug it in, I get a different problem. What happens is that upon unplugging the mouse, the /dev/input/mouse1 device will stay there, whereas unplugging it outside of X windows results in its disappearance. So X windows is still listening for input from /dev/input/mouse1. But when I replug in the USB mouse, it doesn't attach to /dev/input/mouse1. Rather, it creates a new device called /dev/input/mouse2. And X windows is not looking at this.

I tried creating a third InputDevice section for X windows that points to mouse2, but it discards the configuration at startup, and so won't use it when it is plugged in.

I'd appreciate hearing from anyone who has experienced similar, or knows if there is a way to work around this.

-Brandon

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/