Android Simplicity

How-To #47: Map Android Keys To Any Keyboard

Ever plugged in an external keyboard with Bluetooth/USB and notice that some basic android key events are missing? Useful android key events such as the Home, Search, and Menu are critical to using any android system. For my Bluetooth keyboard, I had no Search key. This made it very difficult to find anything on my Android device. Each time I wanted to do the Search event, I had to press on the capacitive search key manually on the Android phone. There is a solution for this.

Requirements:
- Root
- KeyTest.Apk
- Any File Explorer(ES File Explorer: Go to "Settings"->Scroll down-> "Root Settings" -> Check all boxes) 

Steps:
1) Download, install, and open KeyTest.Apk on your Android Device

2) Press the hard key you want to simulate. I pressed on capacitive Search key on my Android device. 
There is a few things to know:
- You will see a "ScanCode": this is the number that maps the device. Mine is 217 (good to know but you dont need this information)
- You will see a "keyCode" under KeyEvent: this is the Action event. Mine is KEYCODE_SEARCH. Remember the value after KEYCODE_.

3) After the BlueTooth/USB is connected, pressed on any currently mapped keys that is not used. I Pressed FN+10 to simulate "F12"
- Write down the ScanCode. Mine is 88 

4) On the File Explorer, navigate to  /system/usr/keylayout. 

5) Find qwerty.kl(Older system) or Generic.kl(Newer system) and make a backup copy somewhere else.
*Note* You can check which one it is by opening qwerty.kl and it should say if it is depreciated near the top

6) Open qwerty.kl or Generic.kl. You will see a listing of "Key 'ScanCode' 'KEYCODE_ACTION' ". Find the ScanCode that was written down in step 3) above. Mine is listed as Key 88 F12

7) Change the KEYCODE_ACTION to the new mapping. Mine is changed to Key 88 SEARCH

8) Save the file and reboot

9) Done! Now whenever I press FN+10, I can simulate the Search key

Important Extra notes:
Android KeyCode - A long list of KEYCODE_ACTION events
- While you can use KEYCODE_ACTION more then once, you cannot use the same ScanCode more than once. This will cause the Keyboard to fail, so just use the on-screen touchkeyboard to replace qwerty/Generic.kl with the backup.

0 comments:

Post a Comment

Popular Posts
AndroidSim Mobile App
What are you using?