mount_setattr.2: Further tweaks after feedback from Christian Brauner
[man-pages.git] / man4 / mouse.4
blob7faa328b077b816520efff1fb72cf4510ec7ab36
1 .\" This manpage is Copyright (C) 1996 Michael Haardt.
2 .\" Updates Nov 1998, Andries Brouwer
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .TH MOUSE 4 2020-08-13 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 mouse \- serial mouse interface
28 .SH CONFIGURATION
29 Serial mice are connected to a serial RS232/V24 dialout line, see
30 .BR ttyS (4)
31 for a description.
32 .SH DESCRIPTION
33 .SS Introduction
34 The pinout of the usual 9 pin plug as used for serial mice is:
35 .PP
36 .TS
37 center;
38 r c l.
39 pin     name    used for
40 2       RX      Data
41 3       TX      \-12 V, Imax = 10 mA
42 4       DTR     +12 V, Imax = 10 mA
43 7       RTS     +12 V, Imax = 10 mA
44 5       GND     Ground
45 .TE
46 .PP
47 This is the specification, in fact 9 V suffices with most mice.
48 .PP
49 The mouse driver can recognize a mouse by dropping RTS to low and raising
50 it again.
51 About 14 ms later the mouse will send 0x4D (\(aqM\(aq) on the data line.
52 After a further 63 ms, a Microsoft-compatible 3-button mouse will send
53 0x33 (\(aq3\(aq).
54 .PP
55 The relative mouse movement is sent as
56 .I dx
57 (positive means right)
58 and
59 .I dy
60 (positive means down).
61 Various mice can operate at different speeds.
62 To select speeds, cycle through the
63 speeds 9600, 4800, 2400, and 1200 bit/s, each time writing the two characters
64 from the table below and waiting 0.1 seconds.
65 The following table shows available speeds and the strings that select them:
66 .PP
67 .TS
68 center;
69 l l.
70 bit/s   string
71 9600    *q
72 4800    *p
73 2400    *o
74 1200    *n
75 .TE
76 .PP
77 The first byte of a data packet can be used for synchronization purposes.
78 .SS Microsoft protocol
79 The
80 .B Microsoft
81 protocol uses 1 start bit, 7 data bits, no parity
82 and one stop bit at the speed of 1200 bits/sec.
83 Data is sent to RxD in 3-byte packets.
84 The
85 .IR dx
86 and
87 .I dy
88 movements are sent as
89 two's-complement,
90 .I lb
91 .RI ( rb )
92 are set when the left (right)
93 button is pressed:
94 .PP
95 .TS
96 center;
97 r c c c c c c c.
98 byte    d6      d5      d4      d3      d2      d1      d0
99 1       1       lb      rb      dy7     dy6     dx7     dx6
100 2       0       dx5     dx4     dx3     dx2     dx1     dx0
101 3       0       dy5     dy4     dy3     dy2     dy1     dy0
103 .SS 3-button Microsoft protocol
104 Original Microsoft mice only have two buttons.
105 However, there are some
106 three button mice which also use the Microsoft protocol.
107 Pressing or
108 releasing the middle button is reported by sending a packet with zero
109 movement and no buttons pressed.
110 (Thus, unlike for the other two buttons, the status of the middle
111 button is not reported in each packet.)
112 .SS Logitech protocol
113 Logitech serial 3-button mice use a different extension of the
114 Microsoft protocol: when the middle button is up, the above 3-byte
115 packet is sent.
116 When the middle button is down a 4-byte packet is
117 sent, where the 4th byte has value 0x20 (or at least has the 0x20
118 bit set).
119 In particular, a press of the middle button is reported
120 as 0,0,0,0x20 when no other buttons are down.
121 .SS Mousesystems protocol
123 .B Mousesystems
124 protocol uses 1 start bit, 8 data bits, no parity,
125 and two stop bits at the speed of 1200 bits/sec.
126 Data is sent to RxD in
127 5-byte packets.
128 .I dx
129 is sent as the sum of the two two's-complement
130 values,
131 .I dy
132 is send as negated sum of the two two's-complement
133 values.
134 .I lb
135 .RI ( mb ,
136 .IR rb )
137 are cleared when the left (middle,
138 right) button is pressed:
141 center;
142 r c c c c c c c c.
143 byte    d7      d6      d5      d4      d3      d2      d1      d0
144 1       1       0       0       0       0       lb      mb      rb
145 2       0       dxa6    dxa5    dxa4    dxa3    dxa2    dxa1    dxa0
146 3       0       dya6    dya5    dya4    dya3    dya2    dya1    dya0
147 4       0       dxb6    dxb5    dxb4    dxb3    dxb2    dxb1    dxb0
148 5       0       dyb6    dyb5    dyb4    dyb3    dyb2    dyb1    dyb0
151 Bytes 4 and 5 describe the change that occurred since bytes 2 and 3
152 were transmitted.
153 .SS Sun protocol
155 .B Sun
156 protocol is the 3-byte version of the above 5-byte
157 Mousesystems protocol: the last two bytes are not sent.
158 .SS MM protocol
160 .B MM
161 protocol uses 1 start bit, 8 data bits, odd parity, and one
162 stop bit at the speed of 1200 bits/sec.
163 Data is sent to RxD in 3-byte
164 packets.
165 .I dx
167 .I dy
168 are sent as single signed values, the
169 sign bit indicating a negative value.
170 .I lb
171 .RI ( mb ,
172 .IR rb )
174 set when the left (middle, right) button is pressed:
177 center;
178 r c c c c c c c c.
179 byte    d7      d6      d5      d4      d3      d2      d1      d0
180 1       1       0       0       dxs     dys     lb      mb      rb
181 2       0       dx6     dx5     dx4     dx3     dx2     dx1     dx0
182 3       0       dy6     dy5     dy4     dy3     dy2     dy1     dy0
184 .SH FILES
186 .I /dev/mouse
187 A commonly used symbolic link pointing to a mouse device.
188 .SH SEE ALSO
189 .BR ttyS (4),
190 .BR gpm (8)