Specifications.
[pintos-anon] / specs / kbd / scancodes-12.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5  <TITLE>Keyboard scancodes: The PS/2 Mouse</TITLE>
6  <LINK HREF="scancodes-13.html" REL=next>
7  <LINK HREF="scancodes-11.html" REL=previous>
8  <LINK HREF="scancodes.html#toc12" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="scancodes-13.html">Next</A>
12 <A HREF="scancodes-11.html">Previous</A>
13 <A HREF="scancodes.html#toc12">Contents</A>
14 <HR>
15 <H2><A NAME="s12">12. The PS/2 Mouse</A></H2>
16
17 <P>
18 <P>Mice come in various flavours - serial mice, PS/2 mice, busmice, USB mice.
19 Below a little about mice using the PS/2 protocol, since these also use
20 the keyboard controller.
21 <P>A mouse has a number of buttons (1-5 is common) and must report
22 button presses. It has some way of detecting motion, and must report
23 the amount of movement in the X and Y direction, usually as differences
24 with the previously reported position, in a (dx,dy) pair.
25 Touchpads can also report absolute position.
26 <P>Reports come in the form of mouse packets of between 1 and 8 bytes.
27 Various protocols are in use.
28 <P>
29 <H2><A NAME="mousemodes"></A> <A NAME="ss12.1">12.1 Modes</A>
30 </H2>
31
32 <P>A PS/2 mouse can be in <I>stream mode</I> (the default).
33 In this mode it produces a stream of packets indicating mouse movements
34 and button presses. Or it can be in <I>remote mode</I>.
35 In this mode the mouse only sends a packet when the host
36 requests one, using the <B>
37 <A HREF="#mceb">eb</A></B> command.
38 Finally, it can be in <I>echo</I> ("wrap") <I>mode</I>,
39 in which everything the host sends is echoed back, until
40 either a reset (<B>ff</B>) or clear echo mode (<B>ec</B>)
41 is received.
42 <P>
43 <H2><A NAME="ss12.2">12.2 Scaling</A>
44 </H2>
45
46 <P>Scaling can be set to 1:1 or 2:1. This affects stream mode only.
47 In 2:1 scaling: If the unscaled absolute value of dx or dy is 6 or more,
48 it is doubled. Otherwise, for the unscaled value 0,1,2,3,4,5,6, the
49 scaled value 0,1,1,3,6,9,12 is sent.
50 <P>
51 <H2><A NAME="ss12.3">12.3 PS/2 mouse protocol</A>
52 </H2>
53
54 <P>
55 <H3>The default protocol</H3>
56
57 <P>The standard PS/2 protocol uses 3-byte packets, as follows:
58 <P>
59 <CENTER><TABLE BORDER><TR><TD>
60 Yovfl </TD><TD> Xovfl </TD><TD> dy8 </TD><TD> dx8 </TD><TD> 1 </TD><TD> Middle Btn </TD><TD> Right Btn </TD><TD> Left Btn </TD></TR><TR><TD>
61 dx7 </TD><TD> dx6 </TD><TD> dx5 </TD><TD> dx4 </TD><TD> dx3 </TD><TD> dx2 </TD><TD> dx1 </TD><TD> dx0 </TD></TR><TR><TD>
62 dy7 </TD><TD> dy6 </TD><TD> dy5 </TD><TD> dy4 </TD><TD> dy3 </TD><TD> dy2 </TD><TD> dy1 </TD><TD> dy0 </TD></TR><TR><TD>
63
64 </TD></TR></TABLE></CENTER>
65 <P>It gives the movement in the X and Y direction in 9-bit two's complement
66 notation (range -256 to +255) and an overflow indicator.
67 It also gives the status of the three mouse buttons.
68 When this protocol is used, the <B>f2</B> Read mouse ID command
69 is answered by <B>00</B>.
70 <P>
71 <H3>Intellimouse</H3>
72
73 <P>The Microsoft Intellimouse uses the above protocol until scrolling wheel
74 mode is activated by sending the magic sequence
75 <B>f3</B> <B>c8</B> <B>f3</B> <B>64</B> <B>f3</B> <B>50</B>
76 (set sample rate 200, 100, 80). In this mode, the Read mouse ID command
77 returns <B>03</B>, and 4-byte packets are used:
78 <P>
79 <CENTER><TABLE BORDER><TR><TD>
80 Yovfl </TD><TD> Xovfl </TD><TD> dy8 </TD><TD> dx8 </TD><TD> 1 </TD><TD> Middle Btn </TD><TD> Right Btn </TD><TD> Left Btn </TD></TR><TR><TD>
81 dx7 </TD><TD> dx6 </TD><TD> dx5 </TD><TD> dx4 </TD><TD> dx3 </TD><TD> dx2 </TD><TD> dx1 </TD><TD> dx0 </TD></TR><TR><TD>
82 dy7 </TD><TD> dy6 </TD><TD> dy5 </TD><TD> dy4 </TD><TD> dy3 </TD><TD> dy2 </TD><TD> dy1 </TD><TD> dy0 </TD></TR><TR><TD>
83 dz3 </TD><TD> dz3 </TD><TD> dz3 </TD><TD> dz3 </TD><TD> dz3 </TD><TD> dz2 </TD><TD> dz1 </TD><TD> dz0 </TD></TR><TR><TD>
84
85 </TD></TR></TABLE></CENTER>
86 <P>Here the last byte gives the movement of the scrolling wheel in
87 4-bit two's complement notation (range -8 to +7) and the leading
88 four bits are just copies of the sign bit.
89 <P>
90 <H3>Intellimouse Explorer mouse</H3>
91
92 <P>The Explorer mouse protocol allows for scrolling wheel and five buttons.
93 It is activated by first sending the magic sequence for Intellimouse,
94 and then, when the Intellimouse ID has been seen, sending the magic sequence
95 <B>f3</B> <B>c8</B> <B>f3</B> <B>c8</B> <B>f3</B> <B>50</B>
96 (set sample rate 200, 200, 80). In this mode, the Read mouse ID command
97 returns <B>04</B>, and 4-byte packets are used:
98 <P>
99 <CENTER><TABLE BORDER><TR><TD>
100 Yovfl </TD><TD> Xovfl </TD><TD> dy8 </TD><TD> dx8 </TD><TD> 1 </TD><TD> Middle Btn </TD><TD> Right Btn </TD><TD> Left Btn </TD></TR><TR><TD>
101 dx7 </TD><TD> dx6 </TD><TD> dx5 </TD><TD> dx4 </TD><TD> dx3 </TD><TD> dx2 </TD><TD> dx1 </TD><TD> dx0 </TD></TR><TR><TD>
102 dy7 </TD><TD> dy6 </TD><TD> dy5 </TD><TD> dy4 </TD><TD> dy3 </TD><TD> dy2 </TD><TD> dy1 </TD><TD> dy0 </TD></TR><TR><TD>
103 0 </TD><TD> 0 </TD><TD> 5th Btn </TD><TD> 4th Btn </TD><TD> dz3 </TD><TD> dz2 </TD><TD> dz1 </TD><TD> dz0 </TD></TR><TR><TD>
104
105 </TD></TR></TABLE></CENTER>
106 <P>Lots of other protocols occur, and only incomplete data is known
107 about most of them. Some examples.
108 <P>
109 <H3>Typhoon mouse</H3>
110
111 <P>The Typhoon optical mouse is reported to send 6-byte packets.
112 Bytes 1-3 are as for the default PS/2 protocol.
113 Byte 4 equals byte 1. Byte 5 gives the Z axis movement, one of
114 <B>ff</B>, <B>00</B>, <B>01</B>. Byte 6 is 0.
115 Of course the idea is that this packet looks like two ordinary packets
116 and ordinary PS/2 mouse drivers will handle it.
117 The 6-byte mode is activated by sending the magic sequence
118 <B>f3</B> <B>c8</B> <B>f3</B> <B>64</B> <B>f3</B> <B>50</B>
119 <B>f3</B> <B>3c</B> <B>f3</B> <B>28</B> <B>f3</B> <B>14</B>
120 (set sample rate 200, 100, 80, 60, 40, 20).
121 It is recognized by the ID <B>08</B>.
122 <P>
123 <H2><A NAME="ss12.4">12.4 Mouse Commands</A>
124 </H2>
125
126 <P>Every command or data byte sent to the mouse (except for the
127 resend command <B>fe</B>) is ACKed with <B>fa</B>.
128 If the command or data is invalid, it is NACKed with <B>fe</B>.
129 If the next byte is again invalid, the reply is ERROR: <B>fc</B>.
130 <P>
131 <P><I>Command <B>d0</B>: Read extended ID</I>
132 <P>Read up to 256 bytes.
133 <P><I>Commands <B>d1</B>-<B>df</B>: Vendor unique commands</I>
134 <P>
135 <P><I>Command <B>d1</B>: Logitech PS/2++ command</I>
136 <P>This command was to be used, followed by an arbitrary data sequence.
137 Now replaced by the 
138 <A HREF="#sliced">sliced commands</A> using
139 <B>e8</B>.
140 <P><I>Command <B>e1</B>: Read secondary ID</I>
141 <P>
142 <BLOCKQUOTE>
143 Replies with two bytes.
144 An IBM TrackPoint returns <B>01</B> as first byte,
145 and a second byte depending on the model.
146 </BLOCKQUOTE>
147 <P><I>Command <B>e2</B>: IBM TrackPoint command</I>
148 <P>
149 <BLOCKQUOTE>
150 Followed by several parameter bytes. For details, see
151 <A HREF="http://trackpoint.almaden.ibm.com/files/ykt3dext.pdf">ykt3dext.pdf</A>.
152 </BLOCKQUOTE>
153 <P><I>Command <B>e6</B>: 
154 <A NAME="mce6"></A> Set mouse scaling to 1:1</I>
155 <P>
156 <BLOCKQUOTE>
157 Often ingredient in magic sequences.
158 </BLOCKQUOTE>
159 <P><I>Command <B>e7</B>: 
160 <A NAME="mce7"></A> Set mouse scaling to 2:1</I>
161 <P>
162 <BLOCKQUOTE>
163 Often ingredient in magic sequences.
164 </BLOCKQUOTE>
165 <P><I>Command <B>e8</B>: 
166 <A NAME="mce8"></A> Set mouse resolution</I>
167 <P>
168 <BLOCKQUOTE>
169 This command is followed by a byte indicating the resolution
170 (0, 1, 2, 3: 1, 2, 4, 8 units per mm, respectively).
171 It is used in magic sequences to transport two bits,
172 so that four of these are needed to send a byte to the mouse.
173 See 
174 <A HREF="#sliced">below</A>.
175 </BLOCKQUOTE>
176 <P><I>Command <B>e9</B>: 
177 <A NAME="mce9"></A> Status request</I>
178 <P>
179 <BLOCKQUOTE>
180 This command returns three bytes:
181 <P>First a status byte:
182 Bit 7: unused, 0.
183 Bit 6: 0: 
184 <A HREF="#mousemodes">stream mode</A>,
185 1: 
186 <A HREF="#mousemodes">remote mode</A>.
187 Bit 5: 0: disabled, 1: enabled.
188 Bit 4: 0: scaling set to 1:1, 1: scaling set to 2:1.
189 Bit 3: unused, 0.
190 Bit 2: 1: left button pressed.
191 Bit 1: 1: middle button pressed. 
192 Bit 0: 1: right button pressed.
193 <P>Then a resolution byte:
194 0, 1, 2, 3: 1, 2, 4, 8 units per mm, respectively.
195 <P>Finally a sample rate (in Hz).
196 <P>See below for special 
197 <A HREF="#synaptics">Synaptics Touchpad</A> handling.
198 </BLOCKQUOTE>
199 <P><I>Command <B>ea</B>: Set 
200 <A HREF="#mousemodes">stream mode</A></I>
201 <P>
202 <P><I>Command <B>eb</B>: 
203 <A NAME="mceb"></A> Read data</I>
204 <P>
205 <BLOCKQUOTE>
206 Read a mouse packet.
207 Needed in 
208 <A HREF="#mousemodes">remote mode</A> to ask the mouse for data.
209 Also functions in 
210 <A HREF="#mousemodes">stream mode</A>.
211 </BLOCKQUOTE>
212 <P><I>Command <B>ec</B>: Clear 
213 <A HREF="#mousemodes">echo mode</A></I>
214 <P>
215 <P><I>Command <B>ee</B>: Set 
216 <A HREF="#mousemodes">echo mode</A></I>
217 <P>
218 <P><I>Command <B>f0</B>: Set 
219 <A HREF="#mousemodes">remote mode</A></I>
220 <P>
221 <P><I>Command <B>f2</B>: 
222 <A NAME="mcf2"></A> Read mouse ID</I>
223 <P>
224 <BLOCKQUOTE>
225 (Only supported on some systems.)
226 This command reads a 1-byte mouse ID. The reply is a single byte <B>00</B>.
227 Wait at least 10ms after issuing this command.
228 <P>For the keyboard reply, see 
229 <A HREF="scancodes-11.html#kcf2">above</A>.
230 <P>BallPoint (trackball) devices return a single byte <B>02</B>,
231 Intellimouse returns <B>03</B>,
232 Explorer Mouse returns <B>04</B>,
233 4d Mouse returns <B>06</B>,
234 4dplus Mouse returns <B>08</B>,as does the Typhoon mouse.
235 </BLOCKQUOTE>
236 <P><I>Command <B>f3</B>: 
237 <A NAME="mcf3"></A> Set mouse sample rate</I>
238 <P>
239 <BLOCKQUOTE>
240 (Only supported on some systems.)
241 Set mouse sample rate in Hz.
242 If the given sampling rate is acceptable the ACK is <B>fa</B>.
243 Otherwise the NACK is <B>fe</B>, and the host can correct.
244 If it is incorrect again <B>fc</B> is sent.
245 Correct values are, e.g., 10, 20, 40, 60, 80, 100, 200.
246 </BLOCKQUOTE>
247 <P><I>Command <B>f4</B>: 
248 <A NAME="mcf4"></A> Mouse enable</I>
249 <P>
250 <BLOCKQUOTE>
251 The stream mode mouse data reporting is disabled after a reset and after
252 the 
253 <A HREF="#mcf5">disable</A> command. This command enables it again.
254 </BLOCKQUOTE>
255 <P><I>Command <B>f5</B>: 
256 <A NAME="mcf5"></A> Mouse disable</I>
257 <P>
258 <BLOCKQUOTE>
259 This stops mouse data reporting in 
260 <A HREF="#mousemodes">stream mode</A>.
261 In stream mode, this command should be sent before sending any other commands.
262 </BLOCKQUOTE>
263 <P><I>Command <B>f6</B>: 
264 <A NAME="mcf6"></A> Set defaults</I>
265 <P>
266 <BLOCKQUOTE>
267 If this command is recognized, a reset is done (set sampling rate 100 Hz,
268 resolution 4 counts/mm, 
269 <A HREF="#mousemodes">stream mode</A>,
270 disabled, scaling 1:1), but no diagnostics are performed.
271 For some enhanced mice that require a magic sequence to get into
272 enhanced mode, this command will reset them to default PS/2 mode.
273 </BLOCKQUOTE>
274 <P><I>Command <B>fe</B>: Resend</I>
275 <P>
276 <BLOCKQUOTE>
277 If this command is recognized, the last mouse packet (possibly several bytes)
278 is resent. There is no ACK to this command, but if the last reply was ACK,
279 it is sent.
280 </BLOCKQUOTE>
281 <P><I>Command <B>ff</B>: 
282 <A NAME="mcff"></A> Mouse reset</I>
283 <P>
284 <BLOCKQUOTE>
285 A self-test is performed. When OK, the response is <B>aa</B> <B>00</B>.
286 On error, the response is <B>fc</B> <B>00</B>.
287 The mouse is reset to default PS/2 mode.
288 </BLOCKQUOTE>
289 <P>
290 <H2><A NAME="sliced"></A> <A NAME="ss12.5">12.5 Sliced parameters</A>
291 </H2>
292
293 <P>For more advanced mouse modes it is necessary to send data to the mouse.
294 There is now a commonly accepted way.
295 <P>First Logitech tried to use the <B>d1</B> command followed by an
296 arbitrary data sequence.
297 While the IBM specs reserve <B>d1</B>-<B>df</B> for vendor unique commands,
298 it turns out that not all BIOSes will transmit such codes.
299 So Logitech drops the <B>d1</B> and uses the sequence
300 <B>e8</B> <I>aa</I> <B>e8</B> <I>bb</I> <B>e8</B> <I>cc</I>
301 <B>e8</B> <I>dd</I> to transmit the byte <I>aabbccdd</I>, where
302 <I>aa</I>, <I>bb</I>, <I>cc</I>, <I>dd</I> are 2-bit quantities.
303 In this way an arbitrarily long sequence of bytes can be transmitted.
304 <P>For synchronization purposes it is possible to separate such groups
305 of four <B>e8</B> commands by an <B>e6</B> command.
306 Indeed, such separation may be required: Synaptics Touchpads react to
307 <B>e9</B> or <B>f3</B> commands preceded by precisely four
308 <B>e8</B> commands.
309 <P>
310 <H3>Magic knock</H3>
311
312 <P>For example, the "magic knock" <B>d1</B> <B>39</B> <B>db</B>
313 that sets a device that understands it in PS/2++ mode,
314 becomes <B>e8</B> <B>00</B> <B>e8</B> <B>03</B>
315 <B>e8</B> <B>02</B> <B>e8</B> <B>01</B> <B>e6</B>
316 <B>e8</B> <B>03</B> <B>e8</B> <B>01</B>
317 <B>e8</B> <B>02</B> <B>e8</B> <B>03</B>,
318 abbreviated {E8}0321 {E6} {E8}3123.
319 Note that 0321 and 3123 do not have repeated symbols. If they had,
320 too intelligent intermediate hardware transmitting these sequences
321 might see a superfluous command and suppress it.
322 <P>
323 <H3>Magic unknock</H3>
324
325 <P>PS/2++ mode is cleared again by the "magic unknock"
326 {E8} 0323 or D1 3B from an external device, and
327 {E8} 0321 or D1 39 from an internal device.
328 (These commands differ so that in setups where the same commands are
329 sent to internal and external devices, they can be commanded separately.)
330 <P>For a decription of the PS/2++ format, see
331 <A HREF="http://www.dqcs.com/logitech/ps2ppspec.htm">ps2ppspec.htm</A>.
332 <P>
333 <H2><A NAME="synaptics"></A> <A NAME="ss12.6">12.6 Synaptics Touchpad</A>
334 </H2>
335
336 <P>A few sketchy details. For nice precise information, get
337 the 
338 <A HREF="http://www.synaptics.com/decaf/utilities/ACF126.pdf">Synaptics interfacing guide</A>.
339 <P>
340 <H3>Status request</H3>
341
342 <P>When preceded by an 8-bit request number encoded via four
343 <B>
344 <A HREF="#mce8">e8</A></B>
345 commands, the <B>
346 <A HREF="#mce9">e9</A></B> status request
347 returns modified output, somewhat dependent on the Touchpad model.
348 <P>
349 <P><I>Request <B>00</B>: Identify Touchpad</I>
350 <P>This request returns three bytes, of which the middle one
351 is the constant <B>47</B>. This is the way to recognize
352 a Touchpad. The low order four bits of the third word contain
353 the major model version number, the first word contains the
354 minor version number, and the high order four bits of the
355 third word contain the (obsolete) model code.
356 <P>
357 <P><I>Request <B>01</B>: Read Touchpad Modes</I>
358 <P>This request returns three bytes, of which the first two
359 are the constants <B>3b</B> and <B>47</B>.
360 The last byte is the mode byte
361 <P>
362 <CENTER><TABLE BORDER><TR><TD>
363 ABS </TD><TD> Rate </TD><TD> - </TD><TD> - </TD><TD> Baud/Sleep </TD><TD> DisGest </TD><TD> PackSize </TD><TD> Wmode </TD></TR><TR><TD>
364
365 </TD></TR></TABLE></CENTER>
366 <P>Here ABS indicates <I>absolute mode</I> (instead of the default
367 relative mode).
368 <P>Rate is 0 for 40 packets/sec, 1 for 80 packets/sec.
369 The PS/2 sampling rate value is ignored.
370 <P>Baud/Sleep indicates the baud rate when used with a serial protocol
371 (0: 1200 baud, 1: 9600 baud). It must be set whenever ABS or Rate is set.
372 When used with the PS/2 protocol this bit indicates <I>sleep mode</I> -
373 a low power mode in which finger activity is ignored and only button
374 presses are reported.
375 <P>DisGest is the "disable gestures" bit. When set, we have classical
376 mouse behaviour. When cleared, "tap" and "drag" processing is enabled.
377 <P>PackSize is used for the serial protocol only (and then chooses between
378 6-, 7- and 8-byte packets, also depending on the Wmode bit).
379 <P>Wmode is used in absolute mode only. When set the packets also
380 contain the W value. (This value indicates the amount of contact:
381 0: two-finger contact, 1: three-finger contact, 2: pen contact,
382 3: reserved, 4-7: ordinary finger contact, 8-15: wide finger or palm contact.)
383 <P>This described Touchpad 4.x. Earlier models had up to four mode bytes.
384 This request would return mode bytes 1 and 2 in the first and last result byte,
385 and request <B>02</B> would return mode bytes 3 and 4.
386 <P>
387 <P><I>Request <B>02</B>: Read Capabilities</I>
388 <P>This request returns three bytes, of which the middle one is
389 the constant <B>47</B>. The first and third byte are the high-order
390 and low-order parts of the capability word.
391 (Thus on Touchpad 4.x. On earlier models mode bytes 3 and 4 are returned.)
392 <P>This capability word has 16 bits. Bit 15 indicates that capabilities
393 are supported. Bit 4 indicates that Sleep is supported (for the PS/2
394 protocol). Bit 3 indicates that four buttons (Left, Right, Up, Down)
395 are supported. Bit 1 indicates that multi-finger detection is supported.
396 Bit 0 indicates that palm detection is supported.
397 <P>
398 <P><I>Request <B>03</B>: Read Model ID</I>
399 <P>
400 <P><I>Request <B>06</B>: Read Serial Number Prefix</I>
401 <P>
402 <P><I>Request <B>07</B>: Read Serial Number Suffix</I>
403 <P>
404 <P><I>Request <B>08</B>: Read Resolution</I>
405 <P>
406 <P>
407 <H3>Mode setting</H3>
408
409 <P>When preceded by an 8-bit request number encoded via four <B>e8</B>
410 commands, the <B>
411 <A HREF="#mcf3">f3</A></B> <B>14</B>
412 (set sample rate 20) command sets the mode byte to the
413 encoded number. (Thus on Touchpads 4.x. Older models have more mode
414 bytes and several such commands.)
415 <P>
416 <P>
417 <H2><A NAME="ss12.7">12.7 Vendor extensions</A>
418 </H2>
419
420 <P>There is a complicated forest of "magic sequences" that enable
421 vendor extensions. Recognizing all of these is a very obscure activity.
422 <P>(Moreover, recognizing these may be counterproductive:
423 if the mouse has special capabilities which are activated
424 by a special sequence, and it is connected to the computer
425 via a KVM switch that does not know about this special protocol,
426 then switching away and back will leave the mouse in the non-special
427 state. This leads to non-functioning mice.)
428 <P>A 2002 Logitech file describes the following procedure for recognizing
429 the mouse type:
430 <P>Stage 1: Send <B>ff</B>: reset.
431 The reply is ignored. (Most common is <B>aa</B> <B>00</B>.)
432 <P>Stage 2: Send <B>f3</B> <B>0a</B> <B>f2</B>: set sample rate
433 and ask for ID. If the reply is <B>02</B>, we have a trackball -
434 it has its own protocol. (The usual reply is <B>00</B>.)
435 <P>Stage 3: Send <B>e8</B> <B>00</B> <B>e6</B> <B>e6</B> <B>e6</B>
436 <B>e9</B>: set resolution and scaling (three times), and request status.
437 The reply consists of three bytes <I>s1</I> <I>s2</I> <I>s3</I>.
438 An old-fashioned mouse would report 0 in the second status byte <I>s2</I>
439 (since that is the resolution and we just set it).
440 <P>If <I>s2</I> is nonzero then: <I>s2</I> is the number of buttons,
441 <I>s3</I> is the firmware revision,
442 <I>s1</I> has the firmware ID (device type) bits 6-0 in bits 3-0,6-4,
443 while bit 7 of s1 indicates support for the
444 <B>e7</B> <B>e7</B> <B>e7</B> <B>e9</B> command.
445 <P>If <I>s1</I>=<B>d0</B> and <I>s2</I>=<B>03</B> and
446 <I>s3</I>=<B>c8</B>, suspect Synaptics.
447 <P>If <I>s1</I> and <I>s2</I> are zero but <I>s3</I> equals <B>0a</B>,
448 suspect Alps. (<I>s3</I>=<B>0a</B> is as expected, but <I>s1</I>=0
449 is not)
450 <P>Stage 4: If bit 7 of <I>s1</I> is set, or if we suspect Alps,
451 send <B>e8</B> <B>00</B> <B>e7</B> <B>e7</B> <B>e7</B> <B>e9</B>:
452 set resolution and scaling (three times), and request status.
453 The reply consists of three bytes <I>t1</I> <I>t2</I> <I>t3</I>.
454 Of course, we already know that this is not an old-fashioned mouse.
455 <P>If <I>t2</I>=<B>01</B> and FirmwareID &lt; 0x10 and
456 <I>t1</I> &gt;&gt; 6 = 1, then conclude that we have a
457 Cordless MouseMan (RA12).
458 <P>If <I>t2</I>=<B>01</B> and FirmwareID &lt; 0x10 and
459 <I>t1</I> &gt;&gt; 6 = 3, then conclude that we have a
460 Cordless MouseMan (RB24).
461 <P>Other cases with <I>t2</I>=<B>01</B> are for new cordless mice.
462 <P>If we suspect Synaptics and <I>t2</I>=0 and <I>t3</I>=<B>0a</B>,
463 then conclude that we have a Synaptics touchpad.
464 <P>If we suspect Alps and <I>t1</I>=<B>33</B>, then conclude that
465 we have an Alps touchpad.
466 <P>Stage 5: If we don't know the type yet, send <B>f3</B> <B>c8</B>
467 <B>f3</B> <B>64</B> <B>f3</B> <B>50</B> <B>f2</B>:
468 Set sampling rate to 200, 100, 80 Hz, and ask for ID.
469 The reply is a single byte.
470 If we get 3, conclude that we have an IntelliMouse.
471 (And this sequence is the initialization sequence for the IntelliMouse.)
472 <P>Stage 6: Send <B>ff</B>: reset. Now the device is no longer in any
473 special state.
474 <P>Stage 7: If we don't know the type yet, send <B>e8</B> <B>00</B>
475 <B>e8</B> <B>00</B> <B>e8</B> <B>00</B> <B>e8</B> <B>00</B>
476 <B>e9</B>: set resolution to 0 (four times), and ask for status.
477 The reply consists of three bytes <I>u1</I> <I>u2</I> <I>u3</I>.
478 If <I>u2</I>=<B>47</B> and <I>u3</I>=<B>13</B>, then conclude
479 that we have a new Synaptics touchpad.
480 <P>Stage 7a: At this point we can narrow down to model type.
481 If the thing is Synaptics or Alps, then Logitech is no longer interested.
482 If it has 3 buttons, FirmwareID 1 and firmware revision <B>50</B>,
483 then conclude that it is a Logitech Mouseman.
484 <P>Stage 8: If we think it is a touchpad, detect whether it has programmable RAM.
485 Send <B>e6</B> <B>e8</B> <B>00</B> <B>e8</B> <B>00</B> <B>e8</B>
486 <B>00</B> <B>e8</B> <B>00</B> <B>e9</B>. The reply consists of three
487 bytes <I>v1</I> <I>v2</I> <I>v3</I>.
488 If <I>v1</I>=<B>06</B> and <I>v2</I>=<B>00</B>, then conclude
489 that we have a Touchpad TP3 with programmable RAM.
490 <P>Stage 9: Test whether the device understands the Logitech PS/2++ protocol.
491 Send the "magic knock" <B>f5</B> <B>e8</B> <B>00</B> <B>e8</B>
492 <B>03</B> <B>e8</B> <B>02</B> <B>e8</B> <B>01</B> <B>e6</B>
493 <B>e8</B> <B>03</B> <B>e8</B> <B>01</B> <B>e8</B> <B>02</B>
494 <B>e8</B> <B>03</B> <B>f4</B>.
495 Check whether the device replies with an extended report.
496 <P>
497 <HR>
498 <A HREF="scancodes-13.html">Next</A>
499 <A HREF="scancodes-11.html">Previous</A>
500 <A HREF="scancodes.html#toc12">Contents</A>
501 </BODY>
502 </HTML>