PS/2 Mouse: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
→Z-axis: Simplified mouse data packet table |
m Bot: Replace deprecated source tag with syntaxhighlight |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 15:
! Byte !! Data byte !! Description
|-
|
|-
|
|-▼
| 0xF6 || None || Set Defaults▼
|-▼
| 0xF5 || None || Disable Data Reporting▼
|-▼
| 0xF4 || None || Enable Data Reporting▼
|-▼
| 0xF3▼
| Sample rate▼
| Set Sample Rate, valid values are 10, 20, 40, 60, 80, 100, and 200.▼
|-▼
| 0xF2▼
| None▼
| Get Device ID. See [["8042" PS/2 Controller#Detecting PS/2 Device Types|Detecting PS/2 Device Types]] for the response bytes.▼
|-▼
| 0xF0 || None || Set Remote Mode▼
|-▼
| 0xEE || None || Set Wrap Mode▼
|-▼
| 0xEC || None || Reset Wrap Mode▼
|-▼
| 0xEB || None || Read Data▼
|-▼
| 0xEA || None || Set Stream Mode▼
|-▼
|-
| 0xE8
Line 66 ⟶ 40:
| Set Resolution
|-
|
|-
|
▲|-
▲| 0xEB || None || Read Data
▲|-
▲| 0xEC || None || Reset Wrap Mode
▲|-
▲| 0xEE || None || Set Wrap Mode
▲|-
▲| 0xF0 || None || Set Remote Mode
▲|-
▲| 0xF2
▲| None
▲| Get Device ID. See [["8042" PS/2 Controller#Detecting PS/2 Device Types|Detecting PS/2 Device Types]] for the response bytes.
▲|-
▲| 0xF3
▲| Sample rate
▲| Set Sample Rate, valid values are 10, 20, 40, 60, 80, 100, and 200.
▲|-
▲| 0xF4 || None || Enable Data Reporting
▲|-
▲| 0xF5 || None || Disable Data Reporting
▲|-
▲| 0xF6 || None || Set Defaults
▲|-
▲|-
| 0xFF || None || Reset ('''Note: After the result of the power-on test is sent, the mouse sends its ID (0x00)''')
|-
|}
Line 107:
|}
Each X and Y axis value is relative. The mouse device does not track
<pre>
mouse_x = mouse_x + mouse_packet_rel_x
Line 127:
To set the sample rate for example, which is a command with a data byte, one would need to do:
<
outb(0xD4, 0x64); // tell the controller to address the mouse
outb(0xF3, 0x60); // write the mouse command code to the controller's data port
Line 136:
while(!(inb(0x64) & 1) asm("pause"); // wait until we can read
ack = inb(0x60); // read back acknowledge. This should be 0xFA
</syntaxhighlight>
== Mouse Extensions ==
Line 149:
To enable the Intellimouse Z-axis extension, you have to set some magic into the sample rate:
<
set_mouse_rate(200); // see the example above
set_mouse_rate(100);
set_mouse_rate(80);
mouseid = identify(); // see Get Device ID, 0xF2
</syntaxhighlight>
After that the mouse should not return Mouse ID ''0'', but ''3'', and will send 4 bytes data packages as follows:
Line 175:
To enable the 4th and 5th buttons, first you have to try to enable Z-axis, and you can only follow with this if the identification returned ''3''.
<
if(mouseid == 3) {
set_mouse_rate(200);
Line 182:
mouseid = identify();
}
</syntaxhighlight>
If this was successful, the identify command should now return Mouse ID ''4'', and the 4 bytes packets will look like this:
{| class="wikitable"
Line 189:
! BYTE!!7!!6!!5!!4!!3!!2!!1!!0
|- align="center"
| 0 || yo || xo || ys || xs ||
|- align="center"
| 1 || colspan="8" |
|- align="center"
| 2 || colspan="8" |
|- align="center"
| 3 || 0 || 0 ||
|}
Here the
=== Emulation ===
Line 225:
[[Category:Human Interface Device]]
[[Category:Common Devices]]
[[Category:Hardware Interfaces]]
|