keyboard issues

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
raj
Posts: 3
Joined: Sun Mar 25, 2012 1:17 pm

keyboard issues

Post 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
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: keyboard issues

Post by bubach »

"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: keyboard issues

Post 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.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
raj
Posts: 3
Joined: Sun Mar 25, 2012 1:17 pm

Re: keyboard issues

Post 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
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: keyboard issues

Post 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.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: keyboard issues

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
raj
Posts: 3
Joined: Sun Mar 25, 2012 1:17 pm

Re: keyboard issues

Post 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
invalid
Member
Member
Posts: 60
Joined: Thu Feb 23, 2012 8:39 am

Re: keyboard issues

Post 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 :)
Post Reply