Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

How I can change a layout or add a new layout to physical keyboard of Xperia mini pro phone?

I want for example remap ? to ''ə'' and shift ? to ''Ə'', or س to ی in Persian layout or even add new layout (Persian 2 layout).

You can find build-in layout here, actually I want to add a new layout to them.

enter image description here

share|improve this question
    
Can you be more specific by what you mean by "layout"? Are you wanting to re-bind keys? –  Bryan Denny Jun 5 '12 at 13:05
    
@Reza, are you rooted? –  jlehenbauer Jun 8 '12 at 2:42
    
@jlehenbauer Yes, my device is rooted –  PHPst Jun 8 '12 at 3:04
    
@Reza Perfect! i'm actually doing this right now to my phone. i'll type it up for you! –  jlehenbauer Jun 8 '12 at 3:07
    
Any purpose of photo? –  Sachin Shekhar Jun 8 '12 at 4:08
show 1 more comment

1 Answer

First, obtain the following:

  • Android device with root access

  • adb on your computer

    • you can do without this, but that just means a lot of time copying files back and forth to your phone and moving them with something like Root Explorer
  • text editor

Now,

  1. Plug your phone in to your computer and navigate to the /system/usr/keylayout/ folder, using adb or a Terminal Emulator

  2. Pull the file for your keylayout. Mine was called qwerty.kl and looked like this:

key 399   GRAVE
key 2     1
key 3     2
key 4     3
key 5     4
key 6     5
key 7     6
key 8     7
key 9     8
key 10    9
key 11    0
key 158   BACK              WAKE_DROPPED
key 230   SOFT_RIGHT        WAKE
key 60    SOFT_RIGHT        WAKE
key 107   ENDCALL           WAKE_DROPPED
key 62    ENDCALL           WAKE_DROPPED
key 229   MENU              WAKE_DROPPED
key 139   MENU              WAKE_DROPPED
key 59    MENU              WAKE_DROPPED
key 127   SEARCH            WAKE_DROPPED
key 217   SEARCH            WAKE_DROPPED
key 228   POUND
key 227   STAR
key 231   CALL              WAKE_DROPPED
key 61    CALL              WAKE_DROPPED
key 232   DPAD_CENTER       WAKE_DROPPED
key 108   DPAD_DOWN         WAKE_DROPPED
key 103   DPAD_UP           WAKE_DROPPED
key 102   HOME              WAKE
key 105   DPAD_LEFT         WAKE_DROPPED
key 106   DPAD_RIGHT        WAKE_DROPPED
key 115   VOLUME_UP         WAKE
key 114   VOLUME_DOWN       WAKE
key 116   POWER             WAKE
key 212   CAMERA

key 16    Q
key 17    W
key 18    E
key 19    R
key 20    T
key 21    Y
key 22    U
key 23    I
key 24    O
key 25    P
key 26    LEFT_BRACKET
key 27    RIGHT_BRACKET
key 43    BACKSLASH

key 30    A
key 31    S
key 32    D
key 33    F
key 34    G
key 35    H
key 36    J
key 37    K
key 38    L
key 39    SEMICOLON
key 40    APOSTROPHE
key 14    DEL

key 44    Z
key 45    X
key 46    C
key 47    V
key 48    B
key 49    N
key 50    M
key 51    COMMA
key 52    PERIOD
key 53    SLASH
key 28    ENTER

key 56    ALT_LEFT
key 100   ALT_RIGHT
key 42    SHIFT_LEFT
key 54    SHIFT_RIGHT
key 15    TAB
key 57    SPACE
key 150   EXPLORER
key 155   ENVELOPE        

key 12    MINUS
key 13    EQUALS
key 215   AT

# On an AT keyboard: ESC, F10
key 1     BACK              WAKE_DROPPED
key 68    MENU              WAKE_DROPPED
  1. Now, play with the file!

To change L to M, key 38 L->key 38 M

Obviously, key ### maps to certain keys. This can be tedious, as you mostly have to guess and check the key numbers.

Here is what I've found so far for mine, hopefully it helps:

keyboard layout

The next part is the mapping. Simply put the character or command, such as HOME after the key number.

The last part (WAKE/WAKE_DROPPED) determines if the key wakes the screen. WAKE=wake the screen WAKE_DROPPED=don't wake screen.

Now get it like you want it, and enjoy!

This will work with English-based keyboards, after that it's a little more guess and check, because you will need to know the foreign character that corresponds to the English character that corresponds to the key #.

share|improve this answer
2  
An easy solution for figuring out key mapping is CWM recovery's key test option. You press a key, it prints the number. –  Richard Borcsik Jun 8 '12 at 7:26
1  
@Thanks, It seems that these files just can be used to map physical keys to some predefined names, How I can map shift+space to "@" sign, or "?" to 'ə' letter? Where layout files for various languages are placed? How we can add a new languages to language list? –  PHPst Jul 22 '12 at 5:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.