From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 20 Mar 2014 11:19:41 -0400 To: 9fans@9fans.net Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] usb/kb Topicbox-Message-UUID: cda5036c-ead8-11e9-9d60-3106f5b1d025 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