I’ve ordered nice little case for my Zenithink C71 a while ago, with built-in USB keyboard. It’s pretty basic, and I won’t call it state of the art, but it’s a hell of a lot better than tapping on the screen. Actually I’m using it at the moment to type this very post. There is a catch however: on the PC I’ve got used to typing on proper keyboards where I could just change the layout with a keyboard shortcut/mouse click. This however won’t work on Android. To type accented characters when I’m typing in Hungarian I had to use the software keyboard.
To overcome this limitation I dug in deep to see how the keyboard is managed under Android, figure out the most elegant solution, and implement it on my device.
Please note, that this only works on Honeycomb and Icecream Sandwich, as the previously used binary format has been changed! You need a rooted device, terminal emulator, a utf map and file explorer with text editing capabilities and some Linux knowledge.
Keymaps are stored under system/usr and are made up of 3 parts,
Idc specifies which Keymaps and keyboard layout the specific USB device uses, this can be reused to apply the same configuration to several different devices, note the special Generic.idc and Virtual.idc these denote the generic fallback devices that are used when no matching descriptor is found. Device matching is performed from the specifics to the generic. So for each usb device first the vendor+ product+ version is searched, then the vendor+ product combo is searched, then the generic and the virtual falls back. The idc contains the types of device, so it can be used to map any external device like controllers as pointing device, not just keyboards.
Once you identify the USB I’d of your device (i used some application, but it’s far easier to just issue an lsusb command from a terminal.) you can go ahead and create your own descriptor from the generic ones provided. As far as I’ve seen you don’t have to create the idc unless you want to reuse an already existing keylayout. I created mine just in case. As my device’s USB Id is 0e8f:0040 the file I created was named Vendor_0e8f_Product_0040.idc I modified the references in it to use my own layout and character map (keychar) files.
Keychars are basically nothing more than simple keycode to name maps. I’ve stickers with the generic here at first, but soon it turned out my arrow keys are mapped differently, so I actually had to make some minor adjustments here.
Key layouts are the final part of this puzzle. They specify the behavior of the key names when used with the various modifiers. Since I didn’t intend to create a full Hungarian mapping, but only provide a simply way of entering the accented characters in decided to map the special characters to their respective positions with the Alt / Shift+ Alt for capitals. This involved the utf-8 table I mentioned above, which I used to identify the required character codes with.
To test the results you just disconnect / reconnect the keyboard and the new layout is loaded automatically.
It snowing now, so I just have to stop typing, cause the keyboard is all set. If anyone is interested Inn more details drop a comment so I can touch the article up,