Page 1 of 1
Keybord drivers
Posted: Wed Dec 20, 2006 6:41 pm
by thoover
i went up to page 40 and couldnt find any keybord support that works, i am on my 3rd hour of programming and i need help to find keypress support, i am using djgpp and i need input suport for my doslike , thus far, os. links or codes are appreciated thks in advance.
i will be back soon it is time to take a break.
THOOVER
Posted: Wed Dec 20, 2006 7:40 pm
by Mikae
I think, this
link may help you.
Posted: Wed Dec 20, 2006 9:26 pm
by thoover
I think, this link may help you.
The link gave me some of the info i need, but i cant find out how to put it into my kernel, any help?
Posted: Thu Dec 21, 2006 4:59 am
by Combuster
Posted: Thu Dec 21, 2006 10:48 am
by Dex
Posted: Thu Dec 21, 2006 4:34 pm
by thoover
I made this code,
Code: Select all
unsigned char getch()
{
char in;
char oin;
outportb(0x60,0xf4);
outportb(0x64,0x60);
outportb(0x64,0x20);
outportb(0x60,0xff);
oin=inportb(0x60);
do {
in=inportb(0x60);
} while(in == oin);
}
i need help with it it dosnt work at all what did i do wrong.
Posted: Thu Dec 21, 2006 4:40 pm
by Combuster
What those writes to port 60h and 64h are doing, i have no clue. No code i've seen used that, so why would you?
As for the second part, you are reading a keypress, then you are waiting for a different scancode (the release, another keypress, or the remaining scancode). This would only give you each other scancode, possibly making you lose half the information you wanted.
Also, no return value?
Posted: Thu Dec 21, 2006 4:57 pm
by thoover
i got it off of a another forum here:
http://www.osdev.org/phpBB2/viewtopic.php?t=306 the last reply it worked once for me but it wont work again. which i believe is odd.
Posted: Thu Dec 21, 2006 5:01 pm
by thoover
nvm i fixed it now it is:
Code: Select all
unsigned char getch()
{
char in;
char oin;
outportb(0x60,0xf4);
outportb(0x64,0x60);
outportb(0x64,0x20);
oin=inportb(0x60);
do {
in=inportb(0x60);
} while(in == oin);
}
works perfectly now
all i have to do is set up which key is which bye
Posted: Fri Dec 22, 2006 6:12 pm
by thoover
the code above works for PS/2 only, how can i get one that works on AT style? any suggestions??
Posted: Sat Dec 23, 2006 10:13 am
by Mikae
You have to use ports 0x60 (commands) and 0x61 (data), instead of port 0x64 for both.