PS/2 Keyboard - Code Set Compatibility
Posted: Tue Apr 02, 2013 7:42 am
Hey,
I've been writing a keyboard driver for my operating system, TachyonOS, to add functionality and free myself from BIOS-based drivers.
I did some research in several PS/2 articles on the OSDev Wiki, I've read the pages on the PS/2 controller and the PS/2 keyboard. It seems fairly simple in principle, however I am a little unsure on a few aspects of keyboard scan code sets and googling has not provided me with anything useful.
I want to make an array that keep track of which keys are pressed so programs can simply check it a key is pressed. I'm planning to use keyboard scan code set two. I like code set one much better but according to the article only set two is supported on all keyboards. It's too bad, set two looks like IBM purchased it from a bunch of monkeys with typewriters.
Anyway, I have a few questions.
I've been writing a keyboard driver for my operating system, TachyonOS, to add functionality and free myself from BIOS-based drivers.
I did some research in several PS/2 articles on the OSDev Wiki, I've read the pages on the PS/2 controller and the PS/2 keyboard. It seems fairly simple in principle, however I am a little unsure on a few aspects of keyboard scan code sets and googling has not provided me with anything useful.
I want to make an array that keep track of which keys are pressed so programs can simply check it a key is pressed. I'm planning to use keyboard scan code set two. I like code set one much better but according to the article only set two is supported on all keyboards. It's too bad, set two looks like IBM purchased it from a bunch of monkeys with typewriters.
Anyway, I have a few questions.
- In the translation section of the PS/2 article it warns that with key code translation enabled it is impossible to know whether you are receiving data from the original device or the translation. However I think that BIOS operates with translation enabled and uses the translated values because it returns key codes from set one. How does it "know" which values to collect?
- To keep backwards compatibility I want to make sure programs can still read keys through BIOS. Would simply translating the key press from set two into set one and placing it into the BIOS keyboard function with INT 0x16 AH=05 be sufficient to emulate this?
- I can't seem to find the values for the "super" and "menu" keys on the key set. By these I mean the windows flag and the picture of a list with an item selected, respectively. Are they called something different or am I missing something?
- The "break" key has no key release event. I'm not sure how to register when it is pressed. Would it be a good idea to count it as 'held' and release it on a time delay?