2

Since I have a broken back button I have remapped my buttons in such a way that my original volume up button functions as a menu button, and my original menu button as the back button. I've done this by changing the key values in /system/usr/keylayout/generic.kl.

The problem is, I've flashed a new ROM so I had to do it again, but now it doesn't work anymore. The changed values are persistent but my phone ignores it, it seems.

And yes, of course I've rebooted after making the changes again.

Anyone have an idea?

1

As you wrote you've modified a system file, it's safe to assume your device is rooted. There are several apps available promising to remap keys (see my list of key remapper apps), one of them might solve your issue. I have not tried any of them (had no need), but what sounds promising is Xposed Additions, see this screenshots:

screenshot screenshot
Xposed Additions (source: Google Play; click images for larger variants)

On the first screenshot (the module's main screen), the last item reads "Buttons". Tapping that leads to the second screenshot – again look at the very button, and you see it even includes hardware keys (here: the power button). The item just above that would be your back button (soft or hard). So no need to directly tamper with system files – just let Xposed deal with it :)

0

Without knowing which phone you have, which rom, or what version, it's hard to tell you exactly why, but the simplest explanation is that you are editing the wrong key layout file. Cyanogenmod roms tend to support various key layouts specific for certain devices, and those take precedence over the Generic.kl file, for obvious reasons. Key layout files are mapped to individual device types. There may be other .kl files that are specific for your buttons, like sec_key.kl, sec_jack.kl (for Samsung hard buttons and headset buttons), cyttsp-i2c.kl (for Cypress TrueTouch e-ink display controllers used in the B&N Nook), gpio-keys.kl, etc etc.

So you need to see which ones are there, which one is for your specific device (hopefully it's commented), and edit that one.

-1

I would guess that the keymappings are only read at the first boot after flashing the ROM and will be stored in a database on the /data partition. This database won't be updated when the values in generic.kl are changed. You can test this thought by doing a data wipe. This will trigger reading your changed values from generic.kl (AFTER DELETING ALL YOUR USERDATA!). Another way would be finding this database and editing it by hand or just removing it and rebooting for a re-read of generic.kl.

  • Thank you, that seems like the solution if i can find that database. Do you have any idea or guess where to find it? – Bart Sep 30 '14 at 20:10
  • That's absolutely not how android handles the key layout and key char map files. – cde Dec 27 '15 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.