Page 1 of 1

PS/2 Mouse

Posted: Tue Oct 10, 2006 4:14 am
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?

Re:PS/2 Mouse

Posted: Tue Oct 10, 2006 7:42 am
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.

Re:PS/2 Mouse

Posted: Tue Oct 10, 2006 8:31 am
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.

Re:PS/2 Mouse

Posted: Tue Oct 10, 2006 9:17 am
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.

Re:PS/2 Mouse

Posted: Tue Oct 10, 2006 10:26 am
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?

Re:PS/2 Mouse

Posted: Tue Oct 10, 2006 2:01 pm
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

Re:PS/2 Mouse

Posted: Wed Oct 11, 2006 3:58 am
by Jeko
I resolved the problem, my ps/2 mouse works at IRQ2.
Why?

Re:PS/2 Mouse

Posted: Wed Oct 11, 2006 4:38 am
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>