Seem like power button on my Nexus 5 will be broken soon. When I pressed it, the screen turn off and on. I have to press it twice to make it work.
There are many custom ROMs/kernels out there that allow you to:
- Double tap the screen to wake it up but it cost 2% of battery/hour
- Use Volume Rocker to wake the screen
I don’t want to install custom ROMs because some of them are not open sources.
The cleanest way to remap button would be:
- clone AOSP
- modify /system/usr/keylayout/xxx.kl to remap the button
- build my own ROM, and flash it
Remap Volume button with temporary recovery ROM
I found a way to avoid permanently root my phone, or flash a custom ROM. But you still need to unlock your bootloader which will WIPE ALL DATA ON YOUR PHONE!
I temporary boot into a custom recovery ROM via fastboot, modify the keymap file, and eureka!
- Get adb and fastboot from Android SDK
- Download openrecovery-twrp-126.96.36.199-hammerhead.img (a custom recovery for Nexus 5)
- Unlock the bootloader with following command:
WARNING: THIS WILL WIPE ALL DATA ON YOUR PHONE!!!
adb reboot bootloader # reboot to bootloader fastboot oem unlock # unlock the bootloader
- Temporary boot into a custom recovery ROM (without flashing it)
adb reboot bootloader fastboot boot openrecovery-twrp-188.8.131.52-hammerhead.img
- Press Mount and select System to mount /system
- On your PC, run:
adb shell vi /system/usr/keylayout/gpio-keys.kl
- Modify the content of file from:
key 115 VOLUME_UP key 114 VOLUME_DOWN
key 115 POWER key 114 VOLUME_DOWN
- Save [ESC] then :wq[ENTER], then unmount the /system by select System again on your phone
- Press back (bottom right of the screen) and Reboot -> System
- Choose NOT to install Super SU (DON’T swipe!)
When the phone reboots, you may use Volume Up button to wake the screen now. Unfortunately, the button will not turn up the volume anymore.
I tried modifying the keymap to allow the volume button to acts as both VOLUME UP and button to wake the screen:
key 115 VOLUME_UP WAKE # THIS WONT WORK key 114 VOLUME_DOWN
This does not work because the behaviour of Wake Key was controlled by
PhoneWindowManager.interceptKeyBeforeQueueing which you can read more from the doc and PhoneWindowManager source code. Seem like we can turn up the volume while listening to music without waking up the phone (That might be the feature that prevent this to work).
9 ความเห็นบน “Use Volume button to wake up Nexus 5”
What about this? https://play.google.com/store/apps/details?id=com.teliapp.powervolume&hl=en
My friend is an end-user who encountered the same problem, and it ended up that I suggest this app to him.
I was curious that, aside from the ability to use the volume button to ‘lock’ (which the app can’t, or maybe it’s designed to let user use the volume button while the screen is on), is there any remarkable difference, like the battery usage?
By the way, button remapping is a very good solution. Cheers! 😀
Worked perfectly, thank you!
DId you test key 115 WAKE VOLUME_UP ??
never tried that. if it’s working, please share your result 🙂
I was afraid to try and brick it, since my actual power button is really messed up I thought I´d ask first
Work for me! Thaaaaaanksss!!!!
Thank you, this was great! Worked for me perfectly.
key 114 WAKEUP
That worked for me, I prefer vol-down for waking the device.
yeah, same here, but that also only lasts for some time… I wore down all my phisical buttons… My advice is use the tap to wake/sleep feature. The buttons will last longer, because even with that, you still use´m