[GUIDE] Remap hardware buttons

Search This thread

jelbo

Senior Member
/edit: this guide is now obsolete because Xposed Additions now has button remapping with some advanced options, which also seem to enable volume wake on my HTC One :)

If you hate locking and unlocking your HTC One with the Power button, you can change that quite easily int for example Volume Down.

ButtonRemapper would be the easiest method, but it doesn't work with the HTC One. It doesn't load the correct file.

The solution: simply edit the correct file
Code:
keypad_8960.kl
found in
Code:
/system/urs/keylayout/
by hand (I used Fx File Explorer with the paid Root plugin) and reboot your phone. My edited file is attached on this post.

Original:

Code:
key 116   POWER            WAKE_DROPPED
key 114   VOLUME_DOWN       WAKE
key 115   VOLUME_UP         WAKE

key 107   ENDCALL           WAKE_DROPPED

My current file that switches the Volume Down and Power button:

Code:
key 116   VOLUME_DOWN            WAKE
key 114   POWER       WAKE_DROPPED
key 115   VOLUME_UP         WAKE

key 107   ENDCALL           WAKE_DROPPED

I don't know if the same file is used on different ROMs. I tested this on the P.A.C. Man ROM.

Now waking my One is a breeze! :laugh:

P.S. You may need the following workaround to fix the 'volume wake not working' bug present in some (or all?) JB ROMs, which strangely also affects this tweak (symptom: volume down won't wake phone sometimes).

1. Install Xposed Framework (which you should anyway, it's awesome)
2. Install MoDaCo Toolkit
3. Wait for the annoying ad (Paul, tsk, tsk) and enable the option 'HTC One > Enable Volume Wake'
4. Enable MoDaCo Toolkit in Xposed
5. Reboot
6. Profit ^_^
 

Attachments

  • keypad_8960.zip
    307 bytes · Views: 356
Last edited:

baste07

Senior Member
Jun 22, 2009
4,454
275
Manila
But remapping it that way does it mean if you want to lower the volume you press the power button?

Sent from my HTC One using Tapatalk 2
 

Syn Ack

Senior Member
Jan 20, 2011
1,627
421
Atlanta
While locking the phone with volume down would be nice, it prevents you from turning the volume down/vibrate/off. Which is pretty important.

Although you could alternatively hit Volume Up and then drag the slider via the touchscreen.

BTW I tried this on TrickDroid 4.2.2 and it works.
 
Last edited:

jelbo

Senior Member
While locking the phone with volume down would be nice, it prevents you from turning the volume down/vibrate/off. Which is pretty important.

Although you could alternatively hit Volume Up and then drag the slider via the touchscreen.
Actually, the adjustment only swaps the buttons, so the physical Power button acts as Volume Down :)

I'm still having issues with the adjustment though, has anyone tried it and got it working correctly all the time? I also edited Generic.kl and qwerty.kl, but that didn't help. Pacman ROM 2.9.
 
Last edited:

rollsrd

Senior Member
Apr 23, 2013
54
30
Is there any way to use his once you're in the camera . Since we don't have a dedicated camera button it would be great to set up the volume key to take pictures ? :)

Sent from my HTC One using xda app-developers app
 

L0rdGyZmO

New member
Feb 17, 2014
1
0
Problem...

Volume wake bug workaround added to OP.


I have multiple problems guys:

Rooted...double checked if it's rooted (htc one) - then installed Xposed...mods...guess what? it worked for a few hours then all of the sudden...Framework disabled...pushed Install again...and then one of 2 things happen:

1 - phone reboots
2 - Installed and notification for SU....but when restarting my phone the framework it's NOT installed....wtf?!?
 

aarongillion63

Senior Member
Apr 13, 2014
253
137
Grand Rapids MI
aaron.gillion.io
Solutions errybody

