We have a key F1 that is useless in our tv stick, and we want assign it to HOME button. How can we do that. It is not so difficult but we need to make some tweaks in our system. Lets try to learn how to make that.
There is a file in /system/usr/keylayout called Generic.kl ; in this file all keys in all keyboard gets a function assigned. So if we mod that file we can assign new functions to our keyboard useless keys. But if we mod this file all keyboards attached to our tv stick will get their keys preassigned. Some times that will be a bad idea so there is a more elegant way to do that.
We can create a new file what assign the new remap only to our usb device.
We need to be root (sorry no way to make that if you don't have root access), we need a file manager to copy, edit and modify files. I recommend you ES explorer. A terminal emulator is needed too. And a program who take our keys codes from our keyboard(keytest:https://github.com/chrisboyle/keytes...st.apk/qr_code).
Well, time to do it:
First we take note of what keys we want to remap, we open keytest and we take the codes of the keys that we want to remap:
For example:
In my keyboard i want HOME asiggned to F1; BACK asiggned to F2
So I push F1 and the app givews me the keycode 131 and when i push F2 y get the keycode 132
We must take note of that keys and their keycodes.
Open terminal emulator and write:
cat /proc/bus/input/devices
We get a list of all input devices attached our tv stick. We must search for the keyboard we want to remap. Something like:
I: Bus=0011 Vendor=0001 Product=0021 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input3
U: Uniq=
H: Handlers=sysrq kbd event3
B: PROP=0
B: EV=120013
B: KEY=10000 c020000000000 0 0 700f02000003 3803078f830f401 febfffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7
We must take note VENDOR and PRODUCT,
vendor:0001
product:0021
Now we copy Generic.kl > /sdcard/Vendor__Product_.kl (in my situation:Vendor_0001_Product_0021.kl)
Type carefully (case sensitive):
su
cp /system/usr/keylayout/Generic.kl /sdcard/Vendor_0001_Product_0021.kl
Now we open ES Filemanager and configure it (click in the 3 points in the botton bar) and click settings.
In Root settings we must select:
Root Explorer
Up to root
Mount system as R/W
When we finish this tweak maybe we want to take this to his initial position so deselect those options
And now we will edit our specific .kl file so we go to /sdacard and edit our vendor__product_.kl file
We search in the file for key 131(F11 in my keyboard) and assign HOME (or whatever function you want to remap), and we search too for key 132 and assign it BACK.
When we finish we save changes and exit.
Now we need to copy our keyboard specific file to /system/usr/keylayouy with ES filemanager.
Almost finished we need to change permissions to the file,so we make a long click on it and click in properties, we changue them to rw- r-- r-- and thats all. When we restart or minipc we get our keys remapped.
Remember to change root access in ES filemanager to default.
I hope I explain it clear, but if you have any dudes fell free to ask me. I did all the steps while i wrote that so I hope you can do the same. Corrections or better explications are welcome.
Comment