i've made some improvements to 9atom's usb/kb. they're a little
extensive, so i thought i'd request some feedback before i start
sending patches to sources. the code is all in atom.
the reason i embarked on this was because the keypad wouldn't
work, and kb didn't play nice with japanese keyboards. and it
turned out the root cause was fairly deep.
a bit of background. the ps/2 keyboard driver sets led state.
the led state changes the scancodes produced. so 9/pgup on
the keypad produces pgup with numlock off, and 9 with it on.
(my ibm keyboards don't behave like this, but that's the theory)
so after making the usb led work i realized that usb doesn't
change the usb keycode. the driver must track this, and make
changes accordingly. this requires some processing at the
usb code level (not the scan code output to /dev/kbin!).
since it's no longer a static range of bytes that gets escape scan
codes, it seemed that the escapes should be part of the usb code
to scan code tables. this is because many different usb codes can
map to the same scan code. (and we wouldn't know to escape it
or not.) the pseudo code looks something like this
for(;;){
usbcode = getkey();
switch(usbcode){
case numlock ... kanashift:
kbd->led ^= thisled;
setleds(kbd);
break;
}
scancode = usbtoscancode(usbcode, kbd->led);
...
}
so a few details that should now work are
- japanese keyboards,
- usb leds
- usb num lock. the scroll lock and kana lights should also
work. caps lock is disabled, and i didn't know what to do with
the compose led. might be nice to light when composing, but
that would require usb/kb to do the composition itself, so
- the keypad works!
- f11, f12 work
- f13-f24 work but largely do strange things due to the fact that
page up/page down are mapped into this area. we should consider
moving them safely out of the f-key range.
- keyboard restarting should work properly now, and not crash.
i think we were using the wrong eid.
- keyboards that present an Eboth endpoint should be recognized.
- erik