Page 3 of 3
Posted: Wed Feb 27, 2008 10:57 am
by Osbios
And by the way: You cant detect XT keyboards. Because this keyboards only send "scan codes" but won't react to any input!
Posted: Thu Feb 28, 2008 11:28 pm
by crazyos
hi everyone ,
as james told i am able to glow the led on my keyboard but then i am not able to get the keyboards reply.( basically i m tryin to detect the ps/2 keyboard i.e whether keyboard is plugged in or not)
Code: Select all
[GLOBAL keybdpre]
[bits 32]
keybdpre:
call kbd
mov al,0EDh ; 8048 command byte to set
out 60h,al
call kbd
; b0 is ScrollLock, b1 is NumLock, b2 is CapsLock
mov al,07h
out 60h,al
WaitLoop:
in al, 64h ; Read Status byte
and al, 10b ; Test IBF flag (Status<1>)
jz WaitLoop ; Wait for IBF = 1
;problem here does not come out as no ; value is returned by the keyboard.
in al, 60h ; Read input buffer
cmp al,0xfa
je print;
areho: mov ax,0x00
ret
print: mov ax,0x01
ret
kbd0: jmp short $+2
in al,60h
kbd: jmp short $+2
in al,64h
test al,1
jnz kbd0
test al,2
jnz kbd
ret
i think the keyboard should respond with acknowledgment of [FA] but then my programme is getting into the loop and not coming out as the IBF is not detecting any data. also tell me if am on right track
Posted: Thu Feb 28, 2008 11:48 pm
by 01000101
why don't you try reading the System Flag status bit from the Status port?
I
think that shows if the self-test was OK or not.
b2 System Flag status: 0=power-up/reset, 1=selftest OK (?)
Code: Select all
#define keyboard_status_port 0x64
#define system_flag_bit 0x04
if(inportb(keyboard_status_port) & system_flag_bit)
{printf("keyboard is on \n");}
else{printf("keyboard is either not on or disconnected \n");}
Posted: Fri Feb 29, 2008 12:18 am
by crazyos
thanks for the reply but the same problem even if i am disconnecting the ps2 port it is showin keyboard is on i need some acknowledgment from the keyboard.
Posted: Fri Feb 29, 2008 6:06 am
by crazyos
well i checked my code on the physical machine and got the acknowlegment it was working fine, but then am not able to get acknowledgment on vmware may be it has got something to do with virtualization. can any one tell me whats the problem using vmware
Posted: Fri Feb 29, 2008 6:33 am
by naiksidd_85
thank you all i finally got it done
Posted: Sun Mar 02, 2008 6:42 pm
by ~
Could you give us some hint on how you did it?
It looks like all methods presented here including mine (and probably except the one posted by Osbios) may work in some machines and fail in others.
Have you tested on several machines to make sure that your method is fully reliable?
The acknowledgment from resetting the keyboard seems to fail on some PC's (maybe just needs elaborate...), reading the SYSTEM FLAG is only useful to test the whether it was properly present at POST. If it is set to 0, then RESET the keyboard, then re-read the SYSTEM FLAG, it doesn't seem to change in any of the PC's I have (4 different ones) to indicate BAT OK or BAT ERROR.
Maybe a timer using the PIT is absolutely required, as well as a keyboard interrupt and filtering out PS/2 mouse.
Posted: Sun Mar 02, 2008 7:41 pm
by Osbios
Like I already told you: The USB Legacy stuff makes it impossible to tell if there is a keyboard or not. You have to live with it until you have USB drivers. :b
Posted: Mon Mar 03, 2008 9:25 pm
by naiksidd_85
hi ~,
sorry for the delay in reply.
I have used the same code that is posted by crazyOS on this page as we are working together.
I will surely post the code.
according to your suggestion I am testing it on various platform when I am really sure that its working comletely fine I will post it .
And any ways you are the guys who have helped me in this . else I would have not done it