[Elephone P9000 Guides, News, & Discussion] nebularstreams:
Hi, I had the same problem and have created a patch to be able to configure the LEFT KEY as MENU or any other code you want. Hope it is useful for anybody!

PATCH: Use LEFT BUTTON as MENU KEY / GOOGLE NOW on long press

ELEPHONE P9000 / Cyanogen CM13 final build

filedropper.com/elephonep9000deepflexcm13patchmenuonleftkey_1

This is a patch for DeepFlex CM13 final build that configures the Elephone Left Key as the missing MENU key, neccessary for some applications. It is needed a patch at keyboard driver level, because the cyanogen driver included captured the keycode of the left key (250) to do the hardcoded actions of muting the phone or running the custom application selected in the elephone app (com.shev.elebuttonsettings). Unfortunately that app is unable to set MENU key as the action, otherwise this patch won't be neccessary.

After applying the patched com.cyanogenmod.keyhandler.jar, the keycode will not be intercepted and be available to Android. So you can use the mtk-kpd.kl as usual to map it to any key or button. Please mind that you will lose the existing left key functionality (elebuttons app + mute phone) getting instead the standard menu key, that will also fire up Google Now on long press.

It would be cool if [MENTION=6236982]Deepflex[/MENTION] would kindly consider the option if e has the time to make the hardcoded action optional or enhance the elebuttons app to support system keys.

There are two files:

com.cyanogenmod.keyhandler.jar

- This file has to be copied to /system/framework in your android device.

- You should backup the existing file to revert the changes

- This patched version just disables the hardcoded behaviour of the LEFT KEY, that executed the app com.shev.elebutton, letting instead then Android use the keycode normally.

mtk-kpd.kl

- this file has to be copied to /system/usr/keylayout/

- Here we map the LEFT KEY (code 250) to the MENU key (or whatever other key you want)

INSTALLATION

There may be other ways, but in resume you need to be root to enable writing on the /system/ folder and copy the patch files to the required locations.

STEP 1: Copy the patch files into the phone sdcard

via adb from your computer, in the directory where these patch files are located:

adb push com.cyanogenmod.keyhandler.jar /sdcard/
adb push mtk-kpd.kl /sdcard/
adb shell

these two copy the patch files from your computer to the sdcard, and enter the phone.

(NOW YOU'RE ON THE PHONE)

STEP 2: Become superuser and enable write on system partition

You might need to enable root requests on the developer settings. ( "root: apps and adb")

su
mount -o rw,remount,rw /system

become superuser (you should see "root@p9000:/ #" if you are root), and then enables writing on the system partition.

STEP 3: copy the patch files, that should be in /sdcard/

cp /sdcard/com.cyanogenmod.keyhandler.jar /system/framework/
cp /sdcard/mtk-kpd.kl /system/usr/keylayout/

STEP 4: Wipe Dalvik cache

WARNING: THE FOLLOWING COMMAND WILL ERASE THE DALVIK CACHE.

BE VERY VERY SURE THAT YOU TYPE IT EXACTLY AS IT IS, BECAUSE

ANY MISSPELLING CAN DELETE EVEN THE WHOLE OPERATING SYSTEM.

If you are scared, just skip this step, and wipe the DALVIK CACHE

from TWRP

rm -r /data/dalvik-cache

STEP 5: Revoke write permission

mount -o ro,remount,ro /system

STEP 5: Reboot the phone.

- If you wiped dalvik cache, just reboot normally

reboot

- If you didn't, reboot into recovery mode and wipe the cache from there.

reboot recovery

Hope this is useful to somebody!!