Page 1 of 1

enabling led light in Keyboard

Posted: Tue Mar 31, 2009 1:16 pm
by neoahead
i got little confused while coding keyboard handler,
i am sending 0xED( Set/Reset Mode Indicators) request to keyboard port 60h

then i want to set CAPSLOCK led- but according to keyboard datasheet-

ED Set/Reset Mode Indicators, keyboard responds with ACK then
waits for a following option byte. When the option byte is
received the keyboard again ACK's and then sets the LED's
accordingly. Scanning is resumed if scanning was enabled.
If another command is received instead of the option byte
(high bit set on) this command is terminated. Hardware
defaults to these indicators turned off.

|7-3|2|1|0| Keyboard Status Indicator Option Byte
| | | `--- Scroll-Lock indicator (0=off, 1=on)
| | `---- Num-Lock indicator (0=off, 1=on)
| `----- Caps-Lock indicator (0=off, 1=on)
`------- reserved (must be zero)

not sure whats that option byte means and how to set that
so could some help me out here...


here is piece of my code

Code: Select all

if((inp8(0x64)&2) == 0) break;
			outp8(0x60,0xED);
			outp8(0x60,0x04);

Re: enabling led light in Keyboard

Posted: Tue Mar 31, 2009 1:51 pm
by Dex
Use

Code: Select all

	mov   [keyBoardStatus],0xb0	 ; set like this on startup
	call  SetKeyBoardLeds		 
;;;;;;;;;;;;;;;;;;;;;;These will turn the cap lock leds on or off;;;;;;;;;;;;;;;;;;;;;;;;;;
	xor   [keyBoardStatus],4 
	call  SetKeyBoardLeds
;---------------------------------
	and   [keyBoardStatus],0xfb
	call  SetKeyBoardLeds
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;====================================================;
; Set keyboard leds                                  ;
;====================================================;

SetKeyBoardLeds:
	push  eax
	mov   al,0xed				     
	out   60h,al				      
KeyBoardWait:
	in    al,64h
	test  al,10b				      
	jne   KeyBoardWait			      
	mov   al,byte [keyBoardStatus]
	and   al,111b
	out   60h,al				      
	pop   eax
	ret

Re: enabling led light in Keyboard

Posted: Tue Mar 31, 2009 2:42 pm
by neoahead
thanx alot dude....

u really saved me from bursting my head out :)

Re: enabling led light in Keyboard

Posted: Wed Apr 01, 2009 4:51 am
by JamesM
neoahead wrote:thanx alot dude....

u really saved me from bursting my head out :)
So you know what you were doing wrong? If you look at his code the only thing different is that he sends the 0xED command then polls for the status change, whereas you poll for a status change before sending the command.

Cheers,

James