1

I have a rooted XT897 (Motorola Photon Q) running Android 4.1.2, although this should apply to any phone with a physical keyboard. The keyboard on the phone is sorely lacking keys such as <,>,{,},,[,],`,\,|, and ~. It does have a "sym" button that sometimes pulls up a little window in which I can select which symbol not on the keyboard that I would like to type.

Most of the time, it does absolutely nothing. I am aware of Android's key layout files, and I have already modified mine such that the useless Caps Lock key to be a CTRL key instead. However, these do not allow for mapping combinations of keys to other, single keys (as far as I can tell). What I'd like is something like xmodmap, where I could map SYM + P to ] and do that for all the keys.

Is there any way I can do this? The page on the key layout files mentions that it maps linux keycodes to Android keycodes, perhaps I can edit the linux key mapping file. Where would that be? Would that even work?

2
  • 1
    Have you heard of Hacker's Keyboard? This might not help if your aim is to learn to map and not its end result.
    – Narayanan
    Commented Aug 5, 2015 at 6:24
  • @Narayanan I have, and I use it. I still highly prefer a physical keyboard. My aim is absolutely the end goal of getting this phone to type the above mentioned keys via the physical keyboard.
    – Shelvacu
    Commented Aug 5, 2015 at 6:27

1 Answer 1

0

There are two "layers" in the hardware keypress -> character to insert in textbox. The layer after key layout files is Key Character Map Files. They take the key (such as "A") and dictate what should result from various combinations of keys. For example:

key A {
  label: "A" # What to 'name' the key
  base: "a" # pressing this key with no modifiers
  shift, capslock: "A" # if either shift or capslock is on, do a capital a instead
  ctrl, alt, meta: none # do nothing if any other combinations are pressed
}

Backup, then edit the .kcm file corresponding to the hardware keyboard. You will need root.

If your file has any syntax errors then it will simply revert to the default keyboard mapping which is mostly but not fully correct. The only way to check for syntax errors besides putting the file in and rebooting the device is to compile the entirety of the android source code.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .