I see a lot of posts of people asking how to change which buttons wake their phone or asking if they can remap voice search to contacts or in the case of reborn rom remap contacts back to voice search. (Looking for the Optimus V thread? Click here.)
I'm sure someone has posted a walk through on this somewhere but I've yet to find it; so I decided to find the answers myself.
Just to get one bit out of the way:
Thread Rules:
-Your phone must be rooted before attempting to follow this guide.
If you have the ZVD baseband see gingersnap for one click root - Thanks Drew!
Otherwise if you have ZVH baseband check out How to root LS670ZVH for a great walkthrough - Thanks sfhub!
-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)
	
	
	
		
The only real difference between the keypads in ZVD and ZVH OS versions is the file name. ZVH they added the c in thunderc instead of just having it marked as thunder_keypad other than that the only difference is a set of comments around the voice button, being comments I've decided not to add them to my example.
Pull the keypad file:
For ZVD baseband.
	
	
	
		
For ZVH baseband.
	
	
	
		
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 S 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.
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:
	
	
	
		
Interestingly enough it turns out that the key even NOTIFICATION doesn't seem to work when mapped in ZVH, at least not to search, I havn't tried it with any other key.
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.
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:
For ZVD baseband.
	
	
	
		
For ZVH baseband.
	
	
	
		
Reboot your phone and enjoy.
This method will also work with a text editor locally on your phone: remapped my search key earlier in a failed attempt to figure something out.
On the plus side I can confirm local text editors do work
				
			I'm sure someone has posted a walk through on this somewhere but I've yet to find it; so I decided to find the answers myself.
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.
If you have the ZVD baseband see gingersnap for one click root - Thanks Drew!
Otherwise if you have ZVH baseband check out How to root LS670ZVH for a great walkthrough - Thanks sfhub!
-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
	The only real difference between the keypads in ZVD and ZVH OS versions is the file name. ZVH they added the c in thunderc instead of just having it marked as thunder_keypad other than that the only difference is a set of comments around the voice button, being comments I've decided not to add them to my example.
Pull the keypad file:
For ZVD baseband.
		Code:
	
	adb pull /system/usr/keylayout/thunder_keypad.kl
	
		Code:
	
	adb pull /system/usr/keylayout/thunderc_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 S 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.
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
	Interestingly enough it turns out that the key even NOTIFICATION doesn't seem to work when mapped in ZVH, at least not to search, I havn't tried it with any other key.
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.
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:
For ZVD baseband.
		Code:
	
	adb push thunder_keypad.kl /system/usr/keylayout/
	
		Code:
	
	adb push thunderc_keypad.kl /system/usr/keylayout/
	Reboot your phone and enjoy.
This method will also work with a text editor locally on your phone: remapped my search key earlier in a failed attempt to figure something out.
On the plus side I can confirm local text editors do work
			
				Last edited: 
				
		
	
										
										
											
	
										
									
								
	