scancode 3 on AT-Compatible machines

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
firas981

scancode 3 on AT-Compatible machines

Post by firas981 »

My machine is AT-compatible so its default scancode-set is 2 .
I used this function to set scancode-set to 3 :

Byte KB_Set_ScanCode_Mode ( Byte mode )
{
   KB_Write_To_DataRegister ( KB_READ_OR_SET_SCANCODE_COM ) ;
   if ( KB_Read_From_OutputRegister ( ) != KB_ACK_REPLY ) return 0;//FAILED
   
   KB_Write_To_DataRegister ( mode ) ;
   if ( KB_Read_From_OutputRegister ( ) != KB_ACK_REPLY ) return 0;//FAILED
   
   return 1 ;
}

After that I checked the scancode-set and it was 3 , so the previous code succeeded .
but when I press anykey the IRQ1_handler craches . although it works well when using scancode set 2 .

thanks
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:scancode 3 on AT-Compatible machines

Post by Brendan »

Hi,
firas981 wrote: After that I checked the scancode-set and it was 3 , so the previous code succeeded .
but when I press anykey the IRQ1_handler craches . although it works well when using scancode set 2 .
Scancode sets 1 and 3 aren't recommended as they aren't supported by all keyboards. Despite this your keyboard driver should never crash (even if the keyboard is sending random numbers). Why did it crash (which exception, etc)?


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
firas981

Re:scancode 3 on AT-Compatible machines

Post by firas981 »

manuals say that there is internal translation from set 2 to set 1 in some AT-compatibles , so I wrote my driver according on set 1 .....
it succeeded !

thanks
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:scancode 3 on AT-Compatible machines

Post by Pype.Clicker »

i second that. Those "'multiple scancode sets" are things people that write code for a microcontroller that talks *directly* with the keyboard need to take into account. In our case, there's *already* a microcontroller doing this (the 8042) and doing it well. So we can be happy and stick with scancode set #1, which is the plain compatible set you get if you're running under DOS...
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:scancode 3 on AT-Compatible machines

Post by Brendan »

Hi,
Pype.Clicker wrote: i second that. Those "'multiple scancode sets" are things people that write code for a microcontroller that talks *directly* with the keyboard need to take into account. In our case, there's *already* a microcontroller doing this (the 8042) and doing it well. So we can be happy and stick with scancode set #1, which is the plain compatible set you get if you're running under DOS...
Ever wondered what happens when you plug another keyboard into the second PS/2 port (where the mouse usually goes)? I've got a PS/2 (keyboard & mouse) driver that allows this..

2 keyboards + 2 video cards + 2 serial mice = a multi-user computer ;D


Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply