[HOWTO] Remap Hardware Buttons - Gen8 General

When you move your software buttons to status bar, there is a problem with apps that cover full screen and don’t have “menu” or “back” button. For example “Gallery”. You have to push longer power buttons and switch to buttons mode to end application or get to menu. I have found this quite irritating so I prefer to have “one click” button to get this working. When you get lcd density to 130, your status bar is very small and is difficult to touch soft buttons.
By editing file /system/usr/keylayout/qwerty.kl you can remap your buttons.
Note that this require permanent root with rw access to system partition.
Ive tested this on Archos 70 rotted with OC kernel http://forum.xda-developers.com/showthread.php?t=897877 it should work with chulri method http://forum.xda-developers.com/showthread.php?t=930197 and UrukDroid http://forum.xda-developers.com/showthread.php?t=895599.
Thx guys for great work
Doesn’t work with Archangel because it needs rw acces to /system/.
Maybe some “magic” can make a script to force android to use keyboard layout from different location (sdcard for example).
Like with all operations on system files, you can broke your system when something goes wrong. Remember, I'm not responsible for anything.
If you use other keyboard than default you probably have to edit another file from /system/usr/keylayout/. I’ve tested this only for standard keyboard.
After made changes to qwerty.kl you have to restart device.
In this example I’ve remapped + button as “Menu” and Volume – as “Back”.
Remember that you will loose ability to control volume with hardware buttons.
To set to default mapping simply copy original file or edit it and restart device.
Before you start, make a backup of original file.
Go to terminal:
Code:
su
cp /system/usr/keylayout/qwerty.kl /system/usr/keylayout/qwerty.kl.org
Next, open /system/usr/keylayout/qwerty.kl file with text editor
And find line
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
These are our hard buttons.
Change it to
key 115 MENU
key 114 BACK
key 116 POWER WAKE
Restart android and you have Menu under volume+ and back under volume-
To reset to default, simply go to terminal and:
Code:
su
cp /system/usr/keylayout/qwerty.kl.org /system/usr/keylayout/qwerty.kl
and reboot.
Of course feel free to experiment to other button mapping. :]

very nice. Will be trying this out for sure. Was looking for a better way than button Savior / buttons panel.
Will test during my very busy Friday afternoon work day
Can't "thanks" from tapatalk but will be sure to get you later
Sent from my A101IT using Tapatalk

Nice added to the list of modifications possible with the different root methods here

diabel44 said:
When you move your software buttons to status bar, there is a problem with apps that cover full screen and don’t have “menu” or “back” button. For example “Gallery”. You have to push longer power buttons and switch to buttons mode to end application or get to menu. I have found this quite irritating so I prefer to have “one click” button to get this working. When you get lcd density to 130, your status bar is very small and is difficult to touch soft buttons.
By editing file /system/usr/keylayout/qwerty.kl you can remap your buttons.
Note that this require permanent root with rw access to system partition.
Ive tested this on Archos 70 rotted with OC kernel http://forum.xda-developers.com/showthread.php?t=897877 it should work with chulri method http://forum.xda-developers.com/showthread.php?t=930197 and UrukDroid http://forum.xda-developers.com/showthread.php?t=895599.
Thx guys for great work
Doesn’t work with Archangel because it needs rw acces to /system/.
Maybe some “magic” can make a script to force android to use keyboard layout from different location (sdcard for example).
Like with all operations on system files, you can broke your system when something goes wrong. Remember, I'm not responsible for anything.
If you use other keyboard than default you probably have to edit another file from /system/usr/keylayout/. I’ve tested this only for standard keyboard.
After made changes to qwerty.kl you have to restart device.
In this example I’ve remapped + button as “Menu” and Volume – as “Back”.
Remember that you will loose ability to control volume with hardware buttons.
To set to default mapping simply copy original file or edit it and restart device.
Before you start, make a backup of original file.
Go to terminal:
Code:
su
cp /system/usr/keylayout/qwerty.kl /system/usr/keylayout/qwerty.kl.org
Next, open /system/usr/keylayout/qwerty.kl file with text editor
And find line
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 116 POWER WAKE
These are our hard buttons.
Change it to
key 115 MENU
key 114 BACK
key 116 POWER WAKE
Restart android and you have Menu under volume+ and back under volume-
To reset to default, simply go to terminal and:
Code:
su
cp /system/usr/keylayout/qwerty.kl.org /system/usr/keylayout/qwerty.kl
and reboot.
Of course feel free to experiment to other button mapping. :]
Click to expand...
Click to collapse
diabel44 said:
I
Click to expand...
Click to collapse
I have edited .kl file using both ES File Explorer & adb shell , but edited file is restoring to previous on reboot. Is there a way to permanently change the .kl files

