PS2 mouse and keyboard interrupt handling

Hi guys, i have a small problem.
I have to code my own interrupt handler for keyboard and mouse.
The problem is that PS2 mouse and keyboard both uses IRQ1,
so when interrupt INT 09 is started i dont know which device
initialize this interrupt.
Is there anybody who can help me how can i recognize which device initialize this interrupt?


Comments

  • : Hi guys, i have a small problem.
    : I have to code my own interrupt handler for keyboard and mouse.
    : The problem is that PS2 mouse and keyboard both uses IRQ1,
    : so when interrupt INT 09 is started i dont know which device
    : initialize this interrupt.
    : Is there anybody who can help me how can i recognize which device initialize this interrupt?
    [green]
    Procedures I've seen to find if something is using an interrupt
    kinda goes like this pseudo code:
    #1. HI-jack an interrupt by hooking it but don't call the original interrupt from within your routine.
    #2. Then force the device to issue an interrupt, restore original int,
    & check to see if your INT routine was called.
    If it was, you've found the interrupt.

    So your INT routine would just move a known value into a declaired byte
    in your program & end the INT with an (EOI? &) IRET.
    You check to see if the DB has the NEW value after the INT was forced.

    I made a hook proc & restore proc then a loop that
    HOOK INT, FORCE IRQ INT, RESTORE INT, CHECK DB VALUE
    INC INT# & LOOP
    untill I found the interrupt the sound blaster was using.

    In a plug and play OS the INT could vary, so this software finding system is fairly reliable I believe?????

    This kind of use once code can be in a buffer area and overwritten with data after program init at startup.

    How you force the keyboard or mouse to issue an INT/IRQ#
    I don't know with out looking it up.

    If you need info on interrupt hooking/restoring, routine writing, or ? just ask.

    Hopefully other can fill in the blanks I left out or explained incorrectly.
    Bitdog
    [/green]

  • : Hi guys, i have a small problem.
    : I have to code my own interrupt handler for keyboard and mouse.
    : The problem is that PS2 mouse and keyboard both uses IRQ1,
    : so when interrupt INT 09 is started i dont know which device
    : initialize this interrupt.
    : Is there anybody who can help me how can i recognize which device initialize this interrupt?
    :
    :
    :
    reading i/o port 60h should provide a difference between a keyboard and mouse event. Ralph brown says it's BIT5 (mouse output buffer full), but you should do some experimenting with ports 60 and 64 to see for sure.

    You could also pour through this code:
    http://cutemouse.sourceforge.net/

    and see how the cutemouse driver figures out if it's a keyboard or mouse event.

    -jeff!

    -jeff!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories