Getting PS/2 keyboard LEDs on for capslock etc?

26 Sep 2012

Hi there, I've been getting familiar with the PS2 keyboard library on the cookbook. I've got it running now finally, but now I have a question.

I'm wanting to make the capslock and other LEDs on the keyboard work(I know this isn't strictly necessary). I know that doing this involves somehow sending data to the keyboard. For x86 PCs, it's similar to this:

	while((inportb(0x64)&2)!=0){} //wait til idle
	outportb(0x60,0xED); //send first portion of command
	
	while((inportb(0x64)&2)!=0){} //wait til idle
	outportb(0x60,status); //send status update bits

However, I'm not for sure how to send data back to the keyboard from an electronics perspective. I realize the PS/2 library in the cookbook probably doesn't support this, but I'm willing to extend it. (I've already fixed an uninitialized variable bug in it).

How exactly would I tackle this problem?