| 1 |
'\" t |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH mouse 4 2025-05-17 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
mouse \- serial mouse interface |
| 9 |
.SH CONFIGURATION |
| 10 |
Serial mice are connected to a serial RS232/V24 dialout line, see |
| 11 |
.BR ttyS (4) |
| 12 |
for a description. |
| 13 |
.SH DESCRIPTION |
| 14 |
.SS Introduction |
| 15 |
The pinout of the usual 9 pin plug as used for serial mice is: |
| 16 |
.P |
| 17 |
.TS |
| 18 |
center; |
| 19 |
r c l. |
| 20 |
pin name used for |
| 21 |
2 RX Data |
| 22 |
3 TX \-12 V, Imax = 10 mA |
| 23 |
4 DTR +12 V, Imax = 10 mA |
| 24 |
7 RTS +12 V, Imax = 10 mA |
| 25 |
5 GND Ground |
| 26 |
.TE |
| 27 |
.P |
| 28 |
This is the specification, in fact 9 V suffices with most mice. |
| 29 |
.P |
| 30 |
The mouse driver can recognize a mouse by dropping RTS to low and raising |
| 31 |
it again. |
| 32 |
About 14 ms later the mouse will send 0x4D (\[aq]M\[aq]) on the data line. |
| 33 |
After a further 63 ms, a Microsoft-compatible 3-button mouse will send |
| 34 |
0x33 (\[aq]3\[aq]). |
| 35 |
.P |
| 36 |
The relative mouse movement is sent as |
| 37 |
.I dx |
| 38 |
(positive means right) |
| 39 |
and |
| 40 |
.I dy |
| 41 |
(positive means down). |
| 42 |
Various mice can operate at different speeds. |
| 43 |
To select speeds, cycle through the |
| 44 |
speeds 9600, 4800, 2400, and 1200 bit/s, each time writing the two characters |
| 45 |
from the table below and waiting 0.1 seconds. |
| 46 |
The following table shows available speeds and the strings that select them: |
| 47 |
.P |
| 48 |
.TS |
| 49 |
center; |
| 50 |
l l. |
| 51 |
bit/s string |
| 52 |
9600 *q |
| 53 |
4800 *p |
| 54 |
2400 *o |
| 55 |
1200 *n |
| 56 |
.TE |
| 57 |
.P |
| 58 |
The first byte of a data packet can be used for synchronization purposes. |
| 59 |
.SS Microsoft protocol |
| 60 |
The |
| 61 |
.B Microsoft |
| 62 |
protocol uses 1 start bit, 7 data bits, no parity |
| 63 |
and one stop bit at the speed of 1200 bits/sec. |
| 64 |
Data is sent to RxD in 3-byte packets. |
| 65 |
The |
| 66 |
.I dx |
| 67 |
and |
| 68 |
.I dy |
| 69 |
movements are sent as |
| 70 |
two's-complement, |
| 71 |
.I lb |
| 72 |
.RI ( rb ) |
| 73 |
are set when the left (right) |
| 74 |
button is pressed: |
| 75 |
.P |
| 76 |
.TS |
| 77 |
center; |
| 78 |
r c c c c c c c. |
| 79 |
byte d6 d5 d4 d3 d2 d1 d0 |
| 80 |
1 1 lb rb dy7 dy6 dx7 dx6 |
| 81 |
2 0 dx5 dx4 dx3 dx2 dx1 dx0 |
| 82 |
3 0 dy5 dy4 dy3 dy2 dy1 dy0 |
| 83 |
.TE |
| 84 |
.SS 3-button Microsoft protocol |
| 85 |
Original Microsoft mice only have two buttons. |
| 86 |
However, there are some |
| 87 |
three button mice which also use the Microsoft protocol. |
| 88 |
Pressing or |
| 89 |
releasing the middle button is reported by sending a packet with zero |
| 90 |
movement and no buttons pressed. |
| 91 |
(Thus, unlike for the other two buttons, the status of the middle |
| 92 |
button is not reported in each packet.) |
| 93 |
.SS Logitech protocol |
| 94 |
Logitech serial 3-button mice use a different extension of the |
| 95 |
Microsoft protocol: when the middle button is up, the above 3-byte |
| 96 |
packet is sent. |
| 97 |
When the middle button is down a 4-byte packet is |
| 98 |
sent, where the 4th byte has value 0x20 (or at least has the 0x20 |
| 99 |
bit set). |
| 100 |
In particular, a press of the middle button is reported |
| 101 |
as 0,0,0,0x20 when no other buttons are down. |
| 102 |
.SS Mousesystems protocol |
| 103 |
The |
| 104 |
.B Mousesystems |
| 105 |
protocol uses 1 start bit, 8 data bits, no parity, |
| 106 |
and two stop bits at the speed of 1200 bits/sec. |
| 107 |
Data is sent to RxD in |
| 108 |
5-byte packets. |
| 109 |
.I dx |
| 110 |
is sent as the sum of the two two's-complement |
| 111 |
values, |
| 112 |
.I dy |
| 113 |
is send as negated sum of the two two's-complement |
| 114 |
values. |
| 115 |
.I lb |
| 116 |
.RI ( mb , |
| 117 |
.IR rb ) |
| 118 |
are cleared when the left (middle, |
| 119 |
right) button is pressed: |
| 120 |
.P |
| 121 |
.TS |
| 122 |
center; |
| 123 |
r c c c c c c c c. |
| 124 |
byte d7 d6 d5 d4 d3 d2 d1 d0 |
| 125 |
1 1 0 0 0 0 lb mb rb |
| 126 |
2 0 dxa6 dxa5 dxa4 dxa3 dxa2 dxa1 dxa0 |
| 127 |
3 0 dya6 dya5 dya4 dya3 dya2 dya1 dya0 |
| 128 |
4 0 dxb6 dxb5 dxb4 dxb3 dxb2 dxb1 dxb0 |
| 129 |
5 0 dyb6 dyb5 dyb4 dyb3 dyb2 dyb1 dyb0 |
| 130 |
.TE |
| 131 |
.P |
| 132 |
Bytes 4 and 5 describe the change that occurred since bytes 2 and 3 |
| 133 |
were transmitted. |
| 134 |
.SS Sun protocol |
| 135 |
The |
| 136 |
.B Sun |
| 137 |
protocol is the 3-byte version of the above 5-byte |
| 138 |
Mousesystems protocol: the last two bytes are not sent. |
| 139 |
.SS MM protocol |
| 140 |
The |
| 141 |
.B MM |
| 142 |
protocol uses 1 start bit, 8 data bits, odd parity, and one |
| 143 |
stop bit at the speed of 1200 bits/sec. |
| 144 |
Data is sent to RxD in 3-byte |
| 145 |
packets. |
| 146 |
.I dx |
| 147 |
and |
| 148 |
.I dy |
| 149 |
are sent as single signed values, the |
| 150 |
sign bit indicating a negative value. |
| 151 |
.I lb |
| 152 |
.RI ( mb , |
| 153 |
.IR rb ) |
| 154 |
are |
| 155 |
set when the left (middle, right) button is pressed: |
| 156 |
.P |
| 157 |
.TS |
| 158 |
center; |
| 159 |
r c c c c c c c c. |
| 160 |
byte d7 d6 d5 d4 d3 d2 d1 d0 |
| 161 |
1 1 0 0 dxs dys lb mb rb |
| 162 |
2 0 dx6 dx5 dx4 dx3 dx2 dx1 dx0 |
| 163 |
3 0 dy6 dy5 dy4 dy3 dy2 dy1 dy0 |
| 164 |
.TE |
| 165 |
.SH FILES |
| 166 |
.TP |
| 167 |
.I /dev/mouse |
| 168 |
A commonly used symbolic link pointing to a mouse device. |
| 169 |
.SH SEE ALSO |
| 170 |
.BR ttyS (4), |
| 171 |
.BR gpm (8) |