MASTER MC said:
I have edited .kl file using both ES File Explorer & adb shell , but edited file is restoring to previous on reboot. Is there a way to permanently change the .kl files
Click to expand...
Click to collapse
I got it. It should be edited and changed to /system using twrp recovery.
I mapped volume button to power. It works correctly only when device is powered on and it doesnot reboot when shutdown. Can u tell me where I should make changes to work to power on the device .

Related

/system/build.prop tweaks

I'm not responsible to any damage which is caused by applying any modification listed below to your phone.
Backup
If you made mistake to this file, you phone will not boot in gui, so you should always backup the file before you make any change to it. Just use any file manager to copy the file to your sd card or your pc.
Restore
If you have a Linux machine you can mount the /system partition while plugging in with the purple screen (vol up + vol down + power).
Easiest way: get Ubuntu, put your phone in purple screen, plug in with USB, you will see the system partition at your Ubuntu desktop.
The hard way: if the /system partition is no accessible under purple screen mode (such as in the latest 528 rom), you can use adb push the backup file back, search the web for details about how to use adb.
I'm digging the build.prop, some apps can do some of these tweaks for you, but I prefer typing myself. You need to reboot the phone to take effect.
1. windowsmgr.max_events_per_sec=75
add this new line to make UI more responsive, the bigger the value the more responsive, I've tried 90, too fast, fall back to 75, still quite fast
2. ro.config.hw_menu_unlockscreen=false
change value from "false" to "true" to enable menu key unlocking screen
3. ro.sf.lcd_density=240
change to 225 to increase the resolution of display, as a result, the size of icon on home page and fonts of list (of file manager or contact) become smaller, the smaller the value the smaller size of icon and fonts
4. dalvik.vm.heapsize=24m
increase the value to 32m~48m to increase stability and performance, tested but doesn't see much effect so far
all so if you tried games like nova or brother in arms that have black screen or graphic probs do this they now all work
go to /system/build.prop and edit it to this then close and turn the phone off / on do a build.prop DO A BUILD.PROP BACKUP FIRST ALLWAYS A MUST BEFOR PLAYING AROUND.
once the phone is on go to settings about phone model number and it will say Desire HD.
Then download games for the htc desire hd and it works.
if you want it back to standed just replace it with the backup
i think the suggestions are great!
big thx!!!
thanks for the share
Do I just change the name, where it says build.prop now?
sorry there are still some games that wont work like brother in arms 2 and modern combat black pegasus but all the others work like
splinter cell
sandstorm
n.o.v.a.
and so on
your phone hast to be rooted and use root explorer and go to
/system/build.prop and open and edit the text then reboot your phone
backed up the build.prop and made the changes. On restart it hangs on boot screen (huawei name and logo) I have to remove the battery to switch off. tried connecting to the PC to restore build.prop but it doesnt load the phone memory. Only launches the mobile partner autostart. Also tried updating by adding update.zip to sd card but says signature verification failed. Tried lading general update from huaweidevice.com onto dload directory on sd card, Just shows purple screen on booting with power, vol up and down. Please advice.
adrdsouza said:
backed up the build.prop and made the changes. On restart it hangs on boot screen (huawei name and logo) I have to remove the battery to switch off. tried connecting to the PC to restore build.prop but it doesnt load the phone memory. Only launches the mobile partner autostart. Also tried updating by adding update.zip to sd card but says signature verification failed. Tried lading general update from huaweidevice.com onto dload directory on sd card, Just shows purple screen on booting with power, vol up and down. Please advice.
Click to expand...
Click to collapse
If you have a Linux machine you can mount the /system partition while plugging in with the purple screen (vol up + vol down + power).
Easiest way: get Ubuntu, put your phone in purple screen, plug in with USB, you will see the system partition at your Ubuntu desktop.
Thank you..a mate uses linux so went over and it worked like a charm. I hadn't put the 'm' at the end in 'dalvik.vm.heapsize=24m' but it is sorted now. Thanks again.
Hi there.Is there any value in build.prop file to decrease the time that the screen rotates?I measure that the default time is about 1sec.I want it 500ms or lower.
ive root and root explorer, but when i try to edit the build.prob it says that its read only rom .
whats the problem?
sry for my bad english
In the top right hand corner there is a button which says 'mount r/w' press it and your filesystem will be read/write. Then make the changes to build.prop then press the button again then reboot.
volume headphones?
Where can I find the file corresponding to the volume of the sound through headphones? A similar problem occurred on the ZTE, but was repaired in the new ROM.
Piron said:
Where can I find the file corresponding to the volume of the sound through headphones? A similar problem occurred on the ZTE, but was repaired in the new ROM.
Click to expand...
Click to collapse
/system/etc/hwVolumeFactor.cfg
iamelton said:
/system/etc/hwVolumeFactor.cfg
Click to expand...
Click to collapse
I found the compination of speaker=80 and wired_headset=80 pretty cool.Has anyone found a better setting?
headphone volume
80 is too much. For me the best settings are:
- speaker 75 (default)
- Headphones 70 (higher values ​​will cause the overload of sound)
With this setup is really cool .
Swype
The original ROM is installed Swype keyboard, but not in the Polish language. It is not possible to uninstall Swype and you can not install a new keyboard. Despite the ROOT system does not allow the removal of the keyboard ("cust/hw/ideos_x5/app / "). Does anyone know how to remove the keyboard, or where to replace your dictionary?
adrdsouza said:
Thank you..a mate uses linux so went over and it worked like a charm. I hadn't put the 'm' at the end in 'dalvik.vm.heapsize=24m' but it is sorted now. Thanks again.
Click to expand...
Click to collapse
unfortunately I've got the same problem with you, I changed a file's name in the system/ directory now the phone bricks. I mounted it on mu ubuntu laptop and found that file but it says I have no permission to change it back...what should do now?
edit: never mind, I got it solved with sudo. I am a stupid linux noobie.
I just opened the file, but there's no "windowsmgr.max_events_per_sec" in it, i found the rest (2-4), does someone know why?
Edit: after applying the B160 ROM, i found this line, works great

