Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,809,495 Members 37,818 Now Online
XDA Developers Android and Mobile Development Forum

Remapping Physical Keyboard

Tip us?
 
joefuf
Old
#1  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Default Remapping Physical Keyboard

I just upgraded from a Droid 3 to a Droid 4. The keyboards on the two are slightly different, with some aspects of the Droid 3 that I am missing.



I was very satisfied with how the Droid 3's keyboard conformed to a regular QWERTY keyboard, to an extent.

I would love to be able to turn the Droid 4's CAPS LOCK key into a Shift Key and the Shift Key in the bottom left into an ALT Key.

I came across this fairly old thread on XDA with the same purpose.

Before I try to get into doing all of that with all of the inherited risks, is anyone aware of another method to do what I'm looking to accomplish?
 
3diord
Old
#2  
Member
Thanks Meter 6
Posts: 51
Join Date: Aug 2011
I posted in another thread how I modified my hardware keyboard. This is probably a better spot for it though.
 
joefuf
Old
#3  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Quote:
Originally Posted by 3diord View Post
I posted in another thread how I modified my hardware keyboard. This is probably a better spot for it though.
Quote:
Originally Posted by 3diord;[url
http://forum.xda-developers.com/showpost.php?p=53540081&postcount=1068][/url]

Well you're both in luck. I wanted a more functional keyboard ever since I got the D4. I think I posted all about it before. Anyway, I had to do updates to my method since updating to KitKat, and I'm willing to share. Here are my keychar and keylayout files, also in flashable zip form... (also includes a ringtone and notification tone) that I use whenever I update CM.

These might take some getting used to, there are quite a number of changes. I'll try to list them all here.

Caps Lock ---> Shift
Shift ---> Alt

ALT+e = 0x0301 = combining acute accent = turns e to , o to , etc
ALT+i = 0x0302 = combining circumflex accent = turns e to , o to , etc
ALT+k = [
ALT+l = ]
ALT+SHIFT+K = {
ALT+SHIFT+L = }
ALT+n = 0x0303 = combining tilde = turns n to , o to , etc
ALT+o = ~
ALT+p = |
ALT+r = $
ALT+u = 0x0308 = combining diaeresis = turns e to , o to , etc

ALT+SHIFT+U ... this one is special, it is unicode 0xEF00, but that doesn't really mean anything. But to Android, it will take the previous 4 characters and try to turn them into the unicode character for that. With knowledge of unicode you should be able to type any character you want with it. Lets say you wanted to type the copyright symbol, 0x00A9 ... you'd type "A9" then hit ALT+SHIFT+U and it'd turn into

ALT+0 = )
ALT+1 = !
ALT+2 = @
ALT+3 = #
ALT+4 =
ALT+SHIFT+4 =
ALT+5 = %
ALT+6 = ^
ALT+7 = &
ALT+8 = *
ALT+9 = (

ALT+, = <
ALT+. = >
ALT+/ = \
ALT+SHIFT+/ = |
ALT+' = `

http://2.ben64.com/d4/omap4-keypad.kcm

http://2.ben64.com/d4/omap4-keypad.kl

http://2.ben64.com/d4/kbr.zip

Any questions, please ask.
So in your changes, have you already enacted the Shift Key --> ALT and Caps Lock to Shift Key swap that I was looking to do? I don't see where in the KL or KCM file I would edit those settings.
 
3diord
Old
#4  
Member
Thanks Meter 6
Posts: 51
Join Date: Aug 2011
Quote:
Originally Posted by joefuf View Post
So in your changes, have you already enacted the Shift Key --> ALT and Caps Lock to Shift Key swap that I was looking to do? I don't see where in the KL or KCM file I would edit those settings.
Check the difference between my files and yours and you should see it.
 
joefuf
Old
#5  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Quote:
Originally Posted by 3diord View Post
Check the difference between my files and yours and you should see it.
My greatest desire is getting that ALT Key back. I see that in omap4-keypad.kl, you've made Key 42, which is the Shift Key on the Droid 4, into ALT_LEFT. So that's the ALT Key code, correct? If so, does it function as the ALT Key did for me on the Droid 3? Pressing ALT and hitting a D-Pad arrow jumped the cursor to the top, bottom, left, or right of text when I had my Droid 3 and the ALT Key. I was also able to hit ALT and Backspace to erase an entire line of text. Does this function similarly on your keyboard?

The rest of your changes in the omap4-keypad.kcm file aren't entirely consequential. I think they're definitely helpful, especially getting the tilde ~ key back on the phone, but I won't be blindly lost with any of those changes. One thing that sticks out to me is that where I have "key MEDIA_EJECT" functioning with code "\uEF01" you have it labeled "key SYM" with the same code. Did you replace the SYM key on your keyboard?

I just want to drill down some of these details with you, because I know I could just replace the few character changes of yours that I like much easier than replacing my entire keyboard with yours and troubleshooting later.
 
3diord
Old
#6  
Member
Thanks Meter 6
Posts: 51
Join Date: Aug 2011
Quote:
Originally Posted by joefuf View Post
My greatest desire is getting that ALT Key back. I see that in omap4-keypad.kl, you've made Key 42, which is the Shift Key on the Droid 4, into ALT_LEFT. So that's the ALT Key code, correct? If so, does it function as the ALT Key did for me on the Droid 3? Pressing ALT and hitting a D-Pad arrow jumped the cursor to the top, bottom, left, or right of text when I had my Droid 3 and the ALT Key. I was also able to hit ALT and Backspace to erase an entire line of text. Does this function similarly on your keyboard?

The rest of your changes in the omap4-keypad.kcm file aren't entirely consequential. I think they're definitely helpful, especially getting the tilde ~ key back on the phone, but I won't be blindly lost with any of those changes. One thing that sticks out to me is that where I have "key MEDIA_EJECT" functioning with code "\uEF01" you have it labeled "key SYM" with the same code. Did you replace the SYM key on your keyboard?

I just want to drill down some of these details with you, because I know I could just replace the few character changes of yours that I like much easier than replacing my entire keyboard with yours and troubleshooting later.
I don't remember changing SYM at all.

As for your ALT key functionalities, I never knew about those but they seem to work...

ALT+ up,down,left,right moves the cursor that way
ALT+ backspace does indeed delete an entire line

Thanks for the new tricks
 
joefuf
Old
#7  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Quote:
Originally Posted by 3diord View Post
I don't remember changing SYM at all.

As for your ALT key functionalities, I never knew about those but they seem to work...

ALT+ up,down,left,right moves the cursor that way
ALT+ backspace does indeed delete an entire line

Thanks for the new tricks
Okay, I'll just keep that part of my file intact then.

Good to hear. That was one of my favorite features about the ALT key and typing on the fly.

I think I'm all set to make a version, so I'll build my files, but how did you get your files onto the phone? I know you posted a zip in your first response, but I don't entirely understand how the META-INF folder factors into the zip. Will it be compatible if I just overwrite your kl and kcm files in the zip with the ones I want to use and flash it to my phone? Is there a better way to make a zip?

I would try to adb them to my phone, but in the original thread that set me on my way, the OP made it sound like using adb did not work.
 
joefuf
Old
#8  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Sort of interesting result. I've attached my kcm and kl files in how I've edited them. I didn't make many variations, and I didn't really change them too the extent that I could understand why this is happening, but:
  • Caps Lock no longer does anything when pressed, double pressed, or held
  • Shift only works when being held
  • The SYM key does not work

I used Root Browser to copy and paste the files from my internal SD Card to the proper \system directories. I used your files as a template.

From your observations of my files, can you tell what is wrong?
Attached Files
File Type: zip keyboard.zip - [Click for QR Code] (2.9 KB, 1 views)
 
joefuf
Old
#9  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Just noticed the red text in the other thread that seems to indicate a situation similar to my symptoms:

Quote:
The files in /system/usr/keylayout are the configuration for physical buttons, you can edit all of them, but I would recommend only editing omap-keypad.kl(Physical Keyboard) for the time being, as you could disable the capacitive buttons. IF you do somehow mess up omap-keypad.kl (I didnt have the correct permissions at first) android has a default generic version it defaults on if omap-keypad.kl doesn't work correctly, you can tell it is using this as the Caps Lock key, Shift key, SYM key wont work properly and the Arrow buttons will all be rotated to the right so up = right, right = down etc.
I just replaced the files in your ZIP that you uploaded with my kl and kcm files and flashed it without success. Any suggestions?
 
joefuf
Old
(Last edited by joefuf; 24th June 2014 at 07:02 PM.)
#10  
Member - OP
Thanks Meter 3
Posts: 94
Join Date: Jun 2010
Got it.

I thought I had the Permissions set up just like moah909 said to do in the other thread, but I probably didn't have it right the first time and they must have reverted in the subsequent flashes of the files. This is how the Permissions for both files should appear:



Once I did that, I rebooted and the Shift and Caps Lock keys are swapped now. The only thing not working is the SYM key. Not sure what caused that, but until then, I can get used to some of your "hidden" ALT keys.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Flyme OS Finds Its Way to the Google Nexus 5

Flyme OS is a heavily modified Android variantdeveloped by the Meizu team for their MX … more

MultiROM Makes Its Way to the LG G2

Over the last few weeks, we’ve seen quite a fewflagship (and former flagship) devicesget to … more

Jair Player with a Major Update–Here’s What’s New!

Back in May, we talked a bit aboutJair Player, a nice looking music … more