[MOD] Remap your hardware keys

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Thanks for your reply, epeereboom. I did find the ZIP packages to flash, but unless I'm mistaken, all those do is update the thunder_keypad.kl by flashing, whereas I did it manually via adb. Net result should be exactly the same, unless I'm wrong.

As a matter of fact, when I mentioned pushing the stock thunder_keypad.kl to the phone, I got that file from the stock rom ZIP on pg3--just extracted and pushed instead of flashing.

edit: and to clarify, hard buttons (except for the camera and voice search) are working, I just can't seem to get those two to mod (uh, or come back to life...)

Interesting...

Camera should work with the stock keymap assuming your camera apk is functioning properly.
The stock .kl file remaps the voice key but without the sprint voice search apk it doesn't function, nick7 has it somewhere in his public mediafire folders otherwise it's not included in reborn rom (this is why it doesn't work if mapped to voice).
Does the voice button work by default in reborn rom? As in it should pull up your phone apk.
 
  • Like
Reactions: theBIG

theBIG

Well-known member
Jan 9, 2011
55
8
0
Visit site
Interesting...

Camera should work with the stock keymap assuming your camera apk is functioning properly.
The stock .kl file remaps the voice key but without the sprint voice search apk it doesn't function, nick7 has it somewhere in his public mediafire folders otherwise it's not included in reborn rom (this is why it doesn't work if mapped to voice).
Does the voice button work by default in reborn rom? As in it should pull up your phone apk.


Hi sblood86, thanks for your reply. Yes, the voice button worked as Reborn ROM intended before remapping it.

Thanks for cluing me in about the requiring the Sprint APK, I'll search that one out. Must have missed that when I searched... I assumed having the current Google Voice Search apk was sufficient.

The Reborn camera apk is working fine, just can't seem to get the button to motivate it to do anything. :)

EDIT: pardon my ignorance... I found Nick7's mediafire page, and checked his folders--do I want voice_dialer.zip? (I also see SprintApp.zip, which includes the same apk as the voice_dialer.zip in addition to all the Sprint bloat.) I don't see anything specifically indicating voice search, and a quick search of Nick7's forum posts didn't turn up what I was looking for.

EDIT2: Apologies, apparently I'm a moron--the camera button IS working, if held down for a couple seconds. :-[ This is my dad's phone, so I'm not accustomed... however, mapping it to WAKE does not seem to be effective. I'd like to set it for instant access to the camera--can this be done?
 
Last edited:

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Hi sblood86, thanks for your reply. Yes, the voice button worked as Reborn ROM intended before remapping it.

Thanks for cluing me in about the requiring the Sprint APK, I'll search that one out. Must have missed that when I searched... I assumed having the current Google Voice Search apk was sufficient.

The Reborn camera apk is working fine, just can't seem to get the button to motivate it to do anything. :)

EDIT: pardon my ignorance... I found Nick7's mediafire page, and checked his folders--do I want voice_dialer.zip? (I also see SprintApp.zip, which includes the same apk as the voice_dialer.zip in addition to all the Sprint bloat.) I don't see anything specifically indicating voice search, and a quick search of Nick7's forum posts didn't turn up what I was looking for.

EDIT2: Apologies, apparently I'm a moron--the camera button IS working, if held down for a couple seconds. :-[ This is my dad's phone, so I'm not accustomed... however, mapping it to WAKE does not seem to be effective. I'd like to set it for instant access to the camera--can this be done?

Voice app is here.

rather than flashing the zip though I would probably recommend just taking the apk itself out and either install it from sd (which will put it in data) or push it to /system/app using adb and reboot.

Either case should install the app for you, if you flash the zip it's going to change all the key settings to stock and you may not want to redo everything.

As for waking and going directly to the camera I doubt it would work very well not particularly sure.
 
  • Like
Reactions: theBIG

theBIG

Well-known member
Jan 9, 2011
55
8
0
Visit site
Voice app is here.

rather than flashing the zip though I would probably recommend just taking the apk itself out and either install it from sd (which will put it in data) or push it to /system/app using adb and reboot.

Either case should install the app for you, if you flash the zip it's going to change all the key settings to stock and you may not want to redo everything.

As for waking and going directly to the camera I doubt it would work very well not particularly sure.
Thanks, sblood86... I'll push it via adb--quick and clean.

At the risk of going too far off-topic, that leads to another question--and then I'll leave you be, I promise! ;) Is there a good resource you'd recommend for learning about things like installing apps to /system/app vs /data/app, dos & don'ts, drawbacks, etc? For example, it looks like updates for /system/apps go to the /data/apps folder, can I save memory by pushing them over, is there potential for breaking something by doing that, etc. I guess I need to learn the basics of Android's file system--I see all these tutorials and guides for rooting and ROMs and whatnot, but not much about the underpinnings. If you might point me in the right direction to educate myself a bit, I'd appreciate it.

Thanks again for taking the time.
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Thanks, sblood86... I'll push it via adb--quick and clean.

At the risk of going too far off-topic, that leads to another question--and then I'll leave you be, I promise! ;) Is there a good resource you'd recommend for learning about things like installing apps to /system/app vs /data/app, dos & don'ts, drawbacks, etc? For example, it looks like updates for /system/apps go to the /data/apps folder, can I save memory by pushing them over, is there potential for breaking something by doing that, etc. I guess I need to learn the basics of Android's file system--I see all these tutorials and guides for rooting and ROMs and whatnot, but not much about the underpinnings. If you might point me in the right direction to educate myself a bit, I'd appreciate it.

Thanks again for taking the time.

No one source comes to mind, the AC community is awesome though so you should be able to find an answer to most of your questions.

A good rule of thumb with data vs system is to remember that anything you install in system cannot be updated via the market so if you install an app to system and it's updated the update will be installed to data. You can always manually update them later by pulling the apk from data and pushing it to system and rebooting. Otherwise yes you can get away with moving apps from data to system to free up some space on the data partition you just have to be mindful of which apps you are moving that way. I personally remove all other launchers and push golauncher to system so I don't have to worry about defaults (I have it in system cause I use data2ext and don't want my launcher running off the sd card), this does mean I have to manually update the launcher.
 

DarkRival

Member
Jan 13, 2011
10
2
0
Visit site
I'm trying to remap Search button to Notification on ZVH gROM. OP mentioned that he did this successfully but I've tried editting the key file on the phone and computer but can't get Notification remap to work. The Search buttong remaps to other functions fine like.. Play, Pause, Call.. I was trying to remap it to Zoom In or Notification. Maybe somethings different in zvh or gRom.
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
I'm trying to remap Search button to Notification on ZVH gROM. OP mentioned that he did this successfully but I've tried editting the key file on the phone and computer but can't get Notification remap to work. The Search buttong remaps to other functions fine like.. Play, Pause, Call.. I was trying to remap it to Zoom In or Notification. Maybe somethings different in zvh or gRom.

Interesting, I'll edit the OP as I just confirmed setting a key event of NOTIFICATION doesn't work in opti-rom either, it worked in the prior froyo roms, interesting that's for sure. I don't have a solution for you unfortunately.
 

epidenimus

Racer of Elevators
Apr 13, 2011
1,119
255
0
Visit site
This was very helpful, thank you! I was able to make the Home and Search buttons wake my phone in Reborn, which, combined with my case, is a nice way to get extra pocket dial protection and not be limited to just the power key.

You can do this on the phone, without another computer or ADB:

1. Use a file manager with root permissions, such as Root Explorer or Rhythm File Manager. Copy the layout file from /system/usr/keylayout/thunderc_keypad.kl to your home directory (SD card).

2. Use your favorite text editor (Jota text is awesome) to make your desired changes to the file you just pasted on the sd card and save.

3. Then just use the root file manager to move the modded file back to the /system/usr/keylayout/ directory. You may have to manually delete the original before pasting it back in place.

4. Finally, enter the following command into a terminal to get the permissions right:

Code:
chmod 644 /system/usr/keylayout/thunderc_keypad.kl

5. Reboot and enjoy!


I could probably do the whole file management part via terminal, too... but we might as well use these shiny graphical apps since we've got 'em. :)
 
Last edited:

jimatssf

Active member
Mar 17, 2011
30
0
0
Visit site
thank you very much.
is there a way to remap the headset key? I want to add functions, such as long press for recall. I think it is very useful when driving.
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
thank you very much.
is there a way to remap the headset key? I want to add functions, such as long press for recall. I think it is very useful when driving.

While possible it's not as simple as remapping a key event. Stock android key events can only do what is outlined in the OP really, anything beyond that is going to require an app to intercept the event and change the mapping in some way, button remapper does this but I've never used it or really researched the matter too much. Codewise my knowledge base is still fairly limited so I don't really have a lot of information on that.
 

hlxanthus

Well-known member
May 22, 2011
1,790
411
0
Visit site
How about assigning an app to the search key? I would like to link the market to it, as I use the market but never the use the search key as intended. Any clues?
 

jimatssf

Active member
Mar 17, 2011
30
0
0
Visit site
While possible it's not as simple as remapping a key event. Stock android key events can only do what is outlined in the OP really, anything beyond that is going to require an app to intercept the event and change the mapping in some way, button remapper does this but I've never used it or really researched the matter too much. Codewise my knowledge base is still fairly limited so I don't really have a lot of information on that.


I have used your shell rom keymap on my reborn ROM. It works fine. I like to use home button to wake my phone up so it is necessary to me.

thank you for response. you guys made a difference for others life. I really enjoy reading.
 

mikegerard

Member
Dec 2, 2010
24
0
0
Visit site
I'm trying to remap the power button (my power button is dying :(

I'm running button remapper and have been able to assign power to the search and voice buttons. I can use either of those buttons to power down. But neither button seems to work for power up.

Is power up hard wired to the power button?

Thanks,
Mike
 

koeylondon

Well-known member
Aug 21, 2012
226
2
0
Visit site
Hey all! Long time lurker, first post. Go me!

Question: I'm trying to do this process with an ICS build, and the screen still seems to wake on Menu and Back button presses. Is there something I'm missing? Or does there need to be new flashable zips for ICS?

FYI, I'm running Cold as Ice, the latest alpha build (Alpha16e).
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Hey all! Long time lurker, first post. Go me!

Question: I'm trying to do this process with an ICS build, and the screen still seems to wake on Menu and Back button presses. Is there something I'm missing? Or does there need to be new flashable zips for ICS?

FYI, I'm running Cold as Ice, the latest alpha build (Alpha16e).

Nah, shouldn't make a difference whether it's through a Zip or if you edit the .kl file manually...
Just locate the file and remove WAKE or WAKE_DROPPED from the end of back and menu; this will cause the phone to do nothing when the phone is asleep and those keys are pressed.
 

koeylondon

Well-known member
Aug 21, 2012
226
2
0
Visit site
Further research: After some poking, i'm having problems with this in ICS and JB. It seems that if I remap my keys so as to have none of the front hardware buttons with a "Wake" or "Wake_Dropped" command, my "Home" button begins misbehaving, essentially placing a "touch" in the center of my screen. I'll post a screenshot a bit later (my son just woke up. Daddy to bed sooner than anticipated).

Also, Home (and Search) continue to wake the screen. Has anyone else encountered strangeness like this?

Also... WTF did front buttons wake the screen by default. Did they make a deal with the battery manufacturers or something. "Yea, it'll be great, ya see? They'll have to recharge ever few hours, ya see?" (in my best Cagney)

Edit: Seems that the redundant "Home" keys have a strange effect on the hard buttons. Attached is a working .kl file that has only the power switch set to wake_dropped (similar to the Reborn key layout) Thanks to jstntp (the only person I can find that didn't thank someone else) for the zip that I replaced the layout key in (was originally for GB, but the file system and such seem to be the same, and it works fine).
 

Attachments

  • mod_no-buttons-wake-ICS.zip
    156.4 KB · Views: 10
Last edited:

koeylondon

Well-known member
Aug 21, 2012
226
2
0
Visit site
Question: is there an event that would allow me to use a hardware button to answer a phone call? I see a similar function available on the latest build of AOKP, but can't seem to identify a keypad call for the function. Thoughts?

Winter is coming... and touchscreens HATE gloves.
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Question: is there an event that would allow me to use a hardware button to answer a phone call? I see a similar function available on the latest build of AOKP, but can't seem to identify a keypad call for the function. Thoughts?

Winter is coming... and touchscreens HATE gloves.

AOKP and CM redirect the keys on a OS level via applications and java code instead of simply changing an entry in a .kl file; to my knowledge the android key events don't allow for that.

Random lifehacker tip that I've been meaning to test; sew small amounts of metal thread into the finger tips of your gloves (under the cloth just as a way to extend your conductivity a bit, don't want to scratch your screen with metal fingertips ;) )
 

koeylondon

Well-known member
Aug 21, 2012
226
2
0
Visit site
Well, that sucks! Does anyone have the know how to port that feature over? Or is that even possible? Is there an... app for that? ;-)
 

sblood86

Well-known member
Apr 12, 2011
426
103
0
Visit site
Well, that sucks! Does anyone have the know how to port that feature over? Or is that even possible? Is there an... app for that? ;-)

ButtonRemapper is a paid app that would accomplish that goal otherwise someone with more java familiarity could write something partly based off of the CM Settings app (I'd probably base it off the cm7/gingerbread branch) for that purpose (you could limit it to only remap the keys you have/want instead of sitting there porting all the functionality). That's not to say it would be easy but it's possible at least.