Page 1 of 1

keyboard issues

Posted: Sun Mar 25, 2012 1:31 pm
by raj
i am sorry if i am asking silly question. i want my kernel to scan keyboard codes.I have setup idt and remapped pit and the software interrupts are working how to proceed now. I have searched over the internet but they were confusing

Re: keyboard issues

Posted: Sun Mar 25, 2012 2:23 pm
by bubach

Re: keyboard issues

Posted: Sun Mar 25, 2012 2:28 pm
by DavidCooper
Two clicks took me to this page in the wiki: http://wiki.osdev.org/PS2_Keyboard. Have you read it yet? If so, please explain the point you're getting stuck at. It all looks complicated when you're new to it and it looks easy once you've got your head round it, so it's hard for anyone to know how to help you unless you're very specific about where the difficulty is.

Re: keyboard issues

Posted: Mon Mar 26, 2012 7:21 am
by raj
i have already read those tutorials the problem is i am confused what to do to scan the codes from keyboard i have a keyboard handler which can scan appropriate code. Should i have to enable the keyboard controller or anything else.In my kernel i have software interrupts working when i call through int opcode any suggestions how to link these irq with the keyboard

Re: keyboard issues

Posted: Mon Mar 26, 2012 8:59 am
by bubach
Did you really read it? If so, re-read it.
Brokenthorn Keyboard tutorial wrote:Keyboard Interfacing: Interrupt Request (IRQ)
Remember from the PIC tutorial that the keyboard controller can be configured to use an interrupt line? We can configure the keyboard controller to issue IRQ 1 whenever a key has been pressed or released. This is the most common way to interface with the keyboard.

Whenever IRQ 1 is fired, you should always test to see if a scan code has actually been sent to the keyboard controller. This is done by polling the keyboard controller to get the last scan code.
To me that's pretty clear. You set up the keyboard interrupt (IRQ 1) to fire whenever a key is pressed. Inside the keyboard interrupt handler you use the ports described to read out the scan code. You could then print the scan code directly to screen for testing or try and convert it to an ASCII char first with a key map.

Re: keyboard issues

Posted: Mon Mar 26, 2012 11:47 am
by Brendan
Hi,
raj wrote:i have already read those tutorials the problem is i am confused what to do to scan the codes from keyboard i have a keyboard handler which can scan appropriate code. Should i have to enable the keyboard controller or anything else.In my kernel i have software interrupts working when i call through int opcode any suggestions how to link these irq with the keyboard
I've been rewriting those pages in the last few days, so I'm not sure which version you've read (the old version, the new version, or something in between).

You'd probably want to start at the PS/2 protocol, then read about the "8042" PS/2 controller used in 80x86 machines and write a driver for the controller, and then read about the PS/2 keyboard itself.


Cheers,

Brendan

Re: keyboard issues

Posted: Mon Mar 26, 2012 8:42 pm
by raj
Thank you very much for the suggestions :D
I now got where i went wrong i used oxFF to mask the interrupts
I thought 1's instead of 0's

Re: keyboard issues

Posted: Tue Mar 27, 2012 9:38 am
by invalid
raj wrote:Thank you very much for the suggestions :D
I now got where i went wrong i used oxFF to mask the interrupts
I thought 1's instead of 0's
Damn details, they can really halt you for good. But then, you will always remember this detail after hours of smoking cigarettes, cursing, and furious debugging :)