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
Jeko

PS/2 Mouse

Post by Jeko »

I'm trying to program the PS/2 Mouse. I readed a tutorial and I wrote my code, but it doesn't work. Then I tried to read some open source code, but they don't work. How can I program my PS/2 Mouse?
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:PS/2 Mouse

Post by Pype.Clicker »

we have code that works in the "MouseInput" page of the FAQ (iirc), but if every tutorial you found so far didn't work, i fear either there's something going wrong with your setup (e.g. INTs disabled/not properly mapped) or with your hardware.

I'd suggest you grab any OS that has mouse support in the "test" forum and check it works at your place. then compare what they do with what you did and see where's the mismatch...

or you could try to be more specific on what "doesn't work", what tutorial you've been following, etc.
User avatar
ces_mohab
Member
Member
Posts: 77
Joined: Wed Oct 18, 2006 3:08 am

Re:PS/2 Mouse

Post by ces_mohab »

Personally I have grabbed over more than 6 mouse drivers and all didn't work. I walked here and there. Revised all ISR routines. Till after 3 weeks I discovered by luck that the function set lights in key board driver initialization is the reason.
I don't know exactly the reason. This function is taken from Minix. But it works when mouse disabled.
To write an OS you need 2 minds one for coding and other for debugging.
Jeko

Re:PS/2 Mouse

Post by Jeko »

I don't have the link of the tutorial.
However I readed the code of the ps2 mouse driver from linux 1.0 and mobius, and they don't work.
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:PS/2 Mouse

Post by Pype.Clicker »

what do you mean with "don't work" ?
you see no moving cursor?
you receive nothing but garbage?
you don't even receive a single IRQ for the mouse?

And what's your kernel environment doing atm?
do you have working IDT? where did you map IRQs?
are you dev'ing in realmode or protected mode?
do you have other pieces of code that deal with keyboard controller (leds, keyboard scanning, A20 gate, whatever) which could possibly mess with the mouse stuff?
User avatar
ces_mohab
Member
Member
Posts: 77
Joined: Wed Oct 18, 2006 3:08 am

Re:PS/2 Mouse

Post by ces_mohab »

And I have another question
after enabling mouse do you receive keyboard interupt.
And if no do you recieve other IRQ interupts. timer for example.
This is a nice working mouse code
http://www.mega-tokyo.com/forum/index.php?board=1;action=display;threadid=7336
To write an OS you need 2 minds one for coding and other for debugging.
Jeko

Re:PS/2 Mouse

Post by Jeko »

I resolved the problem, my ps/2 mouse works at IRQ2.
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:PS/2 Mouse

Post by Pype.Clicker »

this is the "cascading" IRQ -- e.g. every interrupt above IRQ7 is delivered through IRQ2. you normally let it masked and "listen" to IRQ12 instead ... i'd say there's something wrong with your PIC programming code (either you left IRQ12 masked, or you failed to map it to the proper handler).

<Hint> see The FAQ for proper remapping code</Hint>
Post Reply