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.
My ISR and interupts work fine , but I have a problem in the keybord driver .
when I want to detect that a key is released it dosn't work , this is my code :
char charTable[]={..........All the keybord keys......}
char ShiftcharTable[]={..... All the keybord keys +shift.....}
char printable[]={.... ALL the non printable keys.......}
void KbHandler(void)
{
char key;
unsigned char cmd;
char ascii;
key =inportb(0x60);//read the pressed key
if(key<sizeof(charTable))//if down
{
//if shift
if((key==LSHIFT)|| (key==RSHIFT)) up=1;
else
{ if(up)ascii=ShiftcharTable[key];
else ascii=charTable[key];
//On verifie que c'est un caractere imprimable
int i=1,j;
for(j=0;j<sizeof(non_printable);j++)
if(ascii==non_printable[j]){
i=0;
break;
};
if(i)
{
add(ascii); //On la met dans le buffer
}
}
}
[b]else
{
if(key>=0x80)
{
if((key==(RSHIFT+0x80))||(key==(LSHIFT+0x80))) up=0;
}
}[/b]
cmd=inportb(0x61);
outportb(0x61,cmd | 0x80); //disable the keybord
outportb(0x61,cmd); //
outportb(0xA0,0x20);//EOI to the slave
outportb(0x20,0x20);//EOI to the master
};
the problem here is that the sequence in blod it's not accesd , when a key is released? If some one knows why ,please help.
for the second sugestion I'll try it, I think that it's a problem of compilation because when I gebug the condition i not evaluated in the first if this is why I used "sizeof", to make a call and force the compilation. I should compile in another distribution. (I am using Damn vunerable Linux)
I think that because you are reseting the keyboard each time you are making the keyboard controller "forget" that the key was pressed. If the key wasn't pressed how can it be released?
I think that because you are reseting the keyboard each time you are making the keyboard controller "forget" that the key was pressed. If the key wasn't pressed how can it be released?
I don't think so, because it's an electronic process when a key is released it hase its own scan code.
Well , I have tryed to print a message a message when a key is released and it works .
So the problem is in the test :
Lode wrote:What is the point of disabling the keyboard and then re-enabling it right away?
On some hardware (old obsolete hardware?) it is the only way to "ack" a scancode. If you do not do it, you will get the same scancode repeated forever, every time you read the keyboard.