I would like to get my keyboard current scan code set. Code that I am using looks more or less like this:
#define STATUSPORT 64h
#define DATAPORT 60h
#define PS2controllerOutputFull 0x20
#define PS2controllerInputFull 2h
void sendByte()
{
__asm
{
push eax
repeat :
in al, STATUSPORT
test al, PS2controllerInputFull
jne repeat
pop eax
out DATAPORT, al
clc
}
}
UCHAR getByte()
{
__asm
{
repeat:
in al, STATUSPORT
test al, PS2controllerOutputFull
jne repeat
in al, DATAPORT
clc
}
}
UCHAR getScanCodeSet()
{
__asm
{
mov al, 0xF0
call sendByte
mov al, 0x00
call sendByte
call getByte
cmp al, 0xFA
jne unknownError
call getByte; AL = Scan Code Set
jmp exit
unknownError:
mov al, 0xDD
exit:
}
}
Instead of getting current control set number I receive 0xFA from keyboard(Acknowledge). I'd be very grateful for any suggestions.
(I ran this code from windows driver)