how can i read data from 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
iamxiaohan

how can i read data from mouse?

Post by iamxiaohan »

hi, now, i think i can intial the mouse via program the 8042.
but i can read data from mouse:(
if i don't move the mouse, i can read the keyboard data from the port 0x60 .
but if i move the mouse even only one time, i can't read any data. i hit the keyboard, and the bochs reports that: the keyboard's buffer is full. but i can't read data from 0x60 now,that's very strange!
what can i do?
thank you very much!
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:how can i read data from mouse?

Post by Pype.Clicker »

don't try to read more values from the 8042 than available (you can know it by probing the status register (0x64 iirc). The 8042 will not always have 3 bytes of mouse data ready when IRQ12 is fired, but it's guaranteed to have at least 1 byte of such data.

Also, make sure you receive and acknowledge the IRQ first (check my answer in your other post.

btw, if you can avoid posting in multiple threads for a single problem ;)
iamxiaohan

Re:how can i read data from mouse?

Post by iamxiaohan »

thank you very much! :)
iamxiaohan

Re:how can i read data from mouse?

Post by iamxiaohan »

now, i can fire the irq12 by mouse, but when i move or click the mouse, the boches will shut down :(
why?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:how can i read data from mouse?

Post by Pype.Clicker »

chances are that you're mishandling IRQ, then. usually, only triple-faults will restart the Bochs.
iamxiaohan

Re:how can i read data from mouse?

Post by iamxiaohan »

yes, i forget map the irq.
now it can work will!
thank you very much!!!!:)
Post Reply