Detecting Keyboard scancode sets

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
K.J.

Detecting Keyboard scancode sets

Post by K.J. »

I'm rewriting my keyboard driver from scratch so that it can use any keymap or any scancode set.

I found out how to change scancode sets, but I haven't been able to find any info about how to find out which sets are supported by a keyboard. Does anyone know how to detect which ones the keyboard supports?

Thanks in advance,
K.J.
jrfritz

Re:Detecting Keyboard scancode sets

Post by jrfritz »

Tim I think once told me there was not away...but I forgot...

I think there is no way...(because Linux, and Windows makes you select where you live/keyboard map)
K.J.

Re:Detecting Keyboard scancode sets

Post by K.J. »

I'm talking about scancode sets, like set 1, 2, and 3. The actual bytes the keyboard sends to port 0x60. They are the same no matter what the keyboard, but not all keyboards support set 3 which happens of course to be the easiest to decode.

K.J.
jrfritz

Re:Detecting Keyboard scancode sets

Post by jrfritz »

I know...I asked the same question once.
DarylD

Re:Detecting Keyboard scancode sets

Post by DarylD »

As far as I remember, I think there may well be a way. I think scancode set 2 is by far the most common, but obviously its not good to assume!

Also be aware that quite a few keyboards have incorrect scancode sets, where it might support say 2 and 3, but only 2 is correct and 3 might contain incorrect codes generating the wrong character!!

Personally, I think its fairly safe to leave it in whatever state its in when it boots up!
Tim

Re:Detecting Keyboard scancode sets

Post by Tim »

Scancode set 1 is the only safe one, but it is weird to program. Scancode set 3 is the easiest to program (each key gives only one scan code), although not all keyboards support it.
K.J.

Re:Detecting Keyboard scancode sets

Post by K.J. »

Hmm... now I'm getting even more confused 'bout keyboards.

From http://www.linuxjournal.com/article.php?sid=1080:

The usual PC keyboards are capable of producing three sets of scancodes. Writing 0xf0 followed by 1, 2 or 3 to port 0x60 will put the keyboard in scancode mode 1, 2 or 3. Writing 0xf0 followed by 0 queries the mode, resulting in a scancode byte 0x43, 0x41 or 0x3f from the keyboard.

Scancode mode 2 is the default.


First, isn't port 0x60 a read only port? And two... if scancode set 2 is the default, why is 1 the only safe one?

Also, digging around some, I got the impression that a MFII keyboard(whatever that is) always supports scancode set 3.

K.J.
Post Reply