[TUT] (Re)Mapping your USB keyboard
Most of you have a regular PC keyboard with a lot of unusable keys (win, f1-f12, pause, etc.) and here is how you can map those keys, so you can make the most of your keyboard. You can even remap the regular keys to change the layout of your keyboard if you like.
What you need to have:
1. An USB keyboard
2. Root access
3. Any root explorer that can mount /system as rw
4. Any terminal emulator
5. KeyEvent Display app found in the market
What you need to do:
1. Start the terminal emulator and type 'lsusb'. Connect the keyboard and type it again. Notice the device that is added (the keyboard) and write doen the two hex numbers (vendor id and product id).
2. Open the root explorer, go to /system/usr/keylayout/ and copy 'Generic.kl' to your /sdcard/ (or any location that is easy to find and edit the file). Rename the copied file to 'Vendor_xxxx_Product_xxxx.kl' replacing the xxxx with your vendor and product ids from the previous step.
3. Open the .kl file with any text editor and begin (re)mapping the keys. The file format is pretty straightforward:
key x CMD [OPT]
You need to know the scancode of the key you want mapped (x) and the command you want to execute when that key is pressed (CMD). The third parameter is optional and is useful if you want the action performed while the tab is sleeping (for example if you want to be able to wake it up).
4. To get the scancodes you need the KeyEvent Display app (probably there are others that do the same in the market) - just open it and press the key you want to map and notice the scancode value.
5. To find the usefull CMD values you can open the kaylayout file for the Acer BT keyboard and look at the CMDs there. For example EXPLORER opens the (default?) browser, KEYBOARD_UNLOCK gets you past the lock screen with just a press of a button, etc.
6. Once you are done with the mapping, save the file and copy it back to /system/usr/keylayout/ (you need to mount /system/ as rw first). I don't like editing in the /system/ folder, so any changes I do later are in the file located in /sdcard/ and then copy it back to /system/usr/keylayout/ (for some reason replacing the file doesn't work, so I have to delete it first and then copy it back)
You can edit the values in Generic.kl but this should affect all the keyboards that you connect, so it's better to create a specific .kl file for each one.
Any additions/corrections to this guide are welcome, especially if you know how to assign a key to launch a specific app, or how to open the app drawer (anything concerning the CMD values is highly appreciated)
Hope this helps someone!
Sent from my A500 using XDA Premium App