Correct. I'm currently having the issue that my phone won't always wake using the remapped Power button, or only after 4 seconds holding it. I think it's a conflict with my ROM settings though.
PERMANENT FIX: This problem is caused when the phone enters Deep Sleep mode, the processor stops listening to the .kl files and is pre-programmed to listen on the power button. --On mine, I was completely unable to turn the phone on, I figured out thought that I could turn it on is by holding the power button and the configured volume button at the same time, like a screenshot, hope this helps somebody.-- To permanently fix this download "Wake My Android Pro (free)" from the Play Store, this app is specifically designed to keep your phone in the "Sleep" mode and preventing it from entering the "Deep Sleep" mode. **This does not drain your battery.** Just make sure to set "Low Wake" in the settings, and set the time to 9 seconds and auto-start. Hope this helps some people, those who do not want to fiddle around with Xposed.

Is there a way to remap volume keys to change song when double clicked or something?
This you can do via Tasker. Just create a profile: Event, Variable Set: Volume - Media. This will pick up the volume presses, from there you can restore the volume to what it was (via stored variable) and detect double-presses or gestures between the vol-up and vol-down buttons. I recommend running Javascript to detect that, to be more streamlined. Once detected, use the Media Control action to skip/restart/pause songs in OEM, or if you use Spotify or Pandora, you will have to use a shell "input keyevent 87" Use Root: Yes--87 to skip, swap it with 88 for previous, 85 to play/pause.

Is there any way to use his once you're in the camera . Since we don't have a dedicated camera button it would be great to set up the volume key to take pictures ? :)
This can be achieved with Tasker as well. Use a profile "Application," select Camera, and combine with an Event (by long-pressing profile and "Add...") Variable Set: Volume - Ringer. For the action, select Input>Button>Camera. You must be rooted.

If we combine this button swapping idea with Tasker, we can do a lot of cool things guys. An easy way to pick up an easy button gesture with Tasker is with the power button (which always works from sleep, the volume buttons can only be detected when music is playing). I use Tasker to do a certain action when the power button is double-clicked (Display On>Display Off within, say, 1 or 2 seconds).

Hope all was a help, I am new to XDA (*NOT* a noob!) and actually, this is my first post, so a thumbs up or a "thank you" or whatever you guys call it would be great. Thanks! :good:
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    /edit: this guide is now obsolete because Xposed Additions now has button remapping with some advanced options, which also seem to enable volume wake on my HTC One :)

    If you hate locking and unlocking your HTC One with the Power button, you can change that quite easily int for example Volume Down.

    ButtonRemapper would be the easiest method, but it doesn't work with the HTC One. It doesn't load the correct file.

    The solution: simply edit the correct file
    Code:
    keypad_8960.kl
    found in
    Code:
    /system/urs/keylayout/
    by hand (I used Fx File Explorer with the paid Root plugin) and reboot your phone. My edited file is attached on this post.

    Original:

    Code:
    key 116   POWER            WAKE_DROPPED
    key 114   VOLUME_DOWN       WAKE
    key 115   VOLUME_UP         WAKE
    
    key 107   ENDCALL           WAKE_DROPPED

    My current file that switches the Volume Down and Power button:

    Code:
    key 116   VOLUME_DOWN            WAKE
    key 114   POWER       WAKE_DROPPED
    key 115   VOLUME_UP         WAKE
    
    key 107   ENDCALL           WAKE_DROPPED

    I don't know if the same file is used on different ROMs. I tested this on the P.A.C. Man ROM.

    Now waking my One is a breeze! :laugh:

    P.S. You may need the following workaround to fix the 'volume wake not working' bug present in some (or all?) JB ROMs, which strangely also affects this tweak (symptom: volume down won't wake phone sometimes).

    1. Install Xposed Framework (which you should anyway, it's awesome)
    2. Install MoDaCo Toolkit
    3. Wait for the annoying ad (Paul, tsk, tsk) and enable the option 'HTC One > Enable Volume Wake'
    4. Enable MoDaCo Toolkit in Xposed
    5. Reboot
    6. Profit ^_^