1 |
131 |
jt_eaton |
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
2 |
|
|
<html><head>
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
8 |
|
|
|
9 |
|
|
<meta name="GENERATOR" content="Mozilla/4.7 [en] (Win98; U) [Netscape]">
|
10 |
|
|
|
11 |
|
|
<meta name="Author" content="Adam Chapweske">
|
12 |
|
|
<title>PS/2 Mouse Interfacing</title>
|
13 |
|
|
<!--This file created 10:20 PM 3/29/01 by Claris Home Page version 3.0-->
|
14 |
|
|
</head><body vlink="#3333ff" alink="#3333ff" bgcolor="#ffffff" link="#3333ff">
|
15 |
|
|
<small><b><font face="Arial,Helvetica"><font size="+3"><small>The PS/2
|
16 |
|
|
Mouse Interface</small></font></font></b></small><br>
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
<center></center>
|
20 |
|
|
|
21 |
|
|
<center>
|
22 |
|
|
<hr size="1" width="400" align="left" noshade="noshade"></center>
|
23 |
|
|
<br>
|
24 |
|
|
<font face="Arial,Helvetica">Source: <a href="http://www.computer-engineering.org/">http://www.Computer-Engineering.org</a></font><br>
|
25 |
|
|
<font face="Arial,Helvetica">Author: Adam Chapweske<br>
|
26 |
|
|
Last Updated: 04/01/03<br>
|
27 |
|
|
|
28 |
|
|
<br>
|
29 |
|
|
<br>
|
30 |
|
|
</font><b>Legal Information:</b><br>
|
31 |
|
|
<br>
|
32 |
|
|
All information within this article is provided "as is" and without any
|
33 |
|
|
express or implied warranties, including, without limitation, the implied
|
34 |
|
|
warranties of merchantibility and fitness for a particular purpose. <br>
|
35 |
|
|
<br>
|
36 |
|
|
This article is protected under copyright law. This document may
|
37 |
|
|
be copied only if the source, author, date, and legal information is included.<br>
|
38 |
|
|
|
39 |
|
|
<br>
|
40 |
|
|
<b>Abstract:</b><br>
|
41 |
|
|
<br>
|
42 |
|
|
This article attempts to explain every aspect of the PS/2 mouse interface
|
43 |
|
|
including the physical and electrical interface, low-level protocol, modes
|
44 |
|
|
of operation, commands, and extensions. All code samples involving
|
45 |
|
|
the mouse encoder are written in assembly for <a href="http://www.microchip.com/">Microchip's</a> PIC microcontrollers.
|
46 |
|
|
All code samples related to the auxiliary device controller (keyboard
|
47 |
|
|
controller) are written in x86 assembly<br>
|
48 |
|
|
|
49 |
|
|
<br>
|
50 |
|
|
<b>General Description:</b><br>
|
51 |
|
|
<br>
|
52 |
|
|
There are many types of pointing devices available for modern PCs, including
|
53 |
|
|
mice, trackballs, touchpads, electronic whiteboards, etc. Virtually
|
54 |
|
|
all of these pointing devices communicate with a computer using one of two
|
55 |
|
|
interfaces: Universal Serial Bus (USB) or the PS/2 Mouse Interface. See
|
56 |
|
|
the following table for a comparison:<br>
|
57 |
|
|
|
58 |
|
|
<blockquote>
|
59 |
|
|
<table width="500" border="1" cellpadding="2" cellspacing="0">
|
60 |
|
|
<tbody>
|
61 |
|
|
|
62 |
|
|
<tr>
|
63 |
|
|
<td valign="top" width="33%" align="center"><br>
|
64 |
|
|
</td>
|
65 |
|
|
<td valign="top" width="33%" align="center"><b>USB (v1.1)</b><br>
|
66 |
|
|
</td>
|
67 |
|
|
<td valign="top" align="center"><b> PS/2 Mouse Interface
|
68 |
|
|
</b><br>
|
69 |
|
|
</td>
|
70 |
|
|
</tr>
|
71 |
|
|
|
72 |
|
|
<tr>
|
73 |
|
|
<td valign="top" width="33%" align="center">Number of Devices
|
74 |
|
|
Supported<br>
|
75 |
|
|
</td>
|
76 |
|
|
<td valign="top" width="33%" align="center">Up to 127<br>
|
77 |
|
|
</td>
|
78 |
|
|
<td valign="top" align="center">One<br>
|
79 |
|
|
</td>
|
80 |
|
|
|
81 |
|
|
</tr>
|
82 |
|
|
<tr>
|
83 |
|
|
<td valign="top" width="33%" align="center">Maximum Data Rate<br>
|
84 |
|
|
</td>
|
85 |
|
|
<td valign="top" width="33%" align="center">12 Mbps<br>
|
86 |
|
|
</td>
|
87 |
|
|
<td valign="top" align="center">40 kbps<br>
|
88 |
|
|
|
89 |
|
|
</td>
|
90 |
|
|
</tr>
|
91 |
|
|
<tr>
|
92 |
|
|
<td valign="top" width="33%" align="center">Power (max)<br>
|
93 |
|
|
</td>
|
94 |
|
|
<td valign="top" width="33%" align="center">5V @ 500mA<br>
|
95 |
|
|
</td>
|
96 |
|
|
<td valign="top" align="center">5V @ 100mA<br>
|
97 |
|
|
|
98 |
|
|
</td>
|
99 |
|
|
</tr>
|
100 |
|
|
<tr>
|
101 |
|
|
<td valign="top" width="33%" align="center">Hot-Pluggable?<br>
|
102 |
|
|
</td>
|
103 |
|
|
<td valign="top" width="33%" align="center">Yes<br>
|
104 |
|
|
</td>
|
105 |
|
|
<td valign="top" align="center">No<br>
|
106 |
|
|
|
107 |
|
|
</td>
|
108 |
|
|
</tr>
|
109 |
|
|
<tr>
|
110 |
|
|
<td valign="top" width="33%" align="center">Documentation<br>
|
111 |
|
|
</td>
|
112 |
|
|
<td valign="top" width="33%" align="center">Well-documented: <a href="http://www.usb.org/">http://www.usb.org</a><br>
|
113 |
|
|
</td>
|
114 |
|
|
|
115 |
|
|
<td valign="top" align="center">Out-of-print <br>
|
116 |
|
|
(IBM Tech Reference)<br>
|
117 |
|
|
</td>
|
118 |
|
|
</tr>
|
119 |
|
|
|
120 |
|
|
</tbody>
|
121 |
|
|
</table>
|
122 |
|
|
<br>
|
123 |
|
|
</blockquote>
|
124 |
|
|
|
125 |
|
|
Older pointing device interfaces include the Apple Desktop Bus (ADB),
|
126 |
|
|
RS-232 serial port, and the bus mouse interface. These are obsolete
|
127 |
|
|
and are not covered in this article.<br>
|
128 |
|
|
<br>
|
129 |
|
|
The PS/2 mouse interface originally appeared in IBM's "Personal System/2"
|
130 |
|
|
computers in the late 80's. It still remains a widely-supported interface
|
131 |
|
|
for the sake of constantly maintaining backward compatibility. However,
|
132 |
|
|
USB has quickly caught on these last few years and will eventually replace
|
133 |
|
|
the PS/2 mouse interface entirely.<br>
|
134 |
|
|
<br>
|
135 |
|
|
The PS/2 mouse interface uses a bidirectional serial protocol to transmit
|
136 |
|
|
movement and button-position data to the computer's auxiliary device controller
|
137 |
|
|
(keyboard controller). The computer, in turn, may send a number of
|
138 |
|
|
commands to the mouse to set the report rate, resolution, reset the mouse,
|
139 |
|
|
disable the mouse, etc. The computer also provides the mouse with an
|
140 |
|
|
overload-protected 5V power supply.<br>
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
<p><b>Electrical Interface / Protocol:</b> </p>
|
144 |
|
|
|
145 |
|
|
<p>The PS/2 mouse uses the same protocol as the PS/2 keyboard (aka AT keyboard).
|
146 |
|
|
Click <a href="http://www.computer-engineering.org/ps2protocol">here</a> for detailed information on this
|
147 |
|
|
protocol. </p>
|
148 |
|
|
|
149 |
|
|
<p><b>Inputs, Resolution, and Scaling:</b> </p>
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
<p>The standard PS/2 mouse interface supports the following inputs: X (right/left)
|
153 |
|
|
movement, Y (up/down) movement, left button, middle button, and right button.
|
154 |
|
|
The mouse reads these inputs at a regular freqency and updates various
|
155 |
|
|
counters and flags to reflect movement and button states. There are
|
156 |
|
|
many PS/2 pointing devices that have additional inputs and may report data
|
157 |
|
|
differently than described in this document. One popular extension
|
158 |
|
|
I cover later in this document is the Microsoft Intellimouse, which includes
|
159 |
|
|
support for the standard inputs as well as a scrolling wheel and two additional
|
160 |
|
|
buttons. </p>
|
161 |
|
|
|
162 |
|
|
<p>The standard mouse has two counters that keep track of movement: the X-movement
|
163 |
|
|
counter and the Y-movement counter. These are 9-bit 2's complement
|
164 |
|
|
values and each has an associated overflow flag. Their contents, along
|
165 |
|
|
with the state of the three mouse buttons, are sent to the host in the form
|
166 |
|
|
of a 3-byte movement data packet (as described in the next section.)
|
167 |
|
|
The movement counters represent the amount of movement that has occurred
|
168 |
|
|
since the last movment data packet was sent to the host (ie, they do not
|
169 |
|
|
represent absolute positions.) </p>
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
<p>When the mouse reads its inputs, it records the current state of its buttons
|
173 |
|
|
and checks for movement. If movement has occurred it increments (for +X
|
174 |
|
|
or +Y movement) or decrements (for -X or -Y movement) its X and/or Y movement
|
175 |
|
|
counters. If either of the counters has overflowed, it sets the appropriate
|
176 |
|
|
overflow flag. </p>
|
177 |
|
|
|
178 |
|
|
<p>The parameter that determines the amount by which the movement counters
|
179 |
|
|
are incremented/decremented is the <i>resolution</i>. The default resolution
|
180 |
|
|
is 4 counts/mm and the host may change that value using the "Set Resolution"
|
181 |
|
|
(0xE8) command. </p>
|
182 |
|
|
|
183 |
|
|
<p>There is a parameter that does not effect the movement counters, but does
|
184 |
|
|
effect the reported<a href="#Footnotes">(1)</a> value of these counters.
|
185 |
|
|
This parameter is <i>scaling</i>. By default, the mouse uses 1:1
|
186 |
|
|
scaling, which has no effect on the reported mouse movement. However,
|
187 |
|
|
the host may select 2:1 scaling by sending the "Set Scaling 2:1" (0xE7)
|
188 |
|
|
command. If 2:1 scaling is enabled, the mouse will apply the following
|
189 |
|
|
algorithm to the counters before sending their contents to the host: <br>
|
190 |
|
|
|
191 |
|
|
</p>
|
192 |
|
|
|
193 |
|
|
<blockquote>
|
194 |
|
|
<table width="300" border="1" cellpadding="2" cellspacing="0">
|
195 |
|
|
<tbody>
|
196 |
|
|
<tr>
|
197 |
|
|
<td valign="top" align="center">Movement Counter<br>
|
198 |
|
|
</td>
|
199 |
|
|
<td valign="top" align="center">Reported Movement<br>
|
200 |
|
|
|
201 |
|
|
</td>
|
202 |
|
|
</tr>
|
203 |
|
|
<tr>
|
204 |
|
|
<td valign="top" align="center">0<br>
|
205 |
|
|
</td>
|
206 |
|
|
<td valign="top" align="center">0<br>
|
207 |
|
|
</td>
|
208 |
|
|
</tr>
|
209 |
|
|
|
210 |
|
|
<tr>
|
211 |
|
|
<td valign="top" align="center">1<br>
|
212 |
|
|
</td>
|
213 |
|
|
<td valign="top" align="center">1<br>
|
214 |
|
|
</td>
|
215 |
|
|
</tr>
|
216 |
|
|
<tr>
|
217 |
|
|
<td valign="top" align="center">2<br>
|
218 |
|
|
|
219 |
|
|
</td>
|
220 |
|
|
<td valign="top" align="center">1<br>
|
221 |
|
|
</td>
|
222 |
|
|
</tr>
|
223 |
|
|
<tr>
|
224 |
|
|
<td valign="top" align="center">3<br>
|
225 |
|
|
</td>
|
226 |
|
|
<td valign="top" align="center">3<br>
|
227 |
|
|
|
228 |
|
|
</td>
|
229 |
|
|
</tr>
|
230 |
|
|
<tr>
|
231 |
|
|
<td valign="top" align="center">4<br>
|
232 |
|
|
</td>
|
233 |
|
|
<td valign="top" align="center">6<br>
|
234 |
|
|
</td>
|
235 |
|
|
</tr>
|
236 |
|
|
|
237 |
|
|
<tr>
|
238 |
|
|
<td valign="top" align="center">5<br>
|
239 |
|
|
</td>
|
240 |
|
|
<td valign="top" align="center">9<br>
|
241 |
|
|
</td>
|
242 |
|
|
</tr>
|
243 |
|
|
<tr>
|
244 |
|
|
<td valign="top" align="center">N > 5<br>
|
245 |
|
|
|
246 |
|
|
</td>
|
247 |
|
|
<td valign="top" align="center">2 * N<br>
|
248 |
|
|
</td>
|
249 |
|
|
</tr>
|
250 |
|
|
|
251 |
|
|
</tbody>
|
252 |
|
|
</table>
|
253 |
|
|
</blockquote>
|
254 |
|
|
|
255 |
|
|
<center>
|
256 |
|
|
<div align="center"> </div>
|
257 |
|
|
|
258 |
|
|
</center>
|
259 |
|
|
|
260 |
|
|
<center></center>
|
261 |
|
|
|
262 |
|
|
<center>
|
263 |
|
|
<div align="center"> </div>
|
264 |
|
|
</center>
|
265 |
|
|
|
266 |
|
|
<p><b><br>
|
267 |
|
|
Movement Data Packet:</b> </p>
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
<p>The standard PS/2 mouse sends movement/button information to the host
|
271 |
|
|
using the following 3-byte packet <a href="#Footnotes">(4)</a>:
|
272 |
|
|
</p>
|
273 |
|
|
|
274 |
|
|
<blockquote>
|
275 |
|
|
<table width="650" border="0" cellpadding="0" cellspacing="0">
|
276 |
|
|
<tbody>
|
277 |
|
|
<tr>
|
278 |
|
|
<td> <br>
|
279 |
|
|
<font face="Arial,Helvetica"><font size="-1">Byte 1 </font></font></td>
|
280 |
|
|
|
281 |
|
|
<td>
|
282 |
|
|
<table width="100%" border="0" cellpadding="0" cols="8">
|
283 |
|
|
<tbody>
|
284 |
|
|
<tr>
|
285 |
|
|
<td>
|
286 |
|
|
|
287 |
|
|
<center>Bit 7</center>
|
288 |
|
|
</td>
|
289 |
|
|
<td>
|
290 |
|
|
|
291 |
|
|
<center>Bit 6</center>
|
292 |
|
|
|
293 |
|
|
</td>
|
294 |
|
|
<td>
|
295 |
|
|
|
296 |
|
|
<center>Bit 5</center>
|
297 |
|
|
</td>
|
298 |
|
|
<td>
|
299 |
|
|
|
300 |
|
|
<center>Bit 4</center>
|
301 |
|
|
</td>
|
302 |
|
|
<td>
|
303 |
|
|
|
304 |
|
|
<center>Bit 3</center>
|
305 |
|
|
|
306 |
|
|
</td>
|
307 |
|
|
<td>
|
308 |
|
|
|
309 |
|
|
<center>Bit 2</center>
|
310 |
|
|
</td>
|
311 |
|
|
<td>
|
312 |
|
|
|
313 |
|
|
<center>Bit 1</center>
|
314 |
|
|
</td>
|
315 |
|
|
<td>
|
316 |
|
|
|
317 |
|
|
<center>Bit 0</center>
|
318 |
|
|
|
319 |
|
|
</td>
|
320 |
|
|
</tr>
|
321 |
|
|
|
322 |
|
|
</tbody>
|
323 |
|
|
|
324 |
|
|
</table>
|
325 |
|
|
|
326 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="8">
|
327 |
|
|
<tbody>
|
328 |
|
|
<tr>
|
329 |
|
|
<td>
|
330 |
|
|
|
331 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y overflow</font></font></center>
|
332 |
|
|
|
333 |
|
|
</td>
|
334 |
|
|
<td>
|
335 |
|
|
|
336 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X overflow</font></font></center>
|
337 |
|
|
</td>
|
338 |
|
|
<td>
|
339 |
|
|
|
340 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y sign
|
341 |
|
|
bit</font></font></center>
|
342 |
|
|
</td>
|
343 |
|
|
<td>
|
344 |
|
|
|
345 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X sign
|
346 |
|
|
bit</font></font></center>
|
347 |
|
|
|
348 |
|
|
</td>
|
349 |
|
|
<td>
|
350 |
|
|
|
351 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Always
|
352 |
|
|
1</font></font></center>
|
353 |
|
|
</td>
|
354 |
|
|
<td>
|
355 |
|
|
|
356 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Middle
|
357 |
|
|
Btn</font></font></center>
|
358 |
|
|
</td>
|
359 |
|
|
<td>
|
360 |
|
|
|
361 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Right
|
362 |
|
|
Btn</font></font></center>
|
363 |
|
|
|
364 |
|
|
</td>
|
365 |
|
|
<td>
|
366 |
|
|
|
367 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Left
|
368 |
|
|
Btn</font></font></center>
|
369 |
|
|
</td>
|
370 |
|
|
</tr>
|
371 |
|
|
|
372 |
|
|
</tbody>
|
373 |
|
|
|
374 |
|
|
</table>
|
375 |
|
|
</td>
|
376 |
|
|
</tr>
|
377 |
|
|
|
378 |
|
|
<tr>
|
379 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 2</font></font></td>
|
380 |
|
|
<td>
|
381 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
382 |
|
|
<tbody>
|
383 |
|
|
<tr>
|
384 |
|
|
<td>
|
385 |
|
|
|
386 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X Movement</font></font></center>
|
387 |
|
|
</td>
|
388 |
|
|
|
389 |
|
|
</tr>
|
390 |
|
|
|
391 |
|
|
</tbody>
|
392 |
|
|
|
393 |
|
|
</table>
|
394 |
|
|
</td>
|
395 |
|
|
</tr>
|
396 |
|
|
<tr>
|
397 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 3 </font></font></td>
|
398 |
|
|
<td>
|
399 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
400 |
|
|
|
401 |
|
|
<tbody>
|
402 |
|
|
<tr>
|
403 |
|
|
<td>
|
404 |
|
|
|
405 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y Movement</font></font></center>
|
406 |
|
|
</td>
|
407 |
|
|
</tr>
|
408 |
|
|
|
409 |
|
|
</tbody>
|
410 |
|
|
|
411 |
|
|
</table>
|
412 |
|
|
</td>
|
413 |
|
|
|
414 |
|
|
</tr>
|
415 |
|
|
|
416 |
|
|
</tbody>
|
417 |
|
|
</table>
|
418 |
|
|
</blockquote>
|
419 |
|
|
The movement counters are 9-bit 2's complement integers, where the
|
420 |
|
|
most significant bit appears as a sign bit in Byte 1 of the movement data
|
421 |
|
|
packet. These counters are updated when the mouse reads its input and finds
|
422 |
|
|
movement has occurred. Their value is the amount of movement that has occurred
|
423 |
|
|
since the last movement data packet was sent to the host (ie, after a packet
|
424 |
|
|
is sent to the host, the movement counters are reset.) The range of values
|
425 |
|
|
that can be expressed by the movement counters is -255 to +255. If this
|
426 |
|
|
range is exceeded, the appropriate overflow bit is set.
|
427 |
|
|
<p>As I mentioned earlier, the movement counters are reset whenever a movement
|
428 |
|
|
data packet is successfully sent to the host. They are also reset after
|
429 |
|
|
the mouse receives any command from the host other than the "Resend" (0xFE)
|
430 |
|
|
command. </p>
|
431 |
|
|
|
432 |
|
|
<p><b>Modes of Operation:</b> </p>
|
433 |
|
|
|
434 |
|
|
<p>Data reporting is handled according to the mode in which the mouse is
|
435 |
|
|
operating. There are four standard modes of operation: </p>
|
436 |
|
|
|
437 |
|
|
|
438 |
|
|
<ul>
|
439 |
|
|
<li> <i>Reset</i> - The mouse enters Reset mode at power-up or after
|
440 |
|
|
receiving the "Reset" (0xFF) command. </li>
|
441 |
|
|
<li> <i>Stream</i> - This is the default mode (after Reset finishes
|
442 |
|
|
executing) and is the mode in which most software uses the mouse.
|
443 |
|
|
If the host has previously set the mouse to Remote mode, it may re-enter
|
444 |
|
|
Stream mode by sending the "Set Stream Mode" (0xEA) command to the mouse. </li>
|
445 |
|
|
<li> <i>Remote</i> - Remote mode is useful in some situations and may
|
446 |
|
|
be entered by sending the "Set Remote Mode" (0xF0) command to the mouse. </li>
|
447 |
|
|
|
448 |
|
|
<li> <i>Wrap</i> - This mode isn't particularly useful except for testing
|
449 |
|
|
the connection between the mouse and its host. Wrap mode may be entered
|
450 |
|
|
by sending the "Set Wrap Mode" (0xEE) command to the mouse. To exit
|
451 |
|
|
Wrap mode, the host must issue the "Reset" (0xFF) command or "Reset Wrap
|
452 |
|
|
Mode" (0xEC) command. If the "Reset" (0xFF) command is recieved,
|
453 |
|
|
the mouse will enter Reset mode. If the "Reset Wrap Mode" (0xEC)
|
454 |
|
|
command is received, the mouse will enter the mode it was in prior to Wrap
|
455 |
|
|
Mode.</li>
|
456 |
|
|
|
457 |
|
|
</ul>
|
458 |
|
|
(Note: The mouse may also enter "extended" modes of operation, as described
|
459 |
|
|
later in this document. However, this is not a feature of the standard
|
460 |
|
|
PS/2 mouse.)
|
461 |
|
|
|
462 |
|
|
<p><b>Reset Mode:</b> </p>
|
463 |
|
|
|
464 |
|
|
<p>The mouse enters reset mode at power-on or in response to the "Reset"
|
465 |
|
|
(0xFF) command. After entring this mode, the mouse performs a diagnostic
|
466 |
|
|
self-test referred to as BAT (Basic Assurance Test) and sets the following
|
467 |
|
|
default values: </p>
|
468 |
|
|
|
469 |
|
|
<ul>
|
470 |
|
|
<li> Sample Rate = 100 samples/sec</li>
|
471 |
|
|
<li> Resolution = 4 counts/mm</li>
|
472 |
|
|
<li> Scaling = 1:1</li>
|
473 |
|
|
|
474 |
|
|
<li> Data Reporting Disabled</li>
|
475 |
|
|
|
476 |
|
|
</ul>
|
477 |
|
|
It then sends a BAT completion code of either AAh (BAT successful)
|
478 |
|
|
or FCh (Error). The host's response to a completion code other than AAh
|
479 |
|
|
is undefined.
|
480 |
|
|
<p>Following the BAT completion code (AAh or FCh), the mouse sends its device
|
481 |
|
|
ID of 00h. This distinguishes it from a keyboard, or a mouse in an extended
|
482 |
|
|
mode. I have read documents saything the host is not <i>supposed</i> to
|
483 |
|
|
transmit any data until it receives a device ID. However I've found
|
484 |
|
|
that some BIOS's will send the "Reset" command immediately following the
|
485 |
|
|
0xAA received after a power-on reset. </p>
|
486 |
|
|
|
487 |
|
|
<p>After the mouse has sent its device ID to the host, it will enter Stream
|
488 |
|
|
Mode. Note that one of the default values set by the mouse is "Data
|
489 |
|
|
Reporting Disabled". This means the mouse will not issue any movement
|
490 |
|
|
data packets until it receives the "Enable Data Reporting" command. </p>
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
<p><b>Stream Mode:</b> </p>
|
494 |
|
|
|
495 |
|
|
<p>In stream mode, the mouse sends movement data when it detects movement
|
496 |
|
|
or a change in state of one or more mouse buttons. The maximum rate at
|
497 |
|
|
which this data reporting may occur is known as the <i>sample rate</i>.
|
498 |
|
|
This parameter ranges from 10 samples/sec to 200 samples/sec. Its default
|
499 |
|
|
value is 100 samples/sec and the host may change that value by using the
|
500 |
|
|
"Set Sample Rate" command. Stream mode is the default mode of operation
|
501 |
|
|
following reset. </p>
|
502 |
|
|
|
503 |
|
|
<p><b>Remote Mode:</b> </p>
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
<p>In this mode the mouse reads its inputs and updates its counters/flags
|
507 |
|
|
at the current sample rate, but it does not automatically issue data packets
|
508 |
|
|
when movement has occured. Instead, the host must poll the mouse using
|
509 |
|
|
the "Read Data" command. Upon receiving this command the mouse will
|
510 |
|
|
send a single movement data packet and reset its movement counters.</p>
|
511 |
|
|
|
512 |
|
|
<p> </p>
|
513 |
|
|
|
514 |
|
|
<p><b>Wrap Mode:</b> </p>
|
515 |
|
|
|
516 |
|
|
<p>This is an "echoing" mode in which every byte received by the mouse is
|
517 |
|
|
sent back to the host. Even if the byte represents a valid command, the
|
518 |
|
|
mouse will not respond to that command--it will only echo that byte back
|
519 |
|
|
to the host. There are two exceptions to this: the "Reset" command and "Reset
|
520 |
|
|
Wrap Mode" command. The mouse treats these as valid commands and does not
|
521 |
|
|
echo them back to the host. </p>
|
522 |
|
|
|
523 |
|
|
<p><b>Intellimouse Extensions:</b> </p>
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
<p>A popular extension to the standard PS/2 mouse is the Microsoft Intellimouse.
|
527 |
|
|
This includes support for a total of five mouse buttons and three axises
|
528 |
|
|
of movement (right-left, up-down, and a scrolling wheel). These additional
|
529 |
|
|
features require the use of a 4-byte movement data packet rather than the
|
530 |
|
|
standard 3-byte packet. Since standard PS/2 mouse drivers cannot
|
531 |
|
|
recognize this packet format, the Microsoft Intellimouse is required to
|
532 |
|
|
operate exactly like a standard PS/2 mouse unless it knows the drivers
|
533 |
|
|
support the extended packet format. This way, if a Microsoft Intellimouse
|
534 |
|
|
is used on a computer which only supports the standard PS/2 mouse, the
|
535 |
|
|
Microsoft Intellimouse will still function, except for its scrolling wheel
|
536 |
|
|
and 4th and 5th buttons. </p>
|
537 |
|
|
|
538 |
|
|
<p>After power-on or reset the Microsoft Intellimouse operates just like
|
539 |
|
|
a standard PS/2 mouse (ie, it uses a 3-byte movement data packet, responds
|
540 |
|
|
to all commands in the same way as a standard PS/2 mouse, and reports a
|
541 |
|
|
device ID of 00h.) To enter "scrolling wheel" mode, the host sends
|
542 |
|
|
the following command sequence: </p>
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
<blockquote>Set sample rate 200 <br>
|
546 |
|
|
Set sample rate 100 <br>
|
547 |
|
|
Set sample rate 80</blockquote>
|
548 |
|
|
The host then issues the "Get device ID" command and waits for a response.
|
549 |
|
|
If a standard PS/2 mouse (ie, non-Intellimouse) is attached, it will respond
|
550 |
|
|
with a device ID of 00h. In this case, the host will recognize the
|
551 |
|
|
fact that the mouse does have a scrolling wheel and will continue to treat
|
552 |
|
|
it as a standard PS/2 mouse. However, if a Microsoft Intellimouse
|
553 |
|
|
is attached, it will respond with an ID of 03h. This tells the host
|
554 |
|
|
that the attached pointing device has a scrolling wheel and the host will
|
555 |
|
|
then expect the mouse to use the following 4-byte movement data packet:
|
556 |
|
|
|
557 |
|
|
|
558 |
|
|
<blockquote>
|
559 |
|
|
<table width="650" border="0" cellpadding="0" cellspacing="0">
|
560 |
|
|
<tbody>
|
561 |
|
|
<tr>
|
562 |
|
|
<td> <br>
|
563 |
|
|
<font face="Arial,Helvetica"><font size="-1">Byte 1 </font></font></td>
|
564 |
|
|
<td>
|
565 |
|
|
<table width="100%" border="0" cellpadding="0" cols="8">
|
566 |
|
|
<tbody>
|
567 |
|
|
|
568 |
|
|
<tr>
|
569 |
|
|
<td>
|
570 |
|
|
|
571 |
|
|
<center>Bit 7</center>
|
572 |
|
|
</td>
|
573 |
|
|
<td>
|
574 |
|
|
|
575 |
|
|
<center>Bit 6</center>
|
576 |
|
|
</td>
|
577 |
|
|
<td>
|
578 |
|
|
|
579 |
|
|
<center>Bit 5</center>
|
580 |
|
|
|
581 |
|
|
</td>
|
582 |
|
|
<td>
|
583 |
|
|
|
584 |
|
|
<center>Bit 4</center>
|
585 |
|
|
</td>
|
586 |
|
|
<td>
|
587 |
|
|
|
588 |
|
|
<center>Bit 3</center>
|
589 |
|
|
</td>
|
590 |
|
|
<td>
|
591 |
|
|
|
592 |
|
|
<center>Bit 2</center>
|
593 |
|
|
|
594 |
|
|
</td>
|
595 |
|
|
<td>
|
596 |
|
|
|
597 |
|
|
<center>Bit 1</center>
|
598 |
|
|
</td>
|
599 |
|
|
<td>
|
600 |
|
|
|
601 |
|
|
<center>Bit 0</center>
|
602 |
|
|
</td>
|
603 |
|
|
</tr>
|
604 |
|
|
|
605 |
|
|
</tbody>
|
606 |
|
|
|
607 |
|
|
</table>
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="8">
|
611 |
|
|
<tbody>
|
612 |
|
|
<tr>
|
613 |
|
|
<td>
|
614 |
|
|
|
615 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y overflow</font></font></center>
|
616 |
|
|
</td>
|
617 |
|
|
<td>
|
618 |
|
|
|
619 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X overflow</font></font></center>
|
620 |
|
|
</td>
|
621 |
|
|
|
622 |
|
|
<td>
|
623 |
|
|
|
624 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y sign
|
625 |
|
|
bit</font></font></center>
|
626 |
|
|
</td>
|
627 |
|
|
<td>
|
628 |
|
|
|
629 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X sign
|
630 |
|
|
bit</font></font></center>
|
631 |
|
|
</td>
|
632 |
|
|
<td>
|
633 |
|
|
|
634 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Always
|
635 |
|
|
1</font></font></center>
|
636 |
|
|
</td>
|
637 |
|
|
|
638 |
|
|
<td>
|
639 |
|
|
|
640 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Middle
|
641 |
|
|
Btn</font></font></center>
|
642 |
|
|
</td>
|
643 |
|
|
<td>
|
644 |
|
|
|
645 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Right
|
646 |
|
|
Btn</font></font></center>
|
647 |
|
|
</td>
|
648 |
|
|
<td>
|
649 |
|
|
|
650 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Left
|
651 |
|
|
Btn</font></font></center>
|
652 |
|
|
</td>
|
653 |
|
|
|
654 |
|
|
</tr>
|
655 |
|
|
|
656 |
|
|
</tbody>
|
657 |
|
|
|
658 |
|
|
</table>
|
659 |
|
|
</td>
|
660 |
|
|
</tr>
|
661 |
|
|
<tr>
|
662 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 2</font></font></td>
|
663 |
|
|
<td>
|
664 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
665 |
|
|
|
666 |
|
|
<tbody>
|
667 |
|
|
<tr>
|
668 |
|
|
<td>
|
669 |
|
|
|
670 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X Movement</font></font></center>
|
671 |
|
|
</td>
|
672 |
|
|
</tr>
|
673 |
|
|
|
674 |
|
|
</tbody>
|
675 |
|
|
|
676 |
|
|
</table>
|
677 |
|
|
</td>
|
678 |
|
|
|
679 |
|
|
</tr>
|
680 |
|
|
<tr>
|
681 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 3 </font></font></td>
|
682 |
|
|
<td>
|
683 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
684 |
|
|
<tbody>
|
685 |
|
|
<tr>
|
686 |
|
|
<td>
|
687 |
|
|
|
688 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y Movement</font></font></center>
|
689 |
|
|
|
690 |
|
|
</td>
|
691 |
|
|
</tr>
|
692 |
|
|
|
693 |
|
|
</tbody>
|
694 |
|
|
|
695 |
|
|
</table>
|
696 |
|
|
</td>
|
697 |
|
|
</tr>
|
698 |
|
|
<tr>
|
699 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 4</font></font></td>
|
700 |
|
|
<td>
|
701 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
702 |
|
|
|
703 |
|
|
<tbody>
|
704 |
|
|
<tr>
|
705 |
|
|
<td>
|
706 |
|
|
|
707 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Z Movement</font></font></center>
|
708 |
|
|
</td>
|
709 |
|
|
</tr>
|
710 |
|
|
|
711 |
|
|
</tbody>
|
712 |
|
|
|
713 |
|
|
</table>
|
714 |
|
|
</td>
|
715 |
|
|
|
716 |
|
|
</tr>
|
717 |
|
|
|
718 |
|
|
</tbody>
|
719 |
|
|
</table>
|
720 |
|
|
Z Movement is a 2's complement number that represents the scrolling
|
721 |
|
|
wheel's movement since the last data report. Valid values are in the
|
722 |
|
|
range of -8 to +7. This means the number is actually represented only by
|
723 |
|
|
the least significant four bits; the upper four bits act only as sign extension
|
724 |
|
|
bits.</blockquote>
|
725 |
|
|
To enter "scrolling wheel + 5 button" mode, the host sends the following
|
726 |
|
|
command sequence:
|
727 |
|
|
<blockquote>Set sample rate 200 <br>
|
728 |
|
|
Set sample rate 200 <br>
|
729 |
|
|
|
730 |
|
|
Set sample rate 80</blockquote>
|
731 |
|
|
The host then issues the "Get device ID" command and waits for a response.
|
732 |
|
|
A Microsoft Intellimouse will respond with a device ID of 04h, then use
|
733 |
|
|
the following 4-byte movement data packet:
|
734 |
|
|
<blockquote>
|
735 |
|
|
<blockquote>
|
736 |
|
|
<table width="650" border="0" cellpadding="0" cellspacing="0">
|
737 |
|
|
<tbody>
|
738 |
|
|
<tr>
|
739 |
|
|
<td> <br>
|
740 |
|
|
|
741 |
|
|
<font face="Arial,Helvetica"><font size="-1">Byte 1 </font></font></td>
|
742 |
|
|
<td>
|
743 |
|
|
|
744 |
|
|
<table width="100%" border="0" cellpadding="0" cols="8">
|
745 |
|
|
<tbody>
|
746 |
|
|
<tr>
|
747 |
|
|
<td>
|
748 |
|
|
|
749 |
|
|
<center>Bit 7</center>
|
750 |
|
|
</td>
|
751 |
|
|
<td>
|
752 |
|
|
|
753 |
|
|
<center>Bit 6</center>
|
754 |
|
|
|
755 |
|
|
</td>
|
756 |
|
|
<td>
|
757 |
|
|
|
758 |
|
|
<center>Bit 5</center>
|
759 |
|
|
</td>
|
760 |
|
|
<td>
|
761 |
|
|
|
762 |
|
|
<center>Bit 4</center>
|
763 |
|
|
</td>
|
764 |
|
|
<td>
|
765 |
|
|
|
766 |
|
|
<center>Bit 3</center>
|
767 |
|
|
|
768 |
|
|
</td>
|
769 |
|
|
<td>
|
770 |
|
|
|
771 |
|
|
<center>Bit 2</center>
|
772 |
|
|
</td>
|
773 |
|
|
<td>
|
774 |
|
|
|
775 |
|
|
<center>Bit 1</center>
|
776 |
|
|
</td>
|
777 |
|
|
<td>
|
778 |
|
|
|
779 |
|
|
<center>Bit 0</center>
|
780 |
|
|
|
781 |
|
|
</td>
|
782 |
|
|
</tr>
|
783 |
|
|
|
784 |
|
|
|
785 |
|
|
</tbody>
|
786 |
|
|
|
787 |
|
|
</table>
|
788 |
|
|
|
789 |
|
|
|
790 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="8">
|
791 |
|
|
<tbody>
|
792 |
|
|
<tr>
|
793 |
|
|
<td>
|
794 |
|
|
|
795 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y overflow</font></font></center>
|
796 |
|
|
|
797 |
|
|
</td>
|
798 |
|
|
<td>
|
799 |
|
|
|
800 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X overflow</font></font></center>
|
801 |
|
|
</td>
|
802 |
|
|
<td>
|
803 |
|
|
|
804 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y sign
|
805 |
|
|
bit</font></font></center>
|
806 |
|
|
</td>
|
807 |
|
|
<td>
|
808 |
|
|
|
809 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X sign
|
810 |
|
|
bit</font></font></center>
|
811 |
|
|
|
812 |
|
|
</td>
|
813 |
|
|
<td>
|
814 |
|
|
|
815 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Always
|
816 |
|
|
1</font></font></center>
|
817 |
|
|
</td>
|
818 |
|
|
<td>
|
819 |
|
|
|
820 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Middle
|
821 |
|
|
Btn</font></font></center>
|
822 |
|
|
</td>
|
823 |
|
|
<td>
|
824 |
|
|
|
825 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Right
|
826 |
|
|
Btn</font></font></center>
|
827 |
|
|
|
828 |
|
|
</td>
|
829 |
|
|
<td>
|
830 |
|
|
|
831 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Left
|
832 |
|
|
Btn</font></font></center>
|
833 |
|
|
</td>
|
834 |
|
|
</tr>
|
835 |
|
|
|
836 |
|
|
|
837 |
|
|
</tbody>
|
838 |
|
|
|
839 |
|
|
</table>
|
840 |
|
|
</td>
|
841 |
|
|
</tr>
|
842 |
|
|
|
843 |
|
|
<tr>
|
844 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 2</font></font></td>
|
845 |
|
|
<td>
|
846 |
|
|
|
847 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
848 |
|
|
<tbody>
|
849 |
|
|
<tr>
|
850 |
|
|
<td>
|
851 |
|
|
|
852 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">X Movement</font></font></center>
|
853 |
|
|
</td>
|
854 |
|
|
|
855 |
|
|
</tr>
|
856 |
|
|
|
857 |
|
|
|
858 |
|
|
</tbody>
|
859 |
|
|
|
860 |
|
|
</table>
|
861 |
|
|
</td>
|
862 |
|
|
</tr>
|
863 |
|
|
<tr>
|
864 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 3 </font></font></td>
|
865 |
|
|
<td>
|
866 |
|
|
|
867 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
868 |
|
|
|
869 |
|
|
<tbody>
|
870 |
|
|
<tr>
|
871 |
|
|
<td>
|
872 |
|
|
|
873 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Y Movement</font></font></center>
|
874 |
|
|
</td>
|
875 |
|
|
</tr>
|
876 |
|
|
|
877 |
|
|
|
878 |
|
|
</tbody>
|
879 |
|
|
|
880 |
|
|
</table>
|
881 |
|
|
</td>
|
882 |
|
|
|
883 |
|
|
</tr>
|
884 |
|
|
<tr>
|
885 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 4</font></font></td>
|
886 |
|
|
<td>
|
887 |
|
|
|
888 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="8">
|
889 |
|
|
<tbody>
|
890 |
|
|
<tr>
|
891 |
|
|
<td>
|
892 |
|
|
|
893 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Always
|
894 |
|
|
0</font></font></center>
|
895 |
|
|
|
896 |
|
|
</td>
|
897 |
|
|
<td>
|
898 |
|
|
|
899 |
|
|
<center>Always 0</center>
|
900 |
|
|
</td>
|
901 |
|
|
<td>
|
902 |
|
|
|
903 |
|
|
<center>5th Btn</center>
|
904 |
|
|
</td>
|
905 |
|
|
<td>
|
906 |
|
|
|
907 |
|
|
<center>4th Btn</center>
|
908 |
|
|
|
909 |
|
|
</td>
|
910 |
|
|
<td>
|
911 |
|
|
|
912 |
|
|
<center>Z3</center>
|
913 |
|
|
</td>
|
914 |
|
|
<td>
|
915 |
|
|
|
916 |
|
|
<center>Z2</center>
|
917 |
|
|
</td>
|
918 |
|
|
<td>
|
919 |
|
|
|
920 |
|
|
<center>Z1</center>
|
921 |
|
|
|
922 |
|
|
</td>
|
923 |
|
|
<td>
|
924 |
|
|
|
925 |
|
|
<center>Z0</center>
|
926 |
|
|
</td>
|
927 |
|
|
</tr>
|
928 |
|
|
|
929 |
|
|
|
930 |
|
|
</tbody>
|
931 |
|
|
|
932 |
|
|
</table>
|
933 |
|
|
</td>
|
934 |
|
|
</tr>
|
935 |
|
|
|
936 |
|
|
|
937 |
|
|
</tbody>
|
938 |
|
|
</table>
|
939 |
|
|
Z0-Z3 is a 2's complement number which represents the amount of movement
|
940 |
|
|
that has occurred since the last data report. Valid values range
|
941 |
|
|
from -8 to +7. <br>
|
942 |
|
|
4th Btn: 1 = 4th mouse button is pressed; 0 = 4th mouse button is not
|
943 |
|
|
pressed. <br>
|
944 |
|
|
5th Btn: 1 = 5th mouse button is pressed; 0 = 5th mouse button is not
|
945 |
|
|
pressed.</blockquote>
|
946 |
|
|
</blockquote>
|
947 |
|
|
You may have seen mice with two scrolling wheels--one vertical and
|
948 |
|
|
the other horizontal. These mice use the Microsoft Intellimouse data
|
949 |
|
|
packet format as described above. If the vertical wheel is scrolled
|
950 |
|
|
upward, the Z-counter is incremented by one and if that wheel is scrolled
|
951 |
|
|
down, the Z-counter is decremented by one. This is normal operation
|
952 |
|
|
for a scrolling wheel. However, if the <i>horizontal</i> wheel is
|
953 |
|
|
scrolled right, the Z-counter is incremented by <i>two</i> and if it is
|
954 |
|
|
scrolled left, the Z-counter is decremented by <i>two</i>. This seems
|
955 |
|
|
like an odd way to implement the second scrolling wheel, but it works since
|
956 |
|
|
the placement of the two wheels make it impossible to use both of them at
|
957 |
|
|
the same time (and if you try to trick the software and use both at the
|
958 |
|
|
same time, it will ignore the horizontal wheel.)
|
959 |
|
|
|
960 |
|
|
<p><b>Command Set:</b> </p>
|
961 |
|
|
|
962 |
|
|
<p>The following is the set of command accepted by the standard PS/2 mouse.
|
963 |
|
|
If the mouse is in Stream mode, the host should disable data reporting
|
964 |
|
|
(command F5h) before sending any other commands. </p>
|
965 |
|
|
|
966 |
|
|
<ul>
|
967 |
|
|
<li> FFh (Reset) - The mouse responds to this command with "acknowledge"
|
968 |
|
|
(FAh) then enters Reset Mode.</li>
|
969 |
|
|
<li> FEh (Resend) - The host sends this command whenever it receives
|
970 |
|
|
invalid data from the mouse. The mouse responds by resending the last<a href="#Footnotes">(2)</a> packet<a href="#Footnotes">(3)</a> it sent to
|
971 |
|
|
the host. If the mouse responds to the "Resend" command with
|
972 |
|
|
another invalid packet, the host may either issue another "Resend" command,
|
973 |
|
|
issue an "Error" command, cycle the mouse's power supply to reset the mouse,
|
974 |
|
|
or it may inhibit communication (by bringing the Clock line low).
|
975 |
|
|
|
976 |
|
|
The action taken depends on the host.</li>
|
977 |
|
|
<li> F6h (Set Defaults) - The mouse responds with "acknowledge" (FAh)
|
978 |
|
|
then loads the following values: Sampling rate = 100, Resolution =
|
979 |
|
|
4 counts/mm, Scaling = 1:1, Disable Data Reporting. The mouse then resets
|
980 |
|
|
its movement counters and enters stream mode.</li>
|
981 |
|
|
<li> F5h (Disable Data Reporting) - The mouse responds with "acknowledge"
|
982 |
|
|
(FAh) then disables data reporting and resets its movement counters.
|
983 |
|
|
This only effects data reporting in Stream mode and does not disable sampling.
|
984 |
|
|
Disabled stream mode funcions the same as remote mode.</li>
|
985 |
|
|
|
986 |
|
|
<li> F4h (Enable Data Reporting) - The mouse responds with "acknowledge"
|
987 |
|
|
(FAh) then enables data reporting and resets its movement counters.
|
988 |
|
|
This command may be issued while the mouse is in Remote Mode (or Stream
|
989 |
|
|
mode), but it will only effect data reporting in Stream mode.</li>
|
990 |
|
|
<li> F3h (Set Sample Rate) - The mouse responds with "acknowledge" (FAh)
|
991 |
|
|
then reads one more byte from the host. The mouse saves this byte
|
992 |
|
|
as the new sample rate. After receiving the sample rate, the mouse again
|
993 |
|
|
responds with "acknowledge" (0xFA) and resets its movement counters.
|
994 |
|
|
Valid sample rates are 10, 20, 40, 60, 80, 100, and 200 samples/sec.</li>
|
995 |
|
|
<li> F2h (Get Device ID) - The mouse responds with "acknowledge" (FAh)
|
996 |
|
|
followed by its device ID (00h for the standard PS/2 mouse.) The mouse
|
997 |
|
|
should also reset its movement counters.</li>
|
998 |
|
|
|
999 |
|
|
<li> F0h (Set Remote Mode) - The mouse responds with "acknowledge" (FAh)
|
1000 |
|
|
then resets its movement counters and enters remote mode.</li>
|
1001 |
|
|
<li> EEh (Set Wrap Mode) - The mouse responds with "acknowledge" (FAh)
|
1002 |
|
|
then resets its movement counters and enters wrap mode.</li>
|
1003 |
|
|
<li> ECh (Reset Wrap Mode) - The mouse responds with "acknowledge" (FAh)
|
1004 |
|
|
then resets its movement counters and enters the mode it was in prior to
|
1005 |
|
|
wrap mode (Stream Mode or Remote Mode.)</li>
|
1006 |
|
|
<li> EBh (Read Data) - The mouse responds with acknowledge (FAh) then
|
1007 |
|
|
sends a movement data packet. This is the only way to read data in Remote
|
1008 |
|
|
Mode. After the data packets has been successfully sent, it resets
|
1009 |
|
|
its movement counters.</li>
|
1010 |
|
|
|
1011 |
|
|
<li> EAh (Set Stream Mode) - The mouse responds with "acknowledge" then
|
1012 |
|
|
resets its movement counters and enters steram mode.</li>
|
1013 |
|
|
<li> E9h (Status Request) - The mouse responds with "acknowledge" then
|
1014 |
|
|
sends the following 3-byte status packet (then resets its movement counters.): </li>
|
1015 |
|
|
|
1016 |
|
|
<ul>
|
1017 |
|
|
<li> </li>
|
1018 |
|
|
|
1019 |
|
|
<table width="650" border="0" cellpadding="0" cellspacing="0">
|
1020 |
|
|
<tbody>
|
1021 |
|
|
|
1022 |
|
|
<tr>
|
1023 |
|
|
<td> <br>
|
1024 |
|
|
<font face="Arial,Helvetica"><font size="-1">Byte 1 </font></font></td>
|
1025 |
|
|
<td>
|
1026 |
|
|
|
1027 |
|
|
<table width="100%" border="0" cellpadding="0" cols="8">
|
1028 |
|
|
<tbody>
|
1029 |
|
|
<tr>
|
1030 |
|
|
<td>
|
1031 |
|
|
|
1032 |
|
|
<center>Bit 7</center>
|
1033 |
|
|
|
1034 |
|
|
</td>
|
1035 |
|
|
<td>
|
1036 |
|
|
|
1037 |
|
|
<center>Bit 6</center>
|
1038 |
|
|
</td>
|
1039 |
|
|
<td>
|
1040 |
|
|
|
1041 |
|
|
<center>Bit 5</center>
|
1042 |
|
|
</td>
|
1043 |
|
|
<td>
|
1044 |
|
|
|
1045 |
|
|
<center>Bit 4</center>
|
1046 |
|
|
|
1047 |
|
|
</td>
|
1048 |
|
|
<td>
|
1049 |
|
|
|
1050 |
|
|
<center>Bit 3</center>
|
1051 |
|
|
</td>
|
1052 |
|
|
<td>
|
1053 |
|
|
|
1054 |
|
|
<center>Bit 2</center>
|
1055 |
|
|
</td>
|
1056 |
|
|
<td>
|
1057 |
|
|
|
1058 |
|
|
<center>Bit 1</center>
|
1059 |
|
|
|
1060 |
|
|
</td>
|
1061 |
|
|
<td>
|
1062 |
|
|
|
1063 |
|
|
<center>Bit 0</center>
|
1064 |
|
|
</td>
|
1065 |
|
|
</tr>
|
1066 |
|
|
|
1067 |
|
|
|
1068 |
|
|
</tbody>
|
1069 |
|
|
|
1070 |
|
|
</table>
|
1071 |
|
|
|
1072 |
|
|
|
1073 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="8">
|
1074 |
|
|
<tbody>
|
1075 |
|
|
|
1076 |
|
|
<tr>
|
1077 |
|
|
<td>
|
1078 |
|
|
|
1079 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Always
|
1080 |
|
|
0</font></font></center>
|
1081 |
|
|
</td>
|
1082 |
|
|
<td>
|
1083 |
|
|
|
1084 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Mode</font></font></center>
|
1085 |
|
|
</td>
|
1086 |
|
|
<td>
|
1087 |
|
|
|
1088 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Enable</font></font></center>
|
1089 |
|
|
|
1090 |
|
|
</td>
|
1091 |
|
|
<td>
|
1092 |
|
|
|
1093 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Scaling</font></font></center>
|
1094 |
|
|
</td>
|
1095 |
|
|
<td>
|
1096 |
|
|
|
1097 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Always
|
1098 |
|
|
0</font></font></center>
|
1099 |
|
|
</td>
|
1100 |
|
|
<td>
|
1101 |
|
|
|
1102 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Left
|
1103 |
|
|
Btn</font></font></center>
|
1104 |
|
|
|
1105 |
|
|
</td>
|
1106 |
|
|
<td>
|
1107 |
|
|
|
1108 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Middle
|
1109 |
|
|
Btn</font></font></center>
|
1110 |
|
|
</td>
|
1111 |
|
|
<td>
|
1112 |
|
|
|
1113 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Right
|
1114 |
|
|
Btn</font></font></center>
|
1115 |
|
|
</td>
|
1116 |
|
|
</tr>
|
1117 |
|
|
|
1118 |
|
|
|
1119 |
|
|
</tbody>
|
1120 |
|
|
|
1121 |
|
|
</table>
|
1122 |
|
|
|
1123 |
|
|
</td>
|
1124 |
|
|
</tr>
|
1125 |
|
|
<tr>
|
1126 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 2</font></font></td>
|
1127 |
|
|
<td>
|
1128 |
|
|
|
1129 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
1130 |
|
|
<tbody>
|
1131 |
|
|
<tr>
|
1132 |
|
|
<td>
|
1133 |
|
|
|
1134 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Resolution</font></font></center>
|
1135 |
|
|
|
1136 |
|
|
</td>
|
1137 |
|
|
</tr>
|
1138 |
|
|
|
1139 |
|
|
|
1140 |
|
|
</tbody>
|
1141 |
|
|
|
1142 |
|
|
</table>
|
1143 |
|
|
</td>
|
1144 |
|
|
</tr>
|
1145 |
|
|
<tr>
|
1146 |
|
|
<td><font face="Arial,Helvetica"><font size="-1">Byte 3 </font></font></td>
|
1147 |
|
|
<td>
|
1148 |
|
|
|
1149 |
|
|
<table width="100%" border="1" cellpadding="0" cellspacing="0" cols="1">
|
1150 |
|
|
|
1151 |
|
|
<tbody>
|
1152 |
|
|
<tr>
|
1153 |
|
|
<td>
|
1154 |
|
|
|
1155 |
|
|
<center><font face="Arial,Helvetica"><font size="-1">Sample
|
1156 |
|
|
Rate</font></font></center>
|
1157 |
|
|
</td>
|
1158 |
|
|
</tr>
|
1159 |
|
|
|
1160 |
|
|
|
1161 |
|
|
</tbody>
|
1162 |
|
|
|
1163 |
|
|
</table>
|
1164 |
|
|
</td>
|
1165 |
|
|
|
1166 |
|
|
</tr>
|
1167 |
|
|
|
1168 |
|
|
</tbody>
|
1169 |
|
|
</table>
|
1170 |
|
|
|
1171 |
|
|
<p><i>Right, Middle, Left Btn</i> = 1 if button pressed; 0 if button
|
1172 |
|
|
is not pressed. <br>
|
1173 |
|
|
<i>Scaling</i> = 1 if scaling is 2:1; 0 if scaling is 1:1.
|
1174 |
|
|
(See commands E7h and E6h) <br>
|
1175 |
|
|
<i>Enable</i> = 1 if data reporting is enabled; 0 if data
|
1176 |
|
|
reporting is disabled. (See commands F5h and F4h) <br>
|
1177 |
|
|
|
1178 |
|
|
<i>Mode</i> = 1 if Remote Mode is enabled; 0 if Stream mode
|
1179 |
|
|
is enabled. (See commands F0h and EAh) <br>
|
1180 |
|
|
</p>
|
1181 |
|
|
|
1182 |
|
|
</ul>
|
1183 |
|
|
<li> E8h (Set Resolution) - The mouse responds with acknowledge (FAh)
|
1184 |
|
|
then reads one byte from the host and again responds with acknowledge (FAh)
|
1185 |
|
|
then resets its movement counters. The byte read from the host determines
|
1186 |
|
|
the resolution as follows: </li>
|
1187 |
|
|
<br>
|
1188 |
|
|
|
1189 |
|
|
|
1190 |
|
|
<center>
|
1191 |
|
|
<table width="300" border="1">
|
1192 |
|
|
<tbody>
|
1193 |
|
|
<tr>
|
1194 |
|
|
<td>
|
1195 |
|
|
<center>Byte Read from Host</center>
|
1196 |
|
|
</td>
|
1197 |
|
|
<td>
|
1198 |
|
|
<center>Resolution</center>
|
1199 |
|
|
|
1200 |
|
|
</td>
|
1201 |
|
|
</tr>
|
1202 |
|
|
<tr>
|
1203 |
|
|
<td>
|
1204 |
|
|
<center>0x00</center>
|
1205 |
|
|
</td>
|
1206 |
|
|
<td>
|
1207 |
|
|
<center>1 count/mm</center>
|
1208 |
|
|
</td>
|
1209 |
|
|
|
1210 |
|
|
</tr>
|
1211 |
|
|
<tr>
|
1212 |
|
|
<td>
|
1213 |
|
|
<center>0x01</center>
|
1214 |
|
|
</td>
|
1215 |
|
|
<td>
|
1216 |
|
|
<center>2 count/mm</center>
|
1217 |
|
|
</td>
|
1218 |
|
|
</tr>
|
1219 |
|
|
|
1220 |
|
|
<tr>
|
1221 |
|
|
<td>
|
1222 |
|
|
<center>0x02</center>
|
1223 |
|
|
</td>
|
1224 |
|
|
<td>
|
1225 |
|
|
<center>4 count/mm</center>
|
1226 |
|
|
</td>
|
1227 |
|
|
</tr>
|
1228 |
|
|
<tr>
|
1229 |
|
|
|
1230 |
|
|
<td>
|
1231 |
|
|
<center>0x03</center>
|
1232 |
|
|
</td>
|
1233 |
|
|
<td>
|
1234 |
|
|
<center>8 count/mm</center>
|
1235 |
|
|
</td>
|
1236 |
|
|
</tr>
|
1237 |
|
|
|
1238 |
|
|
</tbody>
|
1239 |
|
|
</table>
|
1240 |
|
|
|
1241 |
|
|
</center>
|
1242 |
|
|
|
1243 |
|
|
</ul>
|
1244 |
|
|
|
1245 |
|
|
<ul>
|
1246 |
|
|
<li> E7h (Set Scaling 2:1) - The mouse responds with acknowledge (FAh)
|
1247 |
|
|
then enables 2:1 scaling (discussed earlier in this document.)</li>
|
1248 |
|
|
<li> E6h (Set Scaling 1:1) - The mouse responds with acknowledge (FAh)
|
1249 |
|
|
then enables 1:1 scaling (discussed earlier in this document.)</li>
|
1250 |
|
|
|
1251 |
|
|
</ul>
|
1252 |
|
|
The only commands the standard PS/2 mouse will send to the host are
|
1253 |
|
|
the "Resend" (FEh) and "Error" (FCh). They both work the same as they
|
1254 |
|
|
do as host-to-device commands.
|
1255 |
|
|
|
1256 |
|
|
<p><b>Initialization:</b> </p>
|
1257 |
|
|
|
1258 |
|
|
<p>The PS/2 mouse is normally detected/initialized only when the computer
|
1259 |
|
|
is booting up. That is, the mouse is not hot-pluggable and you must
|
1260 |
|
|
restart your computer whenever you add/remove a PS/2 mouse (furthermore,
|
1261 |
|
|
some motherboards may be damaged if you add/remove a PS/2 mouse while the
|
1262 |
|
|
computer is running.) </p>
|
1263 |
|
|
|
1264 |
|
|
<p>The initial detection of the PS/2 mouse occurrs during POST. If
|
1265 |
|
|
a mouse is detected, the BIOS will allow the operating system to configure/enable
|
1266 |
|
|
the mouse. Otherwise, it will inhibit communication on the mouse's
|
1267 |
|
|
bus. If you boot the computer with a mouse attached, then detach/reattach
|
1268 |
|
|
the mouse while in Windows, the OS <i>may</i> be able to detect the mouse
|
1269 |
|
|
was reattached. Microsoft tried to support this, but it only works
|
1270 |
|
|
about 50% of the time. </p>
|
1271 |
|
|
|
1272 |
|
|
|
1273 |
|
|
<p>The following is the communication between my computer (running Win98SE)
|
1274 |
|
|
and mouse when it boots up with a standard PS/2 mouse attached. It
|
1275 |
|
|
is fairly typical of how a PS/2 mouse is initialized and if you want to
|
1276 |
|
|
emulate a PS/2 mouse it must (at minimum) be able to support the following
|
1277 |
|
|
sequence of commands... </p>
|
1278 |
|
|
|
1279 |
|
|
<ul>
|
1280 |
|
|
<li> <tt>Power-on Reset:</tt></li>
|
1281 |
|
|
<br>
|
1282 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1283 |
|
|
|
1284 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1285 |
|
|
<tt>Host: FF Reset command</tt><br>
|
1286 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1287 |
|
|
|
1288 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1289 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1290 |
|
|
<tt>Host: FF Reset command</tt><br>
|
1291 |
|
|
|
1292 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1293 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1294 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1295 |
|
|
<tt>Host: FF Reset command</tt><br>
|
1296 |
|
|
|
1297 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1298 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1299 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1300 |
|
|
<tt>Host: F3 Set Sample Rate : Attempt to Enter
|
1301 |
|
|
Microsoft</tt><br>
|
1302 |
|
|
|
1303 |
|
|
<tt>Mouse: FA Acknowledge
|
1304 |
|
|
: Scrolling Mouse mode</tt><br>
|
1305 |
|
|
<tt>Host: C8 decimal 200
|
1306 |
|
|
:</tt><br>
|
1307 |
|
|
|
1308 |
|
|
<tt>Mouse: FA Acknowledge
|
1309 |
|
|
:</tt><br>
|
1310 |
|
|
<tt>Host: F3 Set Sample Rate :</tt><br>
|
1311 |
|
|
|
1312 |
|
|
<tt>Mouse: FA Acknowledge
|
1313 |
|
|
:</tt><br>
|
1314 |
|
|
<tt>Host: 64 decimal 100
|
1315 |
|
|
:</tt><br>
|
1316 |
|
|
|
1317 |
|
|
<tt>Mouse: FA Acknowledge
|
1318 |
|
|
:</tt><br>
|
1319 |
|
|
<tt>Host: F3 Set Sample Rate :</tt><br>
|
1320 |
|
|
|
1321 |
|
|
<tt>Mouse: FA Acknowledge
|
1322 |
|
|
:</tt><br>
|
1323 |
|
|
<tt>Host: 50 decimal 80
|
1324 |
|
|
:</tt><br>
|
1325 |
|
|
|
1326 |
|
|
<tt>Mouse: FA Acknowledge
|
1327 |
|
|
:</tt><br>
|
1328 |
|
|
<tt>Host: F2 Read Device Type :</tt><br>
|
1329 |
|
|
|
1330 |
|
|
<tt>Mouse: FA Acknowledge
|
1331 |
|
|
:</tt><br>
|
1332 |
|
|
<tt>Mouse: 00 Mouse ID
|
1333 |
|
|
: Response 03 if microsoft scrolling mouse</tt><br>
|
1334 |
|
|
<tt>Host: F3 Set Sample Rate </tt><br>
|
1335 |
|
|
|
1336 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1337 |
|
|
<tt>Host: 0A decimal 10</tt><br>
|
1338 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1339 |
|
|
|
1340 |
|
|
<tt>Host: F2 Read Device Type</tt><br>
|
1341 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1342 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1343 |
|
|
|
1344 |
|
|
<tt>Host: E8 Set resolution</tt><br>
|
1345 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1346 |
|
|
<tt>Host: 03 8 Counts/mm</tt><br>
|
1347 |
|
|
|
1348 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1349 |
|
|
<tt>Host: E6 Set Scaling 1:1</tt><br>
|
1350 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1351 |
|
|
|
1352 |
|
|
<tt>Host: F3 Set Sample Rate</tt><br>
|
1353 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1354 |
|
|
<tt>Host: 28 decimal 40</tt><br>
|
1355 |
|
|
|
1356 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1357 |
|
|
<tt>Host: F4 Enable</tt><br>
|
1358 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1359 |
|
|
|
1360 |
|
|
<tt>Initialization complete...</tt>
|
1361 |
|
|
<p><tt>If I then press the Left Button...</tt> <br>
|
1362 |
|
|
<tt>Mouse: 09 1 1 00001001; bit0 = Left button state; bit3 =
|
1363 |
|
|
always 1</tt> <br>
|
1364 |
|
|
<tt>Mouse: 00 1 1 No X-movement</tt> <br>
|
1365 |
|
|
<tt>Mouse: 00 1 1 No Y-movement</tt> <br>
|
1366 |
|
|
|
1367 |
|
|
<tt>... and release the Left Button:</tt> <br>
|
1368 |
|
|
<tt>Mouse: 08 0 1 00001000 bit0 = Left button state; bit3 =
|
1369 |
|
|
always 1</tt> <br>
|
1370 |
|
|
<tt>Mouse: 00 1 1 No X-movement</tt> <br>
|
1371 |
|
|
<tt>Mouse: 00 1 1 No Y-movement</tt></p>
|
1372 |
|
|
|
1373 |
|
|
</ul>
|
1374 |
|
|
|
1375 |
|
|
The following is the communication between my computer (running Win98SE)
|
1376 |
|
|
and mouse when it boots up with an (emulated) Intellimouse...
|
1377 |
|
|
|
1378 |
|
|
<ul>
|
1379 |
|
|
<li> <tt>Power-on Reset:</tt></li>
|
1380 |
|
|
<br>
|
1381 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1382 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1383 |
|
|
|
1384 |
|
|
<tt>Host: FF Reset command</tt><br>
|
1385 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1386 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1387 |
|
|
|
1388 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1389 |
|
|
<tt>Host: FF Reset command</tt><br>
|
1390 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1391 |
|
|
|
1392 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1393 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1394 |
|
|
<tt>Host: FF Reset command</tt><br>
|
1395 |
|
|
|
1396 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1397 |
|
|
<tt>Mouse: AA Self-test passed</tt><br>
|
1398 |
|
|
<tt>Mouse: 00 Mouse ID</tt><br>
|
1399 |
|
|
<tt>Host: F3 Set Sample Rate : Attempt to Enter
|
1400 |
|
|
Microsoft </tt><br>
|
1401 |
|
|
|
1402 |
|
|
<tt>Mouse: FA Acknowledge
|
1403 |
|
|
: Scrolling Mouse mode</tt><br>
|
1404 |
|
|
<tt>Host: C8 decimal 200
|
1405 |
|
|
:</tt><br>
|
1406 |
|
|
|
1407 |
|
|
<tt>Mouse: FA Acknowledge
|
1408 |
|
|
:</tt><br>
|
1409 |
|
|
<tt>Host: F3 Set Sample Rate :</tt><br>
|
1410 |
|
|
|
1411 |
|
|
<tt>Mouse: FA Acknowledge
|
1412 |
|
|
:</tt><br>
|
1413 |
|
|
<tt>Host: 64 decimal 100
|
1414 |
|
|
:</tt><br>
|
1415 |
|
|
|
1416 |
|
|
<tt>Mouse: FA Acknowledge
|
1417 |
|
|
:</tt><br>
|
1418 |
|
|
<tt>Host: F3 Set Sample Rate :</tt><br>
|
1419 |
|
|
|
1420 |
|
|
<tt>Mouse: FA Acknowledge
|
1421 |
|
|
:</tt><br>
|
1422 |
|
|
<tt>Host: 50 decimal 80
|
1423 |
|
|
:</tt><br>
|
1424 |
|
|
|
1425 |
|
|
<tt>Mouse: FA Acknowledge
|
1426 |
|
|
:</tt><br>
|
1427 |
|
|
<tt>Host: F2 Read Device Type :</tt><br>
|
1428 |
|
|
|
1429 |
|
|
<tt>Mouse: FA Acknowledge
|
1430 |
|
|
:</tt><br>
|
1431 |
|
|
<tt>Mouse: 03 Mouse ID
|
1432 |
|
|
: Response 03 if microsoft scrolling mouse</tt><br>
|
1433 |
|
|
<tt>Host: E8 Set Resolution </tt><br>
|
1434 |
|
|
|
1435 |
|
|
<tt>Mouse: FA Acknowledge </tt><br>
|
1436 |
|
|
<tt>Host: 03 8 counts/mm</tt><br>
|
1437 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1438 |
|
|
|
1439 |
|
|
<tt>Host: E6 Set scaling 1:1</tt><br>
|
1440 |
|
|
<tt>Dev: FA Acknowledge</tt><br>
|
1441 |
|
|
<tt>Host: F3 Set Sample Rate </tt><br>
|
1442 |
|
|
|
1443 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1444 |
|
|
<tt>Host: 28 decimal 40</tt><br>
|
1445 |
|
|
<tt>Mouse: FA Acknowledge</tt><br>
|
1446 |
|
|
|
1447 |
|
|
<tt>Host: F4 Enable device </tt><br>
|
1448 |
|
|
<tt>Mouse: FA Acknowledge</tt>
|
1449 |
|
|
<p><tt>If I then press the left mouse button:</tt> <br>
|
1450 |
|
|
<tt>Mouse: 09 00001001 bit0 = Left button state; bit3
|
1451 |
|
|
= always 1</tt> <br>
|
1452 |
|
|
|
1453 |
|
|
<tt>Mouse: 00 No X-movement</tt> <br>
|
1454 |
|
|
<tt>Mouse: 00 No Y-movement</tt> <br>
|
1455 |
|
|
<tt>Mouse: 00 No Z-movement</tt> </p>
|
1456 |
|
|
|
1457 |
|
|
|
1458 |
|
|
<p><tt>...and then release the left mouse button button:</tt> <br>
|
1459 |
|
|
<tt>Mouse: 08 00001000 bit0 = Left button state; bit3
|
1460 |
|
|
= always 1</tt> <br>
|
1461 |
|
|
<tt>Mouse: 00 No X-movement</tt> <br>
|
1462 |
|
|
<tt>Mouse: 00 No Y-movement</tt> <br>
|
1463 |
|
|
|
1464 |
|
|
<tt>Mouse: 00 No Z-movement</tt></p>
|
1465 |
|
|
|
1466 |
|
|
</ul>
|
1467 |
|
|
<tt>After I downloaded/installed the Microsoft's Intellimouse drivers
|
1468 |
|
|
with support for the 4th and 5th buttons, the following sequence was found:</tt>
|
1469 |
|
|
|
1470 |
|
|
<blockquote><tt>... (starts same as before) ...</tt> <br>
|
1471 |
|
|
<tt>Host: F3 Set Sample Rate : Attempt
|
1472 |
|
|
to Enter Microsoft </tt> <br>
|
1473 |
|
|
|
1474 |
|
|
<tt>Mouse: FA Acknowledge
|
1475 |
|
|
: Scrolling Mouse mode.</tt> <br>
|
1476 |
|
|
<tt>Host: C8 decimal 200
|
1477 |
|
|
:</tt> <br>
|
1478 |
|
|
|
1479 |
|
|
<tt>Mouse: FA Acknowledge
|
1480 |
|
|
:</tt> <br>
|
1481 |
|
|
<tt>Host: F3 Set Sample Rate :</tt>
|
1482 |
|
|
|
1483 |
|
|
<br>
|
1484 |
|
|
<tt>Mouse: FA Acknowledge
|
1485 |
|
|
:</tt> <br>
|
1486 |
|
|
<tt>Host: 64 decimal 100
|
1487 |
|
|
|
1488 |
|
|
:</tt> <br>
|
1489 |
|
|
<tt>Mouse: FA Acknowledge
|
1490 |
|
|
:</tt> <br>
|
1491 |
|
|
<tt>Host: F3 Set Sample Rate :</tt>
|
1492 |
|
|
|
1493 |
|
|
<br>
|
1494 |
|
|
<tt>Mouse: FA Acknowledge
|
1495 |
|
|
:</tt> <br>
|
1496 |
|
|
<tt>Host: 50 decimal 80
|
1497 |
|
|
|
1498 |
|
|
:</tt> <br>
|
1499 |
|
|
<tt>Mouse: FA Acknowledge
|
1500 |
|
|
:</tt> <br>
|
1501 |
|
|
<tt>Host: F2 Read Device Type :</tt> <br>
|
1502 |
|
|
|
1503 |
|
|
<tt>Mouse: FA Acknowledge
|
1504 |
|
|
:</tt> <br>
|
1505 |
|
|
<tt>Mouse: 03 Mouse ID
|
1506 |
|
|
: Response 03 if microsoft scrolling mouse.</tt> <br>
|
1507 |
|
|
|
1508 |
|
|
<tt>Host: F3 Set Sample Rate : Attempt
|
1509 |
|
|
to Enter Microsoft 5-button </tt> <br>
|
1510 |
|
|
<tt>Mouse: FA Acknowledge
|
1511 |
|
|
: Scrolling Mouse mode.</tt> <br>
|
1512 |
|
|
|
1513 |
|
|
<tt>Host: C8 decimal 200
|
1514 |
|
|
:</tt> <br>
|
1515 |
|
|
<tt>Mouse: FA Acknowledge
|
1516 |
|
|
:</tt> <br>
|
1517 |
|
|
|
1518 |
|
|
<tt>Host: F3 Set Sample Rate :</tt>
|
1519 |
|
|
<br>
|
1520 |
|
|
<tt>Mouse: FA Acknowledge
|
1521 |
|
|
:</tt> <br>
|
1522 |
|
|
|
1523 |
|
|
<tt>Host: C8 decimal 200
|
1524 |
|
|
:</tt> <br>
|
1525 |
|
|
<tt>Mouse: FA Acknowledge
|
1526 |
|
|
:</tt> <br>
|
1527 |
|
|
|
1528 |
|
|
<tt>Host: F3 Set Sample Rate :</tt>
|
1529 |
|
|
<br>
|
1530 |
|
|
<tt>Mouse: FA Acknowledge
|
1531 |
|
|
:</tt> <br>
|
1532 |
|
|
|
1533 |
|
|
<tt>Host: 50 decimal 80
|
1534 |
|
|
:</tt> <br>
|
1535 |
|
|
<tt>Mouse: FA Acknowledge
|
1536 |
|
|
:</tt> <br>
|
1537 |
|
|
|
1538 |
|
|
<tt>Host: F2 Read Device Type :</tt> <br>
|
1539 |
|
|
<tt>Mouse: FA Acknowledge
|
1540 |
|
|
:</tt> <br>
|
1541 |
|
|
|
1542 |
|
|
<tt>Mouse: 04 Mouse ID
|
1543 |
|
|
: Response 04 if 5-button scrolling mouse.</tt> <br>
|
1544 |
|
|
<tt>... rest of initialization same as before ...</tt></blockquote>
|
1545 |
|
|
<b>Emulation/Interfacing:</b>
|
1546 |
|
|
<ul>
|
1547 |
|
|
<li> Click here for routines that emulate a PS/2 mouse or keyboard</li>
|
1548 |
|
|
|
1549 |
|
|
<li> Click here for routines that emulate a PS/2 host (ie, interface
|
1550 |
|
|
a mouse/keyboard)</li>
|
1551 |
|
|
<li> Click <a href="http://panda.cs.ndsu.nodak.edu/%7Eachapwes/PICmicro/code/Projects/mouse/ps2mouse.html">here</a>
|
1552 |
|
|
for a fully-functional PS/2 mouse written for the PIC16F</li>
|
1553 |
|
|
|
1554 |
|
|
</ul>
|
1555 |
|
|
|
1556 |
|
|
<blockquote>
|
1557 |
|
|
<ul>
|
1558 |
|
|
|
1559 |
|
|
|
1560 |
|
|
</ul>
|
1561 |
|
|
</blockquote>
|
1562 |
|
|
|
1563 |
|
|
<p><a name="Footnotes"></a><b>Footnotes:</b> </p>
|
1564 |
|
|
|
1565 |
|
|
<blockquote>1) 2:1 scaling only applies to the automatic data reporting in
|
1566 |
|
|
Stream mode. It does not effect the reported data sent in response to the
|
1567 |
|
|
"Read Data" command.
|
1568 |
|
|
<p>2) The mouse and host do not buffer "Resend" commands. This means
|
1569 |
|
|
"Resend" will never be sent in response to the "Resend" command.
|
1570 |
|
|
</p>
|
1571 |
|
|
|
1572 |
|
|
<p>3) A "packet" may be a 3-byte movement data packet, a 4-byte
|
1573 |
|
|
movement data packet (for the Intellimouse), a 3-byte status packet (see
|
1574 |
|
|
"Status Request" command) a 2-byte completion-code-ID packet (AAh,00h or
|
1575 |
|
|
FCh,00h), or a 1-byte response to a command.<br>
|
1576 |
|
|
|
1577 |
|
|
</p>
|
1578 |
|
|
</blockquote>
|
1579 |
|
|
<br>
|
1580 |
|
|
<br>
|
1581 |
|
|
</body></html>
|