1 Following information obtained from Tomi Engdahl (then@delta.hut.fi), 2 http://www.hut.fi/~then/mytexts/mouse.html 3 4 Microsoft serial mouse 5 6 Serial data parameters: 7 1200bps, 7 databits, 1 stop-bit 8 9 Data packet format: 10 Data packet is 3 byte packet. It is send to the computer every time mouse 11 state changes (mouse moves or keys are pressed/released). 12 D7 D6 D5 D4 D3 D2 D1 D0 13 1. X 1 LB RB Y7 Y6 X7 X6 14 2. X 0 X5 X4 X3 X2 X1 X0 15 3. X 0 Y5 Y4 Y3 Y2 Y1 Y0 16 17 Note: The bit marked with X is 0 if the mouse received with 7 databits 18 and 2 stop bits format. It is also possible to use 8 databits and 1 stop 19 bit format for receiving. In this case X gets value 1. The safest thing 20 to get everything working is to use 7 databits and 1 stopbit when 21 receiving mouse information (and if you are making mouse then send out 22 7 databits and 2 stop bits). 23 The byte marked with 1. is send first, then the others. The bit D6 in 24 the first byte is used for synchronizing the software to mouse packets 25 if it goes out of sync. 26 27 LB is the state of the left button (1 means pressed down) 28 RB is the state of the right button (1 means pressed down) 29 X7-X0 movement in X direction since last packet (signed byte) 30 Y7-Y0 movement in Y direction since last packet (signed byte) 31 32 Mouse identification 33 When DTR line is toggled, mouse should send one data byte containing 34 letter 'M' (ascii 77). 35 36 37 Logitech serial mouse 38 39 Logitech uses the Microsoft serial mouse protocol in their mouses (for 40 example Logitech Pilot mouse and others). The original protocol supports 41 only two buttons, but logitech as added third button to some of their 42 mouse models. To make this possible logitech has made one extension to 43 the protocol. 44 I have not seen any documentation about the exact documents, but here is 45 what I have found out: The information of the third button state is sent 46 using one extra byte which is send after the normal packet when needed. 47 Value 32 (dec) is sent every time when the center button is pressed down. 48 It is also sent every time with the data packet when center button is kept 49 down and the mouse data packet is sent for other reasons. When center 50 button is released, the mouse sends the normal data packet followed by 51 data bythe which has value 0 (dec). As you can see the extra data byte 52 is sent only when you mess with the center button. 53 54 55 Mouse systems mouse 56 57 Serial data parameters: 58 1200bps, 8 databits, 1 stop-bit 59 60 Data packet format: 61 D7 D6 D5 D4 D3 D2 D1 D0 62 1. 1 0 0 0 0 LB CB RB 63 2. X7 X6 X5 X4 X3 X2 X1 X0 64 3. Y7 Y6 Y5 Y4 Y3 Y4 Y1 Y0 65 4. X7' X6' X5' X4' X3' X2' X1' X0' 66 5. Y7' Y6' Y5' Y4' Y3' Y4' Y1' Y0' 67 68 LB is left button state (0 = pressed, 1 = released) 69 CB is center button state (0 = pressed, 1 = released) 70 RB is right button state (0 = pressed, 1 = released) 71 X7-X0 movement in X direction since last packet in signed byte 72 format (-128..+127), positive direction right 73 Y7-Y0 movement in Y direction since last packet in signed byte 74 format (-128..+127), positive direction up 75 X7'-X0' movement in X direction since sending of X7-X0 packet in 76 signed byte format (-128..+127), positive direction right 77 Y7'-Y0' movement in Y direction since sending of Y7-Y0 packet in 78 signed byte format (-128..+127), positive direction up 79 80 The last two bytes in the packet (bytes 4 and 5) contains information 81 about movement data changes which have occured after data bytes 2 and 3 82 have been sent. 83