Page 1 of 1

Funny keyboard glitch can someone please help me? [Solved]

Posted: Sun Jan 23, 2011 2:22 pm
by monsterhunter445
I started using keyboard input support in my kernel, but when ever I type it seems to add a lot of characters which are strange. I think it has to do with my while loop code here have a look at the code and the picture.

Code: Select all

char msg[1000];
		
		int i = 0;
		unsigned char scancode = inportb(0x60);
		while(kbdus[scancode] != 'c')
		{
			
			scancode = inportb(0x60);
			printstring("Press and Key To Type... and press c to clear and close. ", 79, 2);
			if (kbdus[scancode] != 0)
			{
				stringcat(msg, &kbdus[scancode]);
			}
			printstring(msg, 79, 3);
			
		}
		clear_screen();

Re: Funny keyboard glitch can someone please help me?

Posted: Sun Jan 23, 2011 2:41 pm
by NickJohnson
You need to wait for an IRQ1 before reading the next scancode.

Re: Funny keyboard glitch can someone please help me?

Posted: Sun Jan 23, 2011 3:21 pm
by monsterhunter445
Thanks I actually forgot to do that, I was reading in the wiki and I found the solution there too.