Originally Posted by tebra
Is it possible to change the keyboard layout?
There are two levels of processing turning a key press into a character.
The first is mapping of the scan code into a key code.
The second is mapping the key code and meta keys (shift, alt, etc) into a character.
The first mapping is done using files like /system/usr/keylayout/qwerty.kl
The second mapping is done using files like /system/usr/keychars/qwerty.kcm.bin
The first file is conveniently in plain text, the second is a simple binary file.
If you are simply swapping keys around you only need to change the .kl file
If you want to make it so that shift 4 is Euro instead of dollar you need to change the kcm.bin file.
You can just edit the .kl file. Before:
This would make the key layout more "German-like" by making the center key in the top alpha row be considered the 'Z' key.
The .kcm.bin are compiled files from source.
I haven't looked into where the compiler comes from, I just modify the stock kcm.bin by hand.
The file is broken down into 16 byte chunks with a 16 byte header.
Here is the chunk for C (on my modified version):
000100 1F 00 00 00 43 00 32 00 63 00 43 00 E7 00 C7 00
- This chunk is about KEYCODE_C (0x1f) (uses Android key codes)
- The visual for this key is 'C' (0x0043)
- On a numeric keypad this would dial a 2 (0x0032) as in ABC on a phone
- The unshifted UTF-16 value is 'c' (0x0063)
- The shifted UTF-16 value is 'C' (0x0043)
- The alt modified UTF-16 value 'ç' (0x00e7)
- The alt-shift modified UTF-16 value is 'Ç' (0x00c7)
You can also use alt combos for combining diacritics:
- 0x0300 grave accent
- 0x0301 acute accent
- 0x0302 circumflex accent
- 0x0303 tilde accent
- 0x0308 umlaut accent
To replace these files on your Nook, you will need to remount your system as R/W:
mount -o rw,remount /dev/block/mmcblk0p5 /system
You can get fancier if you want to have some USB keyboards US and some Belgian.
I await my shipment of Belgian chocolates.