I originally wrote this up for the Optimus S forum; recently I was looking through this forum and I noticed several people asking the same thing asked on the S forum, so I decided I would go ahead and share. - Looking for the Optimus S thread, click here
Many people want to know how to change which buttons will wake their phone or if they can remap voice search to contacts or in the case of reborn rom users remap contacts back to voice search.
Just to get one bit out of the way:
Thread Rules:
-Your phone must be rooted before attempting to follow this guide: see gingersnap for one click root - Thanks Drew!
-Before doing anything remember to make a nandroid backup.
-This guide assumes you have a basic understanding of ADB, please do not post questions regarding setup of ADB in this thread
-Please do not use this thread for 'first posts' if you need to do a first post before downloading something please do so in the 'Introductions' thread.
I am still researching this matter and learning more daily, if anyone has any information to add to the following please post it and I will gladly update.
The keypad files are a text file of sorts and therefore relatively easy to edit, the easiest way is to pull the file using adb.
From your platform-tools directory (or wherever your adb is located) go ahead and mount your phone (note that if you have not been using adb on this boot of your computer it's going to start the server in a mount mode anyway so the following isn't always required)
(By default the optimus phones do not have a remount command included, this is added sometimes with the rooting method or by flashing a rom. If the above remount command does not work, try the following)
Pull the keypad file:
This is a simple text document and can be edited in most text editors, I would not recommend notepad.
If you are in need of a text editor I would recommend searching for gedit or notepad++ both should be free to download and can be found with your search engine of choice.
Stock Keypad:
The primary keys in question for the Optimus V are:
For example if you wanted to change your camera and voice search buttons to control music like I have done you could change the following keys:
The above would change your camera button to auto change to the next track when listening to music with the stock music player (or music mod if you are on reborn) and your voice search button to play/pause.
I use the above layout for my phone, I have found on occasion I have to reload my playlist after pausing my music but other than that I have music controls without waking my screen.
It is my understanding that at least most of the older Optimus V roms were built over S sources and kernels, because of this they had the menu and home keys set backwards. This guide was done with the stock layout in mind, so if you have issues try reversing keys 102 and 139.
For a list of more possible events to map your hardware keys check out 'KeyEvent | Android Developers'
Make sure the filter at the top is set to API level 10 (for froyo) or API level 11 (for gingerbread) and remove the KEYCODE_ from the front of the key change.
I have not tested all of these functions but I can confirm NOTIFICATION works as I have successfully mapped it to the search key using the following change:
Key events have three possible status' for NONE, WAKE or WAKE_DROPPED.
In the case of NONE the key will do nothing while the phone is asleep.
WAKE means that when the key is pressed the phone will wake and the command will be sent to the designated app.
WAKE_DROPPED will wake the phone but the command will not be passed to the designated app.
--Thanks to Overthinkingme for finding this information in button remapper and posting in in post #7 in the Optimus S thread.
Once you have made any changes to your .kl file you will need to push it back to the phone (if your computer has restarted or you experience issues pushing the file try remounting the system again using the commands outlined earlier), assuming the file is still in your adb directory you can:
Reboot your phone and enjoy.
This method will also work with a text editor locally on your phone, provided you have given the editor root access.
Many people want to know how to change which buttons will wake their phone or if they can remap voice search to contacts or in the case of reborn rom users remap contacts back to voice search.
Just to get one bit out of the way:
Myself, the devs and other users are in no way responsible for your device or data. We will not be held accountable for any damage to your device or lost data resulting from following this thread or any other.
Thread Rules:
-Your phone must be rooted before attempting to follow this guide: see gingersnap for one click root - Thanks Drew!
-Before doing anything remember to make a nandroid backup.
-This guide assumes you have a basic understanding of ADB, please do not post questions regarding setup of ADB in this thread
-Please do not use this thread for 'first posts' if you need to do a first post before downloading something please do so in the 'Introductions' thread.
I am still researching this matter and learning more daily, if anyone has any information to add to the following please post it and I will gladly update.
The keypad files are a text file of sorts and therefore relatively easy to edit, the easiest way is to pull the file using adb.
From your platform-tools directory (or wherever your adb is located) go ahead and mount your phone (note that if you have not been using adb on this boot of your computer it's going to start the server in a mount mode anyway so the following isn't always required)
Code:
adb remount
Code:
adb kill-server
adb start server
Pull the keypad file:
Code:
adb pull /system/usr/keylayout/thunder_keypad.kl
This is a simple text document and can be edited in most text editors, I would not recommend notepad.
If you are in need of a text editor I would recommend searching for gedit or notepad++ both should be free to download and can be found with your search engine of choice.
Stock Keypad:
Code:
#
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 HOME WAKE
key 60 SOFT_RIGHT WAKE
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 139 MENU 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 ENDCALL 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 213 DEL WAKE_DROPPED
key 355 DEL WAKE_DROPPED
key 212 CAMERA
key 247 FOCUS
key 217 SEARCH WAKE_DROPPED
key 216 VOICE
key 226 HEADSETHOOK WAKE
key 116 POWER WAKE
key 107 ENDCALL WAKE_DROPPED
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 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 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 28 ENTER
key 56 ALT_LEFT
key 42 SHIFT_LEFT
key 215 AT
key 57 SPACE
key 53 SLASH
key 127 SYM
key 100 ALT_RIGHT
key 399 GRAVE
The primary keys in question for the Optimus V are:
Code:
key 139 MENU
key 102 HOME
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 212 CAMERA
key 247 FOCUS
key 217 SEARCH
key 216 VOICE
key 116 POWER
For example if you wanted to change your camera and voice search buttons to control music like I have done you could change the following keys:
Code:
key 212 MEDIA_NEXT
key 216 MEDIA_PLAY_PAUSE
The above would change your camera button to auto change to the next track when listening to music with the stock music player (or music mod if you are on reborn) and your voice search button to play/pause.
I use the above layout for my phone, I have found on occasion I have to reload my playlist after pausing my music but other than that I have music controls without waking my screen.
It is my understanding that at least most of the older Optimus V roms were built over S sources and kernels, because of this they had the menu and home keys set backwards. This guide was done with the stock layout in mind, so if you have issues try reversing keys 102 and 139.
For a list of more possible events to map your hardware keys check out 'KeyEvent | Android Developers'
Make sure the filter at the top is set to API level 10 (for froyo) or API level 11 (for gingerbread) and remove the KEYCODE_ from the front of the key change.
I have not tested all of these functions but I can confirm NOTIFICATION works as I have successfully mapped it to the search key using the following change:
Code:
key 217 NOTIFICATION
Key events have three possible status' for NONE, WAKE or WAKE_DROPPED.
In the case of NONE the key will do nothing while the phone is asleep.
WAKE means that when the key is pressed the phone will wake and the command will be sent to the designated app.
WAKE_DROPPED will wake the phone but the command will not be passed to the designated app.
--Thanks to Overthinkingme for finding this information in button remapper and posting in in post #7 in the Optimus S thread.
Once you have made any changes to your .kl file you will need to push it back to the phone (if your computer has restarted or you experience issues pushing the file try remounting the system again using the commands outlined earlier), assuming the file is still in your adb directory you can:
Code:
adb push thunder_keypad.kl /system/usr/keylayout/
Reboot your phone and enjoy.
This method will also work with a text editor locally on your phone, provided you have given the editor root access.
Last edited: