The 8042 microcontroller
Posted: Wed Aug 16, 2006 7:21 am
Last days I've been working on a keyboard handler for my OS.
I've come across a problem (who won't ) while working with the 8042 microcontroller.
At startup of my OS, I want to save the current keyboard LED's state directly after the bootstrap that loads the kernel transfers control to the kernel.
When sending 0xED to keyboard port 0x60, then waiting, and sending LED's status to port 0x60 will update the LED's status on the keyboard. But what I want is to READ the current LED's status from the keyboard, then turn off all LED's except Num Lock, so I can save the status and still let the user have preference on if Num Lock should be ON / OFF at startup (this is changeable in the BIOS as most here will know).
I've read this thread, it gave me good insight on how the which ports do what and where the 8042 is located.
A note on the thread mentioned above, the thread starter posts that KB_CAPS_LOCK equals to 1 binary, but it should be 100 binary, is that right? Also he posts KB_SCROLL_LOCK equals to 101 binary, but it should be 1 binary, is that right too? AFAIK, the KB_NUM_LOCK equate is right, correct me if I'm wrong.
Also I would like to know what the bits in status byte in 0x64 really mean and how to use it (a link to a good document would be great)
EDIT: I've found this page, seems to have interesting information, I saved it to my USB stick and I will read it at home since I moved and have no Internet conn. yet.
Many thanks
I've come across a problem (who won't ) while working with the 8042 microcontroller.
At startup of my OS, I want to save the current keyboard LED's state directly after the bootstrap that loads the kernel transfers control to the kernel.
When sending 0xED to keyboard port 0x60, then waiting, and sending LED's status to port 0x60 will update the LED's status on the keyboard. But what I want is to READ the current LED's status from the keyboard, then turn off all LED's except Num Lock, so I can save the status and still let the user have preference on if Num Lock should be ON / OFF at startup (this is changeable in the BIOS as most here will know).
I've read this thread, it gave me good insight on how the which ports do what and where the 8042 is located.
A note on the thread mentioned above, the thread starter posts that KB_CAPS_LOCK equals to 1 binary, but it should be 100 binary, is that right? Also he posts KB_SCROLL_LOCK equals to 101 binary, but it should be 1 binary, is that right too? AFAIK, the KB_NUM_LOCK equate is right, correct me if I'm wrong.
Also I would like to know what the bits in status byte in 0x64 really mean and how to use it (a link to a good document would be great)
EDIT: I've found this page, seems to have interesting information, I saved it to my USB stick and I will read it at home since I moved and have no Internet conn. yet.
Many thanks