Keyboard Interrupt Handler Issue

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
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Keyboard Interrupt Handler Issue

Post 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");
	}

}
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: Keyboard Interrupt Handler Issue

Post 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.
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: Keyboard Interrupt Handler Issue

Post 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.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Keyboard Interrupt Handler Issue

Post 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.
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: Keyboard Interrupt Handler Issue

Post 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.
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Re: Keyboard Interrupt Handler Issue

Post by sds2017 »

Hello?
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Keyboard Interrupt Handler Issue

Post 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.
Post Reply