The Jumping Mouse Problem
Note: this is how I previously worked-around the jumping-mouse problem. It's still here for historical purposes, but you probably want the current info instead.
If your mouse starts freaking out for no reason ... Or, if you're using a KVM switch (a device that lets you use the same keyboard, mouse, and monitor with multiple computers) with Linux, and the mouse freaks out when you switch to the Linux box, here's a workaround. When you switch to the Linux box, press Ctrl+Alt+F1 to switch out of the Xserver, then press Ctrl+Alt+F7 to switch back. This should reset the mouse. (Note: When I run mouseconfig (or setup) and choose "generic 3-button mouse", I don't have this problem... but I also can't use my scroll wheel. To use the scroll wheel, I choose MS Intellimouse, and then I DO have the problem of the jumping mouse. If I choose Logitech MouseMan/FirstMouse PS/2, I don't have the jumping mouse problem, but I still have to switch out and back in to make the wheel work. The mouse that I'm actually using is a Microsoft Wheel Mouse Optical USB.)
Here's a better solution that allows you to just press Ctrl+Alt+SomeKey one time, and it will run a program that resets the mouse:
First I ran "cat /dev/mouse" and then proceeded to switch consoles. When I came back
to the X-Server, the cat command showed fourteen ú characters (that's an accented u)
had been sent to the mouse. Then I ran a Perl script to watch /dev/mouse and display the data it sees, and this
showed two ÿ characters (that's a y with 2 dots on top) after I switched consoles.
(Note - on my RedHat 7.3 / KDE system, I run kcharselect to get these characters for copying.)
So, I wrote a Perl script that would write those chars to /dev/mouse, and it turns out
that they successfully reset the mouse. The u method sometimes pops up a right-click menu,
or does other weird stuff, so I'm currently using the y method. UPDATE Dec/2002: a visitor sent me
a C program that does the same thing as my Perl script, thus eliminating the need to use
Perl at all here. The solution below now reflects this.
Of course, my goal was to make this easier than switching consoles, so I wanted a quick
keyboard shortcut for this. Below are instructions on how to do this using KDE, and using
Enlightenment. I've been using this for a while
now, and after using the switch-console workaround for about a year, let me tell you,
this new method is sooo much nicer.
So: become root, then create a file called /home/username/zfixmouse.c, and type this into it:
#include <stdio.h> #define MOUSE "/dev/mouse" main () { FILE *ofp; ofp = fopen(MOUSE, "w"); fprintf(ofp, "ÿÿ"); /* Nathan G. Grennan has reported that ÿÿ doesn't work for him, but */ /* õóÈódóPòô does, and you might need a half-second of delay after */ /* the first character õ, and also before the last character ô. */ /* These are the hex codes for those characters: */ /* F5 F3 C8 F3 64 F3 50 F2 F4 */ fclose(ofp); }
Compile that with gcc -o
/home/username/zfixmouse /home/username/zfixmouse.c. After it compiles,
run chmod a+s /home/username/zfixmouse to suid the program, so that
a non-root user can run it.
Finally I created a keyboard shortcut, Ctrl+Alt+Z,
to the program. I've done this under KDE and enlightenment. If you're using
KDE, just run kmenuedit to create a new kmenu item for the program, and to assign a
keyboard shortcut to it. If you're using enlightenment, edit the file
/home/username/.enlightenment/keybindings.cfg (copy it there from
/usr/share/enlightenment/config/ if necessary). Look for a section
in that file that looks like this:
__ACLASS __BGN __NAME KEYBINDINGS __TYPE __TYPE_GLOBAL ... __NEXT_ACTION __KEY m __EVENT __KEY_PRESS __MODIFIER_KEY __CTRL_ALT __ACTION __A_EXEC mozilla
Now just copy the 5 lines from __NEXT_ACTION down to the __ACTION __A_EXEC <appname>, and paste it to create a new entry with /home/username/zfixmouse as the appname (in place of mozilla above), and the key of your choice. Restart enlightenment for the keybinding to take effect.