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

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
monsterhunter445
Posts: 20
Joined: Sun Jan 02, 2011 4:46 pm

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

Post 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();
Attachments
keyboardglitch.png
Last edited by monsterhunter445 on Sun Jan 23, 2011 4:10 pm, edited 1 time in total.
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Funny keyboard glitch can someone please help me?

Post by NickJohnson »

You need to wait for an IRQ1 before reading the next scancode.
monsterhunter445
Posts: 20
Joined: Sun Jan 02, 2011 4:46 pm

Re: Funny keyboard glitch can someone please help me?

Post by monsterhunter445 »

Thanks I actually forgot to do that, I was reading in the wiki and I found the solution there too.
Post Reply