[Milestone 2 Android Development] rabinhood:
Yes, sure, here they are. As I noted before, I live in Poland, and these are Polish characters layouts. I prepared them because I was not satisfied with a way Tezet's CM10 was dealing with special characters - it was impossible there to enter uppercase special Polish letters. I attach 2 versions of my keyboard files (I'll describe why later). I think it's best to decompress them and take a look inside while reading the rest of this post. It'll be much easier. :)

WARNING

If you mess up with keyboard files, you can end up with a system not recognizing hardware keys (even power/wake up key won't work - so if screen turns black after some idle time, you won't be able to wake it up)!

Fortunately touchscreen will work properly. If you happen to have such problem, take battery out and in, reboot phone, after system starts use touchscreen to copy original *.kl files from backup location, reboot - everything will come back to normal, and reflash won't be necessary.

That means you have to do a backup copy of your original *.kl/*.kcm files before editing, especially if you do it not on PC, but on your phone!

In CM>=9 keyboard layout files are unencoded (uncompressed?) simple text files. IMHO that's the biggest advantage over CM7/Stock GB - they didn't "understand" ALT_RIGHT key, and the keyfiles had to be "precompiled" before use, what was quite annoying. The files are quite self explanatory, but just to remind briefly:

*.kl files (located in /system/usr/keylayout/*) are used to translate hardware keys scancodes into keys "meanings" used by system, every key in separate line

Engle_Mars ROM uses sholes-keypad.kl file for hardware keyboard, but there's some hierarchic structure which files are used if this one is not present, it's not very important at the moment, other *.kl files found here are used for other keyboards (like bluetooth external keyboard)

For example the leftmost key in the 2nd row ("ALT LOCK") has scancode number 125

The line inside sholes-keypad.kl "key 125 NUM_LOCK" says, that it will be used as alt-lock key

I made following changes to this file:

- key 125 ALT_RIGHT

- key 167 CTRL_LEFT

Doing this "ALT LOCK" key will be used as right_alt (required later for entering special characters), and the key with microphone icon in 4th row will be used as ctrl (required for ctrl-c / ctrl-v). Unfortunately our MS2 doesn't have all the special keys, so I had to sacrifice some that I used least frequently. I don't need "ALT LOCK" since it does the same as double pressing regular ALT. Also I didn't use this mic button - I don't even know what was it used for.

*.kcm files (located in /system/usr/keychars/*) are "one layer" above *.kl keys. They are used to tell the system what characters should be displayed after pressing letters/numbers keys alone, and together with modifier keys. Let's take a look at "A" key:

key A {

label: 'A'

number: '!'

base: 'a'

shift, capslock: 'A'

alt, numlock: '!'

shift+alt: '!'

ctrl, meta: none

}​

It says simply that if you press A key, it should display lowercase "a", if you press shift/caps+A, it should display uppercase "A", and if you press alt+A, it should display an exclamation mark "!". As you remember, we've just defined ALT_RIGHT key in sholes-keypad.kl file. Now we can simply add additional conditions to key "A" rules. In my case it looks like that:

key A {

label: 'A'

number: '!'

base: 'a'

shift, capslock: 'A'

alt, numlock: '!'

shift+alt: '!'

ctrl, meta: none

ralt: '\u0105'

shift+ralt, capslock+ralt: '\u0104'

}​

You cannot add special characters directly - Android won't recognize them. You have to put unicode hexadecimal codes instead. In my case \u0105 is lowercase Polish letter "ą", and \u0104 is uppercase "Ą". Theoretically it might be possible to define also "meta" modifier key in *.kl file to have even more special characters, but I didn't try it.

Unicode encoding tables can be found easily on the Internet, and I also attach one, if someone's interested. You can simply tweak keyboard files to any language you want - ancient Greek letters would be cool ;)

Remember: to enter a special character in this way you have to press ALT LOCK and a corresponding key at the same time! If you press ALT LOCK, then release it, and then press a letter key, the system will see it as pressing of regular ALT - numbers, exclamation mark etc. will be displayed. If you want to have an uppercase special character press SHIFT, release SHIFT, press ALT_LOCK, hold it, and press a letter key.

And now two more things. I found, that in most ROMs it's enough simply to overwrite sholes-keypad.kl and sholes-keypad.kcm files with modified ones. Unfortunately some ROMs (like Czechop's 10.2) use a bit different filenames. I didn't investigate it deeper. I found it's easiest to delete all files in keychars and keylayout directories, and copy complete content from a working ROM. That's why I provide 2 zip files: one for most ROMs (also Engle_Mars), and one for ROMs where previous files don't work. :)

Also I found it's much more convenient to put modified keyfiles into your ROM zip file, and then flash all together. But if you prefer to copy files on a running system, of course you can do that with any file manager able to gain root access. I like "ROM Toolbox Pro" most, but "Root Explorer" should also do the thing. Remember that copying files over a running system takes a lot of time.

The way I use these files is I simply copy modified versions into zip ROM file with Total Commander on my PC before flashing MS2.

I hope it'll be useful for somebody. I'm writing this post for over 2 hours now. :)