1MOUSE(4) Linux Programmer's Manual MOUSE(4)
2
3
4
6 mouse - serial mouse interface
7
9 Serial mice are connected to a serial RS232/V24 dialout line, see
10 ttyS(4) for a description.
11
13 Introduction
14 The pinout of the usual 9 pin plug as used for serial mice is:
15
16
17 pin name used for
18 2 RX Data
19 3 TX -12 V, Imax = 10 mA
20 4 DTR +12 V, Imax = 10 mA
21 7 RTS +12 V, Imax = 10 mA
22 5 GND Ground
23
24 This is the specification, in fact 9 V suffices with most mice.
25
26 The mouse driver can recognize a mouse by dropping RTS to low and rais‐
27 ing it again. About 14 ms later the mouse will send 0x4D ('M') on the
28 data line. After a further 63 ms, a Microsoft-compatible 3-button
29 mouse will send 0x33 ('3').
30
31 The relative mouse movement is sent as dx (positive means right) and dy
32 (positive means down). Various mice can operate at different speeds.
33 To select speeds, cycle through the speeds 9600, 4800, 2400 and 1200
34 bit/s, each time writing the two characters from the table below and
35 waiting 0.1 seconds. The following table shows available speeds and
36 the strings that select them:
37
38
39 bit/s string
40 9600 *q
41 4800 *p
42 2400 *o
43 1200 *n
44
45 The first byte of a data packet can be used to synchronisation pur‐
46 poses.
47
48 Microsoft protocol
49 The Microsoft protocol uses 1 start bit, 7 data bits, no parity and one
50 stop bit at the speed of 1200 bits/sec. Data is sent to RxD in 3-byte
51 packets. The dx and dy movements are sent as two's-complement, lb (rb)
52 are set when the left (right) button is pressed:
53
54
55 byte d6 d5 d4 d3 d2 d1 d0
56 1 1 lb rb dy7 dy6 dx7 dx6
57 2 0 dx5 dx4 dx3 dx2 dx1 dx0
58 3 0 dy5 dy4 dy3 dy2 dy1 dy0
59
60 3-button Microsoft protocol
61 Original Microsoft mice only have two buttons. However, there are some
62 three button mice which also use the Microsoft protocol. Pressing or
63 releasing the middle button is reported by sending a packet with zero
64 movement and no buttons pressed. (Thus, unlike for the other two but‐
65 tons, the status of the middle button is not reported in each packet.)
66
67 Logitech protocol
68 Logitech serial 3-button mice use a different extension of the Micro‐
69 soft protocol: when the middle button is up, the above 3-byte packet is
70 sent. When the middle button is down a 4-byte packet is sent, where the
71 4th byte has value 0x20 (or at least has the 0x20 bit set). In particu‐
72 lar, a press of the middle button is reported as 0,0,0,0x20 when no
73 other buttons are down.
74
75 Mousesystems protocol
76 The Mousesystems protocol uses 1 start bit, 8 data bits, no parity and
77 two stop bits at the speed of 1200 bits/sec. Data is sent to RxD in
78 5-byte packets. dx is sent as the sum of the two two's-complement val‐
79 ues, dy is send as negated sum of the two two's-complement values. lb
80 (mb, rb) are cleared when the left (middle, right) button is pressed:
81
82
83 byte d7 d6 d5 d4 d3 d2 d1 d0
84 1 1 0 0 0 0 lb mb rb
85 2 0 dxa6 dxa5 dxa4 dxa3 dxa2 dxa1 dxa0
86 3 0 dya6 dya5 dya4 dya3 dya2 dya1 dya0
87 4 0 dxb6 dxb5 dxb4 dxb3 dxb2 dxb1 dxb0
88 5 0 dyb6 dyb5 dyb4 dyb3 dyb2 dyb1 dyb0
89
90 Bytes 4 and 5 describe the change that occurred since bytes 2 and 3
91 were transmitted.
92
93 Sun protocol
94 The Sun protocol is the 3-byte version of the above 5-byte Mousesystems
95 protocol: the last two bytes are not sent.
96
97 MM protocol
98 The MM protocol uses 1 start bit, 8 data bits, odd parity and one stop
99 bit at the speed of 1200 bits/sec. Data is sent to RxD in 3-byte pack‐
100 ets. dx and dy are sent as single signed values, the sign bit indicat‐
101 ing a negative value. lb (mb, rb) are set when the left (middle,
102 right) button is pressed:
103
104
105 byte d7 d6 d5 d4 d3 d2 d1 d0
106 1 1 0 0 dxs dys lb mb rb
107 2 0 dx6 dx5 dx4 dx3 dx2 dx1 dx0
108 3 0 dy6 dy5 dy4 dy3 dy2 dy1 dy0
109
110
112 /dev/mouse
113 A commonly used symlink pointing to a mouse device.
114
115
117 ttyS(4), gpm(8)
118
119
120
121Special files 1996-02-10 MOUSE(4)