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.
I am currently in the process of writing a keyboard driver. My current implementation simply listens on IRQ1 and prints the hex value of the scancodes it reads. Code:
This works fine and as advertised for most keys, but some do not print anything. The numpad keys, other than numlock and enter, do not respond, and neither do the windows-logo keys or the context-menu key. How do I get these keys to respond properly?
Your code looks perfectly alright. Hence, we need to have a look at the code surrounding your irq handler. The function that calls it, the printf function and inportb. Again, chances are pretty less that there might be trouble in these functions too.
It works for most keys, no? So I would think that a problem with my IRQ handling, my inportb or my printf that only failed to pass the numpad keys would be pretty unlikely.
I have just verified that, in fact, the numpad keys don't work in my host OS either, and instead seem to move the mouse cursor. (?) It might be relevant that on the computer I test on, both keyboard and mouse are plugged into a PS/2 to USB adapter. And when I test it on another computer, whose kb/mouse are connected via PS/2, it works. So I guess this is not a software problem.
And when I test it on another computer, whose kb/mouse are connected via PS/2, it works.
Would you mind reading before posting a reply?
only failed to pass the numpad keys
Interesting that those are codes normally prefixed with e0 - I wonder if the combination of that and USB might have something to do with it, but I don't see anything in the shown code that might explain that behavior (please post the full code)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
The numpad keys are fixed--turns out it was some obscure X setting that kidnapped the numpad keys for mouseless control of the cursor. None of the 'Windows-specific' keys work, even on hardware.