Man page of MOUSE
Section: Linux Programmer's Manual (4)
Return to Main Contents
mouse - serial mouse interface
Serial mice are connected to a serial RS232/V24 dialout line, see
for a description.
The pinout of the usual 9 pin plug as used for serial mice is:
|3||TX||-12 V, Imax = 10 mA|
|4||DTR||+12 V, Imax = 10 mA|
|7||RTS||+12 V, Imax = 10 mA|
This is the specification, in fact 9 V suffices with most mice.
The mouse driver can recognize a mouse by dropping RTS to low and raising
About 14 ms later the mouse will send 0x4D ('M') on the data line.
After a further 63 ms, a Microsoft-compatible 3-button mouse will send
The relative mouse movement is sent as dx (positive means right)
and dy (positive means down).
Various mice can operate at different speeds.
To select speeds, cycle through the
speeds 9600, 4800, 2400 and 1200 bit/s, each time writing the two characters
from the table below and waiting 0.1 seconds.
The following table shows available speeds and the strings that select them:
The first byte of a data packet can be used to synchronization purposes.
The Microsoft protocol uses 1 start bit, 7 data bits, no parity
and one stop bit at the speed of 1200 bits/sec.
Data is sent to RxD in 3-byte packets.
The dx and dy movements are sent as
two's-complement, lb (rb) are set when the left (right)
button is pressed:
3-button Microsoft protocol
Original Microsoft mice only have two buttons.
However, there are some
three button mice which also use the Microsoft protocol.
releasing the middle button is reported by sending a packet with zero
movement and no buttons pressed.
(Thus, unlike for the other two buttons, the status of the middle
button is not reported in each packet.)
Logitech serial 3-button mice use a different extension of the
Microsoft protocol: when the middle button is up, the above 3-byte
packet is sent.
When the middle button is down a 4-byte packet is
sent, where the 4th byte has value 0x20 (or at least has the 0x20
In particular, a press of the middle button is reported
as 0,0,0,0x20 when no other buttons are down.
The Mousesystems protocol uses 1 start bit, 8 data bits, no parity
and two stop bits at the speed of 1200 bits/sec.
Data is sent to RxD in
dx is sent as the sum of the two two's-complement
values, dy is send as negated sum of the two two's-complement
lb (mb, rb) are cleared when the left (middle,
right) button is pressed:
Bytes 4 and 5 describe the change that occurred since bytes 2 and 3
The Sun protocol is the 3-byte version of the above 5-byte
Mousesystems protocol: the last two bytes are not sent.
The MM protocol uses 1 start bit, 8 data bits, odd parity and one
stop bit at the speed of 1200 bits/sec.
Data is sent to RxD in 3-byte
dx and dy are sent as single signed values, the
sign bit indicating a negative value.
lb (mb, rb) are
set when the left (middle, right) button is pressed:
A commonly used symlink pointing to a mouse device.
This page is part of release 3.22 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- Microsoft protocol
- 3-button Microsoft protocol
- Logitech protocol
- Mousesystems protocol
- Sun protocol
- MM protocol
- SEE ALSO
This document was created by
using the manual pages.
Time: 04:15:42 GMT, September 24, 2010