Page 1 of 1

Keyboard Interrupt Handler Issue

Posted: Sun Jun 03, 2012 3:53 pm
by sds2017
For some reason when I try

Code: Select all

outb(0x60, 0x3);
which should output "4 was pressed" instead I get nothing and when I type

Code: Select all

outb(0x60, 0x3); 
outb(0x60, 0x4);
I get " was pressed". Another thing is when I try to just use the key board the interrupt won't register unless I try to enable the floppy drive, which my driver for it isn't working and goes somewhere into an infinite loop. Even more oddly when it works with the floppy every time I press a key there's a space or unwanted character inbetween. A saw on a post somewhere else I saw that when you enable the pit and keyboard without multitasking it might cause some errors so I only enable the keyboard and I get the same error.

Here's my code.

Code: Select all

static void keyboard_handler(registers_t regs)
{
	if(get_status_reg() & output_buffer_full)
	{
		uint8 key_pressed = get_keyboard_en_input_buffer();
		if(key_pressed == 0xE0)
		{
			printf("No Support for this key yet\n");
			return;
		}
		print_c(keymap[key_pressed]);
		printf(" was pressed\n");
	}

}

Re: Keyboard Interrupt Handler Issue

Posted: Mon Jun 04, 2012 9:02 am
by zhiayang
Post the code for your "get_status_reg()" and "get_keyboard_en_input_buffer()". I'll assume the latter simply does in

Code: Select all

inb(0x60)
, but I can't assume anything.

You need to include more, like did you send an EOI? Also, what are you trying to achieve by using outb() on the keyboard?
The keyboard and floppy don't have any interdependency, afaik.

Re: Keyboard Interrupt Handler Issue

Posted: Tue Jun 05, 2012 12:13 pm
by sds2017
Post the code for your "get_status_reg()" and "get_keyboard_en_input_buffer()". I'll assume the latter simply does in
Code:
inb(0x60)
, but I can't assume anything.
yes that's true
You need to include more, like did you send an EOI? Also, what are you trying to achieve by using outb() on the keyboard?
The keyboard and floppy don't have any interdependency, afaik.
Yes I sent the EOI.
I'm just trying to get input from the keyboard and I tried pressing a key on the keyboard and it won't send, so I tried to do it in code.

Re: Keyboard Interrupt Handler Issue

Posted: Wed Jun 06, 2012 3:22 pm
by Gigasoft
I'm just trying to get input from the keyboard and I tried pressing a key on the keyboard and it won't send, so I tried to do it in code.
Use command 0xD2 to write to the receive buffer. The default action (when no command is active) is to send the data to the keyboard.

Re: Keyboard Interrupt Handler Issue

Posted: Wed Jun 06, 2012 7:37 pm
by sds2017
I tried that and nothing happened. I just sending the command and then I sent the command and then a data value and nothing happened again.

Re: Keyboard Interrupt Handler Issue

Posted: Thu Jun 07, 2012 9:14 pm
by sds2017
Hello?

Re: Keyboard Interrupt Handler Issue

Posted: Thu Jun 07, 2012 9:46 pm
by Kazinsal
sds2017 wrote:Hello?
Hi!

Start debugging manually. Dump hex values when you think you should be getting them. Double-check your in/out values. Think your process through.