Mouse Input: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
add a lot of text ( tables, whole command list..) and add some definations, however non clean up on structure ..
Creature (talk | contribs)
m Corrected some grammar mistakes.
Line 1: Line 1:
==PC Mouse Interfaces==
==PC Mouse Interfaces==

Current PCs generally use PS2 mice, or a similar format that emulates a PS2 mouse. Serial mice are a much
Current PCs generally use PS2 mice, or a similar format that emulates a PS2 mouse. Serial mice are a much
older technology that is no longer common.
older technology that is no longer common.


===USB Mouse===
===USB Mouse===

A USB mouse generally emulates a PS2 mouse, except that it generates IRQs from the USB bus, and not IRQ 12.
A USB mouse generally emulates a PS2 mouse, except that it generates IRQs from the USB bus, and not IRQ 12.


===PS2 Mouse -- Basic Operation (Microsoft compliant)===
===PS2 Mouse -- Basic Operation (Microsoft compliant)===

Once a mouse has been initialized (see below), a mouse sends 3 or 4 byte packets to communicate mouse
Once a mouse has been initialized (see below), a mouse sends 3 or 4 byte packets to communicate mouse
movement, and mouse button press/release events. These packets show up asynchronously as data on IO port 0x60.
movement, and mouse button press/release events. These packets show up asynchronously as data on IO port 0x60.
Line 161: Line 158:


===PS2 Mouse Commands===
===PS2 Mouse Commands===
After the PS2 Aux port has been enabled, you can send commands to the mouse. It is recommended to disable packets while "reprogramming" the mouse.


====Waiting to Send Bytes to Port 0x60 and 0x64====
After the PS2 Aux port has been enabled, you can send commands to the mouse. It is Recommended to disable packets while "re"programming the mouse.
All output to port 0x60 or 0x64 must be preceded by waiting for bit 1 (value=2) of port 0x64 to become clear. Similarly, bytes cannot be read from port 0x60 until bit 0 (value=1) of port 0x64 is set. See [[PS2 Keyboard]] for further details.

====Waiting to Send Bytes to Port 60 and 64====
All output to port 0x60 or 0x64 must be preceded by waiting for bit number 1 (value=2) of port 0x64 to clear.
Similarly, bytes cannot be read from port 0x60 until bit number 0 (value=1) of port 0x64 is set. See [[PS2 Keyboard]] for further details.


====0xD4 Byte and Command Byte====
====0xD4 Byte and Command Byte====
Line 174: Line 169:


====Wait for ACK from Mouse====
====Wait for ACK from Mouse====
It is required to wait until the mouse sends back a 0xFA acknowledgement byte, after each command byte,
It is required to wait until the mouse sends back the 0xFA acknowledgement byte after each command byte before sending the next 0xD4 (Note: reset commands might not be ACK'ed -- wait for the 0xAA after a reset).
before sending the next 0xD4. (Note: reset commands might not be ACK'ed -- wait for the 0xAA after a reset.)
Some commands generate 2 ACK, 1 for the command, and 1 for receiving data.

Some commands generate 2 ACK, 1 for the command, and 1 for reciving data.
====Mouse Command Set====
====Mouse Command Set====


{| border="1" cellspacing="0" cellpadding="5" align="center"
{| border="1" cellspacing="0" cellpadding="5" align="center"
! Hex value
! Hex value
! Meaning
! Meaning
! Description
! Describing
|-
|-
! 0xFF
! 0xFF