PS/2 mouse

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ComputerPsi

PS/2 mouse

Post by ComputerPsi »

I'm writing a driver for PS/2 mouse and having problems talking with it. I think I'm sending the wrong commands through the keyboard, but I'm not sure. Can anybody help? From what I read, I first have to send 0xD4 to port 0x64, then whatever command to port 0x60. Each time I check the port 0x64's state at bit 2. Then, I read from port 0x60 for the answer. Is this correct?
When I tried sending 0xEE (Echo), I got 0xFA in return... (I'm supposed to get 0xEE). Interrupts are disabled. What am I doing wrong?

ComputerPsi
blip

Re:PS/2 mouse

Post by blip »

You got the correct response to the 0xEE command. On keyboards it means echo 0xEE back but on mice it means Set Wrap Mode and the mouse acknowledges with 0xFA.
ComputerPsi

Re:PS/2 mouse

Post by ComputerPsi »

Wow.. I just noticed that.. okay.. I want to see if this is completely working. Is there a command that does not respond with 0xFA?
blip

Re:PS/2 mouse

Post by blip »

All commands are acknowledged with 0xFA except 0xEE on a keyboard but they may give further data. 0xF2 requests the device ID which should be 0x00 if you're not enabling extra features. Also in wrap mode you can send any bytes except the commands corresponding to Reset (0xFF) and Reset Wrap Mode (0xEC) and it will be echoed back.

http://computer-engineering.org/
http://heim.ifi.uio.no/~stanisls/helppc/ (Hardware->KBC or Keyboard)
Post Reply