Lasersköld

2013-05-23

#teknik

Swedish letters and dvorak-layout on usb-keyboard on the Nexus 7

I've finally got some routine on changing the keyboard layout on my Nexus 7 (and what I know the procedure is the same for all android devices). This is a notice for future use, and if somebody has the same issues.

1. Get files from the device

adb pull /system/usr/keychars/Generic.kcm Generic.kcm
adb pull /system/usr/keylayout/Generic.kl Generic.kl

the kcm-file to set the swedish signs, and the kl-file to change layout. If you only want the swedish letters then you only need to change the kcm file and only the kl-file if you only want to change the layout (location of the keys). Notice that the device sometimes automatically changes to swedish letters, so the kcm-change is not always necessary.

Remember to save backups!

2. Change the files

I found a reference to a file that got the swedish (and finish) letters of the alphabet. Especially the parts in the kcm-file saying

key APOSTROPHE {
    label, number:                          '\''
    base:                                   '\u00e4'
    shift:                                  '\u00c4'
    ctrl, alt, meta:                        none
}
key SEMICOLON {
    label, number:                          ';'
    base:                                   '\u00f6'
    shift:                                  '\u00d6'
    ctrl, alt, meta:                        none
}

and

key LEFT_BRACKET {
    label, number:                          '['
    base:                                   '\u00e5'
    shift:                                  '\u00c5'
    ctrl, alt, meta:                        none
}

And of course because I use dvorak, I also have the appropriate dvorak Generik.kl-file

key 1     ESCAPE
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 12    GRAVE
key 13    EQUALS
key 14    DEL
key 15    TAB
key 16    LEFT_BRACKET
key 17    APOSTROPHE
key 18    SEMICOLON
key 19    P
key 20    Y
key 21    F
key 22    G
key 23    C
key 24    R
key 25    L
key 26    COMMA
key 27    RIGHT_BRACKET
key 28    ENTER
key 29    CTRL_LEFT
key 30    A
key 31    O
key 32    E
key 33    U
key 34    I
key 35    D
key 36    H
key 37    T
key 38    N
key 39    S
key 40    MINUS
key 41    APOSTROPHE
key 42    SHIFT_LEFT
key 43    BACKSLASH
key 44    PERIOD
key 45    COMMA
key 46    J
key 47    K
key 48    X
key 49    B
key 50    M
key 51    W
key 52    V
key 53    Z

Push files to the device

And when you are ready, use some useful tool to push the files back again (remount to make the system writable)

adb remount /system/usr/keychars 
adb remount /system/usr/keylayout
adb push Generic.kcm /system/usr/keychars
adb push Generic.kl /system/usr/keylayout

4. Debug

Something can easily go wrong. If so, make sure to change the logcat print. Write in terminal

su
logcat

In the worst case, push the backup-files back again.

Problems that I had:

  • I wrote the kcm-file wrong. You cannot make up new letters, that will cause an error.
  • I got the wrong user access set on the files. I sudoed in the files so the system could not use the files. Fixed with chmod.
  • I cannot write z... Not fixed. Don't know any workaround...

Hope it helps! Post a comment if it doesn't.

Cheers!


Andra inlägg från bloggen

2024

Använda cpp som ett skriptspråk (2024-12-03)

Mekaniskt tangentbord Lasersköld L1 del 1 (2024-11-14)

Alphasmart neo 2 font editor (2024-10-11)

Bloggen är äntligen fyttad (2024-09-24)

2022

Figurer i skuggan (2022-06-04)

2018

prestandatest pa morgonen c (2018-11-21)

2017

Framsteg och frustration (2017-08-31)

2015

fix audacity startup bug on ubuntu 1510 (2015-11-24)

git subtree (2015-06-21)

add native code to android studio (2015-06-21)

2014

Ingenting (2014-11-08)

Äldre inlägg...