My Huawei 8150 has come back to me again, after filling in as a spare phone for my wife (she wasn't as impressed with it as I am). One of the not-so-great things about it is the 3 massive physical buttons which are set to 'call', 'select' and 'end call' respectively. I mean, who uses a smartphone for making calls?
Anyway, to make the phone a lot more usable, in the past I've used ButtonRemapper to change what these buttons do. Unfortnately ButtonRemapper isn't playing nicely for some reason, so I did some digging, and I found an generic way to remap any key (on, presumably, any Android device). Here's what to do:
Get Root Access
In order to change the system file that the key mappings are stored in, you need root access. I'm not going to go into this here: it's device-specific and there's guides everywhere. It's not as scary as it seems though.
SSHDroid is a free app that runs an SSH server on your phone. That means you can connect to it remotely and do things. Things like mess with files.
If you're on Windows, PuTTY is pretty much the best SSH client going. You'll need it to connect to the SSH server that SSHDroid is running
SSH to your phone
When you run SSHDroid, it gives you an address to connect to (something like sftp://firstname.lastname@example.org). In PuTTY, connect to the host (192.168.1.1) with the username
root. The password is
Check your /system mount
Run this command:
mount | grep /system
You should see one line, something like
/dev/block/mtdblock4 on /system type yaffs2 (rw,relatime)
If it says
(rw, relatime) then you're golden: go to the next step. If it says
(ro,relatime) then run the following command:
mount -o rw,remount /system
On some devices
/system is mounted as read-only: what you're doing is re-mounting it as read-write so you can change the file.
Change some stuff
/system/usr/keylayout, then run
ls. You'll see one or more
.kl files. This may change per device (so you may need to experiement) but for me,
qwerty.kl is the file I need to modify. Let's be a little sensible though:
cp qwerty.kl qwerty.kl.orig
Now you'll want to
vim qwerty.kl. I love
vim, but it can be a pretty alien text editor if you're not used to it. I'll try and walk you through gently.
The file should contain a whole lot of key mappings that look something like this:
key 158 BACK WAKE_DROPPED key 230 SOFT_RIGHT WAKE key 60 SOFT_RIGHT WAKE key 107 ENDCALL WAKE_DROPPED key 62 ENDCALL WAKE_DROPPED key 229 MENU WAKE_DROPPED key 139 MENU WAKE_DROPPED key 59 MENU WAKE_DROPPED key 127 SEARCH WAKE_DROPPED key 217 SEARCH WAKE_DROPPED key 228 POUND key 227 STAR key 231 CALL WAKE key 61 CALL WAKE_DROPPED key 232 DPAD_CENTER WAKE_DROPPED key 108 DPAD_DOWN WAKE_DROPPED key 103 DPAD_UP WAKE_DROPPED
key 158 is the identifier of the key. The next column is the action (BACK, MENU etc). The last column is something to do with when the key is active, although I don't really understand it.
It's a bit of a pain, but to find the keys you want to remap, you need to do a bit of guess-work based on what the action is. For example,
key 231 is
CALL, which on the IDEOS happens to be the left (green) physical button (ie, one I want to change). But notice there's another
CALL: the only way to work out which is the one you want it trial and error, sadly.
Once you've identified a key you want to try remapping, use the arrow buttons to move the cursor to the action part of the line. For example, if I'm remapping
key 231, I'll put the cursor on the
CALL. Now, type
dw, which will delete the word. Type
i to go into 'insert' mode, then type the action you want, for example,
esc to go out of insert mode. If you're happy, type
:x to save and exit. If you've screwed something up,
:q! will get you out without saving any of your changes.
Once you've finished editing, restart your phone and see if the remapping worked. If not, rinse and repeat. If you need to go back to the original state, copy the backup back over the top of your changes, with
cp qwerty.kl.orig qwerty.kl
Changes for the IDEOS
Here's the keys I changed for the IDEOS:
key 107 BACK WAKE_DROPPED key 231 MENU WAKE key 232 HOME WAKE_DROPPED
I found this out the hard way, but if you really screw something up, re-flashing your ROM (assuming you're using a custom ROM..) restores the original
Good luck :)