Virtual Mouse Driver for 2.2 kernel

What is Virtual Mouse Driver

Virtual Mouse Driver is a linux LKM I wrote which allows you to create a "fake" mouse device, controlled from the keyboard. It's useful if you want to run X-Windows without a mouse.

To use it you will need to modify some files in the kernel and recompile it. I made all tests with a 2.2.16 kernel, on an i386 platform. If you manage to make it work on a different platform please let me know that!

How does it works

Basically, the code has two layers: the kernel code and the LKM code.
The kernel code is simply a function called by the keyboard interrupt handler, which updates an exported variable.
The LKM code creates a device and make it act like a mouse, using the exported variable to read the state (pressed or not) of the needed keys.

I binded the keypad keys to this virtual mouse, with "0" and "." (on the keypad) as the mouse buttons. Those keys will work regularly unless pressed in conjuction with the MS Windows "popup menu" key (I'll use it for something now :-)).
Anyway it's not hard to change the keys if you want or need to, you just need to know the right scancodes.

How to install it

First, you need to download the needed files. You will find them here.
When you'll decompress the archive you will find that it's divided in two main directories. The kernel directory contains the kernel files added or modified, and a README. The module directory contains the LKM source.

Almost all the files in the kernel directory have changed very little (few lines) from the original 2.2.16 version. Anyway make a backup copy of your kernel files (specially if you are using a different version of the kernel).
The only files added are virt_mouse.c and virt_mouse.h. When you have substituted all the files recompile and install the new kernel (keep a copy of your old one to restart if something goes wrong!). For instruction on how to compile the kernel take a look at the documentation of the kernel, just remember to answer "yes" to "Virtual Mouse Support" in the Char Devices section during configuration.
Restart your computer with the new kernel.

If everything went well, you will be at the login prompt, and apparently nothing has changed. Now go to the module subdirectory, and do a make to get virt_mouse_m.o.
Now do an "insmod virt_mouse_m.o" (you'll have to be root to do that). You shoud read "Registered virtual_mouse successfully with major 240".
Now go to /dev and create a character device with major number 240 (mknod vmouse c 240).

The last thing you need to do is to instruct X Windows to search the mouse in /dev/vmouse. I tried this in XF86Config and it worked:
Section "Pointer"
Protocol "Microsoft"
Device "/dev/vmouse"
BaudRate 1200
Emulate3Timeout 50
Resolution 100
Buttons 2
Now, the only thing left is to start X Windows and test if everything works.