PC-like keyboard mapping for hardware USB keyboards
: This is a work in progress, but I want to get my partially working config out there for someone like me who desperately wants this to work.
Edit 1: In retrospect, titling it "better keyboard support" was a bad idea, this has nothing to do with the "betterkeyboard" app.
I purchased the apad/gpad case with the integrated USB keyboard from witglobal here:
However, there are issues with the control and escape keys, particularly in connectbot. Since I got the keyboard so I could connect to Linux machines, missing those two keys is pretty ugly. I know you can tap the touchscreen to get ctrl and esc, but that's really slow, I'd like to use the hard key.
So far, I have discovered that there are several things getting in the way of the key working. First is the keyboard mapping files. There are no native key mapping for 'esc' and the default key mapping for the 'esc' key is "BACK". This is fine for many uses, but not for mine. Secondly, it looks like there is a very small set of "custom" keys available in the keymappings.h file. Since there are no "USER1" etc keys, it will take a rebuild of the keyboard code with added entries to make it work better.
This is an attempt to fix control and esc functionality with a USB keyboard. It consists of a kcm file and a kl file to replace the current ones. I am doing my work on VEGAn beta5, but I suspect any ROM will benefit from these files.
To install these files, do the following:
- adb pull /system/usr/keychars/usb_keyboard_102_en_us.kcm.bin usb_keyboard_102_en_us.kcm.bin.orig
- adb pull /system/usr/keylayout/usb_keyboard_102_en_us.kl usb_keyboard_102_en_us.kl.orig
- adb remount
- adb push usb_keyboard_102_en_us.kcm.bin /system/usr/keychars
- adb push usb_keyboard_102_en_us.kl /system/usr/keylayout
- Unplug and replug your USB keyboard
Once this is done, the following changes are made:
- Ctrl is mapped to DPAD_CENTER
- Esc is mapped to DPAD_CENTER
To use it, go to connectbot, log in, and hit esc or ctrl once for ctrl, and hit esc or ctrl 2x for escape.
- Shift , generates a ;, not a < in Connectbot, but works correctly in other places
- Shift . generates a :, not a > in Connectbot, but works correctly in other places
- Insert does not work
- Del generates a backspace
- ] and } keys generate the character + a beep