Stop Home key from waking screen

**Must have root**
As the title says, stop your home key from waking your device.....(then only power button wakes it up )
you can do this simply with root explorer
(THERE ARE OTHERS TO USE MAYBE EVEN FREE, THIS IS ALL I HAVE EVER USED IS ALL)
ONLY MODIFY THE FILE SPECIFIED!
OR PLAY AROUND AT YOUR OWN RISK AS NOTHING OTHER THAN MENTIONED FILE IS TESTED....
open root explorer
navigate to : system/usr/keylayout
now press the mount r/w button near the top of screen to enable read and write permissions
scroll down to: sec_keys.kl
press and hold until menu pops up, select: Open in Text Editor
locate line: key 172 HOME WAKE
tap behind the word WAKE and delete it so you see: key 172 HOME
press menu and select: Save and Exit
now press the button at the top of the screen to disable read and write permissions: Mount R/O
(once pressed should now read : Mount R/W again.
Exit root explorer
Reboot your phone
see if it works
Credit goes to Eric
I don't have that file in /system/usr/keylayout, i have wanamlite 1.8 rom.
Thank you very much!
This works on my T999 (TMO SIII)
Where is this mysterious keyboard layout file on a STOCK rom?
EDIT: nvm got it I suppose it's gpio-keys.kl

[Q] Remap S4 buttons like S5

I wanted to know how can i remap the buttons of S4 and make them like S5, I had Ozcan Rom 4.4.2 on my i9500 but after upgrading to Lollipop the buttons are changed.
I want that the right soft button will be recent apps and the middle button to be Home, and change also the long press buttons ?
Hi,
For long press I don't know how to configure. And do you mean nav bar or physical ones?
If navbar you have to see for the ROM settings, if you mean the physical ones you'll have to edit this file:
/system/usr/keylayout/sec_touchkey.kl
I believe you've mistyped the configuration you want, I believe you meant left button for Recent and right button for back (like S5). Then, change it, so it looks the following:
Code:
key 139 APP_SWITCH
key 158 BACK
key 102 HOME
key 217 SEARCH
You can make the edits using a terminal or a file manager with text editor that has root access. Remember to mount system as RW before!! To do it on terminal, input:
Code:
su
mount -o rw,remount /system
All the best,
~Lord
"This Story Ends Where It Began" - Octavarium (Dream Theater)
Sent from my GT-i9505

SWAP back and recent apps keys Marshmallow 6.0.1 (need root)

goto your favorite file explorer. i used root explorer. make sure you have root access and goto /system/usr/keylayout and then make sure you have read write access. then click on generic.kl
change line key 158 to APP_SWITCH
change line key 254 to BACK
make sure to save. reboot. back key should now be on left. recent apps on right. you can still hold your recent apps key which is now on the right to get menu in some apps.
and for my next trick... modding s pen to left side of note 4. just kidding. enjoy.
Is this safe?
its only for galaxy?;I need on moto g (aosp, MM). on screen key.
Yes very safe. Yes only for galaxy. Not sure how you do it with moto g. You could try developer options RTL mode and see if that works but will RTL everything else. Or you could try my method and see if you could swap the back and recent apps same way but different lines. That is if moto g is setup similar.

[Workaround] [Howto] Using the left button on Elephone P9000, CM13, Deepflex

You need root access and "Buttons remapper" from Playstore.
- move to '/system/usr/keylayout' and edit 'mtk-kpd.kl'
- at the bottom of the file insert a line 'key 250 BUTTON_16'
- reboot the phone
- map 'BUTTON_16' with "Buttons remapper" to e.g. "Open Open Camera"
- enjoy
I don't know if this has any sideeffects, i just wanted to have this button work right now I think you need the full version of "Buttons remapper".
chepaz said:
You need root access and "Buttons remapper" from Playstore.
- move to '/system/usr/keylayout' and edit 'mtk-kpd.kl'
- at the bottom of the file insert a line 'key 250 BUTTON_16'
- reboot the phone
- map 'BUTTON_16' with "Buttons remapper" to e.g. "Open Open Camera"
- enjoy
I don't know if this has any sideeffects, i just wanted to have this button work right now I think you need the full version of "Buttons remapper".
Click to expand...
Click to collapse
The free version works just fine, been using it on stock ROM for quite a while
Jonny said:
The free version works just fine, been using it on stock ROM for quite a while
Click to expand...
Click to collapse
Thanks for this hint. I bought it someday, so i didn't know if the "free"-version is just enough.
Hi.
What is a number of left hand said buttons in keylayout file?
I want to use is as a power button.
sqrwiel said:
Hi.
What is a number of left hand said buttons in keylayout file?
Click to expand...
Click to collapse
I'm not shure i get your point, but the key returns the code '250'. In the example above it is mapped to BUTTON_16 which is interpretet by 'Buttons remapper'. There you can configure the action of your desire.
In the latest CM13 from Deepflex this workaround is not needed anymore, theres now a beautiful build-in configuration.
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 230 SOFT_RIGHT
key 60 SOFT_RIGHT
key 107 ENDCALL
key 62 ENDCALL
key 229 MENU
key 59 MENU
key 127 SYM
key 217 SEARCH
key 228 POUND
key 227 STAR
key 231 CALL
key 61 CALL
key 232 DPAD_CENTER
key 108 DPAD_DOWN
key 103 DPAD_UP
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 113 MUTE
key 116 POWER
key 212 CAMERA
key 211 FOCUS
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
key 164 MEDIA_PLAY_PAUSE
key 128 MEDIA_STOP
key 163 MEDIA_NEXT
key 165 MEDIA_PREVIOUS
key 168 MEDIA_REWIND
key 159 MEDIA_FAST_FORWARD
#key 249 FUNC1 WAKE
#key 250 FUNC2 WAKE
This is a full list of mtk keylayout
I need move my broken power <wake_up_screen> from right to left.
sqrwiel said:
I need move my broken power <wake_up_screen> from right to left.
Click to expand...
Click to collapse
Ah, ok. Current i'm on "Final Build 2". Mapping the Keycode 250 to something else seems to have no effect anymore. All i got is the "default" behaviour which puts the phone in "mute mode". "Key event display" doesn't show up an keycode then, "Button remapper" seems also useless.
Depending on the ROM-version you use there possibly is a way to remap this button like you want it to - but i have no idea how to achieve this in "Final Build 2". Sorry, i can't help.
I'm on last update of CM and its not working(( pretty bad, it will be awesome to get it work... Please help us))
---------- Post added at 11:38 AM ---------- Previous post was at 10:47 AM ----------
I fell so dumb :laugh: On last CM release you have an app for this in menu : Shortcut button settings
I spent 6 hours because of that, like retarded.... ?
I've been using it with Xposed Additions module... it's recognized as Button 277. I use it as media play/pause when screen is off and as Menu button when screen is on.
K-S-D said:
I'm on last update of CM and its not working(( pretty bad, it will be awesome to get it work... Please help us))
Click to expand...
Click to collapse
Hi, I had the same problem and have created a patch to be able to configure the LEFT KEY as MENU or any other code you want. Hope it is useful for anybody!
PATCH: Use LEFT BUTTON as MENU KEY / GOOGLE NOW on long press
ELEPHONE P9000 / Cyanogen CM13 final build
Code:
filedropper.com/elephonep9000deepflexcm13patchmenuonleftkey_1
This is a patch for DeepFlex CM13 final build that configures the Elephone Left Key as the missing MENU key, neccessary for some applications. It is needed a patch at keyboard driver level, because the cyanogen driver included captured the keycode of the left key (250) to do the hardcoded actions of muting the phone or running the custom application selected in the elephone app (com.shev.elebuttonsettings). Unfortunately that app is unable to set MENU key as the action, otherwise this patch won't be neccessary.
After applying the patched com.cyanogenmod.keyhandler.jar, the keycode will not be intercepted and be available to Android. So you can use the mtk-kpd.kl as usual to map it to any key or button. Please mind that you will lose the existing left key functionality (elebuttons app + mute phone) getting instead the standard menu key, that will also fire up Google Now on long press.
It would be cool if @Deepflex would kindly consider the option if e has the time to make the hardcoded action optional or enhance the elebuttons app to support system keys.
There are two files:
com.cyanogenmod.keyhandler.jar
- This file has to be copied to /system/framework in your android device.
- You should backup the existing file to revert the changes
- This patched version just disables the hardcoded behaviour of the LEFT KEY, that executed the app com.shev.elebutton, letting instead then Android use the keycode normally.
mtk-kpd.kl
- this file has to be copied to /system/usr/keylayout/
- Here we map the LEFT KEY (code 250) to the MENU key (or whatever other key you want)
INSTALLATION
There may be other ways, but in resume you need to be root to enable writing on the /system/ folder and copy the patch files to the required locations.
STEP 1: Copy the patch files into the phone sdcard
via adb from your computer, in the directory where these patch files are located:
Code:
adb push com.cyanogenmod.keyhandler.jar /sdcard/
adb push mtk-kpd.kl /sdcard/
adb shell
these two copy the patch files from your computer to the sdcard, and enter the phone.
(NOW YOU'RE ON THE PHONE)
STEP 2: Become superuser and enable write on system partition
You might need to enable root requests on the developer settings. ( "root: apps and adb")
Code:
su
mount -o rw,remount,rw /system
become superuser (you should see "[email protected]:/ #" if you are root), and then enables writing on the system partition.
STEP 3: copy the patch files, that should be in /sdcard/
Code:
cp /sdcard/com.cyanogenmod.keyhandler.jar /system/framework/
cp /sdcard/mtk-kpd.kl /system/usr/keylayout/
STEP 4: Wipe Dalvik cache
WARNING: THE FOLLOWING COMMAND WILL ERASE THE DALVIK CACHE.
BE VERY VERY SURE THAT YOU TYPE IT EXACTLY AS IT IS, BECAUSE
ANY MISSPELLING CAN DELETE EVEN THE WHOLE OPERATING SYSTEM.
If you are scared, just skip this step, and wipe the DALVIK CACHE
from TWRP
Code:
rm -r /data/dalvik-cache
STEP 5: Revoke write permission
Code:
mount -o ro,remount,ro /system
STEP 5: Reboot the phone.
- If you wiped dalvik cache, just reboot normally
Code:
reboot
- If you didn't, reboot into recovery mode and wipe the cache from there.
Code:
reboot recovery
Hope this is useful to somebody!!

Categories

Resources