Here is a description of the intellimouse protocol that I wrote up a while ago. An excellent page for mouse protocols can be found here also.
If you want info about imps2, here is what I have. It is straight out of the XFree sources, I have used it many times and it seems reliable :
To initialize a mouse in imps2 mode, you send it 243, 200, 243, 100, 243, 80. Before that you have to initialize it as a PS2 mouse, though.
The packet format is 4 bytes :
Byte 0:
Bit | Contents |
0 | Left button |
1 | Right button |
2 | Middle button |
3 | Nothing? always 1 |
4 | X bit 8 |
5 | Y bit 8 |
6 | Button 4 (untested) other sources say X overflow |
7 | Button 5 (untested) other sources say Y overflow |
Note that GPM currently expects buttons 4 and 5 to be unpressed or it will discard the packet. I have never personally seen a mouse that has these buttons.
Byte 1:
X bits 7 to 0 X is calculated by :
if (byte[0] & 0x10) byte[1] else byte[1] - 256;
Byte 2:
Y bits 7 to 0
Y is given by if (byte[0] & 0x20) -byte[2] else 256 - byte[2];
Byte 3:
Z Axis (the roller).
Indicates how much the roller has moved. I have never seen values other than -1 and +1 on a standard intellimouse. On my trust intellimouse with two rollers, I seem to remember that the second roller sends -2 and +2 in this field.