• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Swapping the Menu and Back keys

whoshotjr2006

Android Enthusiast
Jul 31, 2012
680
1,252
Ohio
Coming from the Galaxy Nexus with configurable softkeys, I got pretty used to the menu key on the left, home in the middle and back on the right. I'm right handed and don't like to use 2 hands just to control my phone, and since the back key is my most used key, I like it in easy reach.

PREREQUISITES- must be rooted, doesn't matter if your on zv3 or zv4, and must be able to use a root browser/adb and read basic directions easily. I am not responsible if your phone stops working, your boss fires you, or gluten makes your manhood shoot off your body in a spectacular manor.

With that said, to swap those two keys, fire up a root browser, I prefer Root Browser from jrummy, navigate to /system/usr/keylayout and open up your gpio-keys.kl file with your file editor of choice.

This is what you will see, after a long Linux foundation disclaimer. This is what we want to mess with.

key 115 VOLUME_UP WAKE_DROPPED
key 114 VOLUME_DOWN WAKE
key 102 HOME WAKE
key 250 INFO

key 158 BACK VIRTUAL
key 172 HOME VIRTUAL
key 139 MENU VIRTUAL
key 249 CHANNEL_UP VIRTUAL

Key 158 that says BACK, change that to say MENU like key 139 does. And Key 139 that says MENU, change it to say BACK like key 158 does. DO NOT CHANGE ANYTHING ELSE UNLESS YOU KNOW WHAT YOU ARE DOING!

This is what it should look like when you are done.

key 115 VOLUME_UP WAKE_DROPPED
key 114 VOLUME_DOWN WAKE
key 102 HOME WAKE
key 250 INFO

key 158 MENU VIRTUAL
key 172 HOME VIRTUAL
key 139 BACK VIRTUAL
key 249 CHANNEL_UP VIRTUAL

Save the file, and reboot your device. When it reboots, your menu key should be on the left, home in the middle, and back on the right. The icons of course wont change, but I just shut off key lights under Settings>Display>Front touch key light and don't even notice or care anymore.

Hope this helps.

attached is a clean copy of gpio-keys.kl to use to restore with adb if needed. To revert, just do the opposite of above, and change MENU and BACK to what they were before, or if for some reason you cant use the keys anymore (shouldnt have that problem but anything can happen) use adb like this:

adb shell mount -o remount,rw /system
adb push gpio-keys.kl /system/usr/keylayout/
adb reboot

and your phone should be fixed.

(gpio-keys.kl inside of zip, since uploader doesnt like .kl extension)

If this has been covered before, please lemme know and I'll ask a mod to take this post down.
 

Attachments

  • gpio-keys.zip
    1 KB · Views: 85
Does anyone who how to disabled the keys... Like if I wanna just use software keys instead

I would imagine you could comment out the back and menu key lines in the file, but don't quote me on that. And the obligatory yadda yadda risk yadda your milage may vary lol.

If anything goes wrong you should be able to use adb to push a clean copy of gpio-keys, or boot into cwm and restore if you didn't restore your laf partition, or use lg download mode to restore if you did. Not too much risk invovled.
 
Upvote 0
I would imagine you could comment out the back and menu key lines in the file, but don't quote me on that.

I just couldn't resist :)

Commenting out the following keys disabled the menu and back buttons but didn't give me the on screen keys.

key158BACKVIRTUAL
key172HOMEVIRTUAL
key139MENUVIRTUAL

BTW thanks for posting this tutorial. The placement of the back\menu buttons was one of my only issues with this phone.
 
  • Like
Reactions: whoshotjr2006
Upvote 0
Does anyone who how to disabled the keys... Like if I wanna just use software keys instead

I just couldn't resist :)

Commenting out the following keys disabled the menu and back buttons but didn't give me the on screen keys.

key158BACKVIRTUAL
key172HOMEVIRTUAL
key139MENUVIRTUAL

BTW thanks for posting this tutorial. The placement of the back\menu buttons was one of my only issues with this phone.

For software keys, stick this line into your build.prop:
qemu.hw.mainkeys=0

Screenshots
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones