The Jumping Mouse Saga

If you're using a KVM switch -- a device that lets you use a single Keyboard, Video device (monitor), and Mouse with multiple computers -- then you may run into the "jumping mouse" problem when switching to your Linux systems.  This is where the mouse erratically skips all over your screen and acts like you're pressing all its buttons 50 times simultaneously, when you've only barely moved it an inch.  When the mouse gets its panties in a bunch like this, you'll want (need) to reset it, because it's unusable in this state, and it's wreaking havoc on all your open windows.  So here's how I reset the mouse.  Different techniques have worked on different kernels over the years, so this is presented as a sort of timeline.



Current:

2.6.10:

Same as for "late 2.6.9 - early 2.6.10" except you echo to "drvctl" instead of "driver":

/bin/echo -n reconnect > /sys/bus/serio/devices/serioX/drvctl



late 2.6.9 - early 2.6.10:

Inspect /sys/bus/serio/devices/serioX/driver, where X is 0, 1, etc, by either ls -al or by cat-ing it.  You'll see that one of them is for the keyboard and the other is for the mouse.  Whichever one is the mouse, run this on it (as root, or with sudo):

/bin/echo -n reconnect > /sys/bus/serio/devices/serioX/driver

You'll probably want to put that into a script like /usr/local/bin/resetmouse, and then assign a keybinding like Ctrl-Alt-R to launch it (using your window-manager's built-in keybinding facility, or a program like xbindkeys).

Note: you can also reset the mouse by unplugging it from the KVM and then re-plugging it.



2.6 kernels before 2.6.9:

These were the dark ages.  As far as I could determine, you could only reset the mouse by unplugging it from the KVM and then re-plugging it.  The switch-out-of-X trick doesn't seem to work anymore.  (Note that this may have applied to some late 2.4 kernels too.)



most 2.4 kernels that I used:

By switching out of X and then back into it (Ctrl-Alt-F1 then Ctrl-Alt-F7) you can reset the mouse.

You may also be able to get the mouse to reset by sending some funky characters to your mouse device.  This is pretty ugly but here's how I did it.

Note: you can also reset the mouse by unplugging it from the KVM and then re-plugging it.