FORUMS
Remove All Ads from XDA
Honor View 10

[MOD][UPDATED] Modified keymap files for G2

28 posts
Thanks Meter: 6
 
By teferi, Junior Member on 12th November 2010, 01:32 AM
Post Reply Email Thread
14th November 2010, 07:41 PM |#31  
Junior Member
Flag Boise, ID
Thanks Meter: 5
 
More
Ok, so here is the compilation of my research into how this and the tools you need to make this work with your own custom keyboard layouts.

kcm_utils.zip


This file contains the windows kcm.exe executable that can compile kcm files into kcm.bin files, the modified source files that are needed to compile kcm.bin files for the G2, the modified unkcm python script that allows you to decompile an existing .kcm.bin file.

It also includes the original .kcm and .kl files from the G2.

Now, if you simply want to remap keys you only need to modify the .kl file and upload it to your device. For example, if you want to change Quick Key 1 into a backslash/pipe key you only need to change one line.

From this:
Code:
key 183   USER1            WAKE_DROPPED
To this:
Code:
key 183   BACKSLASH            WAKE_DROPPED
The tags USER1 and BACKSLASH refer to entries in the .kcm file. You can use any of the constants defined in the .kcm file for any key on the keyboard. They labels are quite easy to understand.

Now, if you want to actually change what keys are sent upon a keypress, you need to change the .kcm file. For example, there are no angle brackets defined on the G2 keyboard. I changed the RIGHT_BRACKET and LEFT_BRACKET keys to send angle brackets when ALT is pressed on those keys. This involves changing the .kcm file



From this:
Code:
# keycode      Display   Number    Base      Shift     Alt       Shift+Alt
LEFT_BRACKET   '['       '['       '['       '{'       '['       '{'
RIGHT_BRACKET  ']'       ']'       ']'       '}'       ']'       '}'
To this:
Code:
# keycode      Display   Number    Base      Shift     Alt       Shift+Alt
LEFT_BRACKET   '['       '['       '['       '{'       '<'       '{'
RIGHT_BRACKET  ']'       ']'       ']'       '}'       '>'       '}'
Then you compile the modified kcm file using the kcm.exe utility
Code:
kcm vision-keypad.kcm vision-keypad.kcm.bin
Then upload it to your device and copy it to the /system/usr/keycodes folder as indicated in the OP.

Also, you will want to disable the quick keys app so that it doesn't pop up each time you press one of the quick keys. This can be done with the following shell command (Requires root, of course)
Code:
pm disable com.tmobile.userkeystool
I know this may be a bit sparse on details, but I hope it helps folks who want a custom keymap for their device.
The Following 5 Users Say Thank You to Barret7sc For This Useful Post: [ View ] Gift Barret7sc Ad-Free
 
 
16th November 2010, 10:11 AM |#32  
Senior Member
Thanks Meter: 2
 
More
Any chance of getting a Linux-compatible version of this? It won't work w/ WINE.
17th November 2010, 07:46 PM |#33  
Junior Member
Flag Boise, ID
Thanks Meter: 5
 
More
The source for the executable is included. It should compile with gcc just fine as it was compiled with GCC under Cygwin.

Change to the src directory and compile it.
The command should be something like this:
Code:
g++ -I ./ kcm.cpp
Now, if this behaves the same way on linux as it does under cygwin you should get a file named "a.out", you can rename this file to something like kcm and then run it.

For example:
Code:
mv a.out kcm
./kcm
I tested this using Ubuntu 10.10
18th November 2010, 01:03 AM |#34  
ratchetrizzo's Avatar
Senior Member
Flag Wilmington, DE
Thanks Meter: 63
 
More
Any chance the OP is going to add a ^ key to the map?
Aside from that, It's pretty hunky-dory as is.
18th November 2010, 03:55 PM |#35  
the orange bandit's Avatar
Senior Member
Flag Texas
Thanks Meter: 69
 
More
This is pretty awesome - I just loaded a Desire Z ROM on my G2 and you lose the www/.com key, as well as the first quick key. Any chance someone could upload a stock one with the www/.com key restored and maybe the first quick key as a 'back' button (since there's not a hard 'back' button).
18th November 2010, 04:53 PM |#36  
Member
Thanks Meter: 3
 
More
Hi Teferi,
Thank you for giving me my | key back!! I want to have your babies.
18th November 2010, 05:25 PM |#37  
Senior Member
Flag Texas
Thanks Meter: 1,151
 
More
Has anyone tested this on a Sense ROM?
18th November 2010, 05:45 PM |#38  
KronicAnarchy's Avatar
Senior Member
Flag Denver
Thanks Meter: 12
 
More
Quote:
Originally Posted by the orange bandit

This is pretty awesome - I just loaded a Desire Z ROM on my G2 and you lose the www/.com key, as well as the first quick key. Any chance someone could upload a stock one with the www/.com key restored and maybe the first quick key as a 'back' button (since there's not a hard 'back' button).

+1,

I was going to just use the orig file in the OP and see if it works, worst case I have to restore right??
18th November 2010, 05:51 PM |#39  
the orange bandit's Avatar
Senior Member
Flag Texas
Thanks Meter: 69
 
More
Quote:
Originally Posted by KronicAnarchy

+1,

I was going to just use the orig file in the OP and see if it works, worst case I have to restore right??

Definitely report back and let us know how it works.
18th November 2010, 06:09 PM |#40  
KronicAnarchy's Avatar
Senior Member
Flag Denver
Thanks Meter: 12
 
More
Will do but it probably won't be until the weekend when I've got time to mess with it.
18th November 2010, 06:35 PM |#41  
Senior Member
Thanks Meter: 30
 
More
More and more good stuff popping up here.

Does anyone know how to set the quickkey to toggle wifi on/off?

I know I probably dont need to remap the key but I cant figure out the code that is used. I know its there somewhere, the WiFi widget does it with one simple click, we should be able to too. Im just not a programmer, and have no idea how to read and implement logcat data .
Post Reply Subscribe to Thread

Tags
keylayout, patch

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes