changing button layout M701-R

whc

Member
Oct 1, 2010
10
2
Just got my M701-R the other day, overall pretty nice device (for the price), but not happy with the button layout, would like something like this:

Front middle button:
Short press = Back
Long Press = Search

Top right button:
Short = Home
Long = Multitasking

Top Left button:
Short = Menu
Long = screen off

And the some software key for power off. Is this possible, have tried to root using the guide here: Rooting your Haipad 701, G10, etc with the latest firmware How-To

But cannot edit the keyboard file after..?
 
Depends on what you try to edit it with, and whether that app launches with root privileges. For example, if I try to open the either of the keyboard files with "Android Explorer" it won't do it. But I can open it with "ES File Explorer" app.

I should start by mentioning there is one button alteration you can make without hacking system files or even needing a rooted tablet!

If you have the app "SpareParts" (either the ad supported or sdk version) on your tablet go to the "End Button Behavior" setting. You can change the behavior of the Top Left button to either "do nothing" (why?), "Go Home," "Sleep" (what it is already set to), "Go Home and then Sleep."

Now, if you want more control than that there are apparently TWO different files you have to change to reassign all three buttons:

/system/usr/keylayout/qwerty.kl
/system/usr/keylayout/telechips_keypad.kl

Just pull those with adb to your desktop, MAKE BACKUPS, and open them in a text editor.

The magic key scancode values are:
107 = Top Left
139 = Top Right
158 = Front

Some guides I found said you only need to change the first one, but to get it to work I had to change values in BOTH files so they matched.

As for changing short press and long press values, the long press functions are kind of paired up with a short press one as follows:

HOME | RECENT APPS
CALL | VOICE DIALER
SEARCH | VOICE SEARCH
MENU | SOFT KEYBOARD
SLEEP | SHUTDOWN (actually ENDCALL=SLEEP on this tablet)

So what you do is assign the short press function to a button and it automatically assigns the matching long press function as well. I found out that since Android 2.0 this isn't actually "hard coded" behavior, it can be programmatically over-ridden so apps can change what the buttons do while the app is in use. But if you want to change the default behavior to what you suggested it requires editing Framework files to change the pairings - which I'm not comfortable messing with.

So what I did was found the following lines in each .kl file:
key 107 ENDCALL WAKE_DROPPED
key 139 MENU WAKE_DROPPED
key 158 BACK WAKE_DROPPED

and changed them to:
key 107 MENU WAKE_DROPPED
key 139 HOME WAKE_DROPPED
key 158 BACK WAKE_DROPPED

Then I saved the files and pushed them back to the tablet with adb and rebooted.

In case you're wondering (I know I did) what the heck the "WAKE" and "WAKE_DROPPED" flags are all about, they refer to what happens to a button call when the device is already asleep. Does it wake up and send the command or does it wake up and drop the command? Most keycodes appear to be the latter.

Now the top left and right buttons actually match the little icons printed by them. But this creates a new problem - there's no button to properly shut the tablet all the way down! The easiest solution I could think of was to open a terminal and type:

reboot -p

Which, sure enough, shuts the tablet down instantly. The only way to turn it back on is to slide the on/off switch from off and back to on, which immediately begins booting the tablet BUT ONLY IF IT IS CONNECTED VIA USB TO THE DESKTOP! So if you make this hack you will only be able to let your tablet go to sleep when it's disconnected from the desktop.

Thankfully any button will wake it up if it goes to sleep. So it's just the shutdown that is annoying. If you want to put your SLEEP/SHUTDOWN back in just assign "ENDCALL" to your button of choice.

That's all there is to it!

I'd have never figured it out without Chris Boyle's dirt simple app" that echoes Key Events as strings, which gave me the scancodes for each button.
 
Last edited:
Thanks you so much for this answer, thumbs up, going to play with the buttons now, thanks again mate :).
 
please help me, i don't know how to use adb with my m701.i've installed adk pack from google and the usb driver too, but when i connect m701 to pc, it gets android eclair device which i can't install driver for. i run adb from command and get " check device failed" error. please help me, and thanks so much for any helping. (cry )
 
@woodhead - you're a little off-topic (unless you're adb interest is to change button layouts) but anyway. . .

Sounds like you are on a Windows machine. You'll need to follow the advice in THIS POST and find the ID number of your device while it is connected and edit the driver's .INF file. Once you've got that out of the way try running ADB again.

Also, make sure you are entering the commands to ADB correctly! Make sure you are changing directories to the android SDK "tools" folder, then (even though most command examples online simply say "adb") on Windows the commands start with "adb.exe" [without the quote, of course]. Lastly, make sure you are NOT mounting the internal storage or SD card as removable drives on your desktop.
 
thanks so much for helping.i installed all drivers but still get problem yet.at the device manager tab, i have android ADP interface and adroid eclair, both of these device have " ! ", and cannot start.
by the way,i downloaded and installed the froyo 2.2 from haipad.net. but the new firmware chance the button layout,so i cannot use menu button now.because of that i want to custom the button layout. $help.jpg
 
I'd uninstall the drivers completely then scan for hardware changes and see what happens. The Google USB driver is only designed to work with specific phones, but will work with any that have similar hardware.

When it won't you need to edit the "android_winusb.inf" file and ADD information for your device. Which means you need the Device ID number (right+click on the Eclair device, look at Properties and you'll find the ID number). If you look at the device entries in the INF file you can see the format is pretty simple, just copy and paste one of the existing entries and edit it for your device's info.

I never needed to edit mine (Win7 64 bit), but I'd previously had an Augen Gentouch 78 and had edited the driver's INF file - not sure if that made the difference, but they are both Telechips based tablets so maybe that was why it worked for me? I've only connected via ADB to my Haipad once with Windows, though. Most of the time I'm booted into my Mac partition - where I don't need any extra drivers, it just works.
 
As long as I'm revisiting this thread I thought I'd add that if you have an M701-R with the funky little remote control, you can change (most of) the buttons assignments on the remote as well!

pull /system/usr/keylayout/telechips_remote_controller.kl

save a backup copy. Open it in a plain text editor.

The currently assigned values will tell you which button goes with which number, for example here is my stock file:

Code:
key 1 POWER          WAKE
key 2 MUTE
key 3 MEDIA_REWIND
key 4 DPAD_UP
key 5 DPAD_DOWN
key 6 DPAD_LEFT
key 7 DPAD_RIGHT
key 8 DPAD_CENTER
key 9 BACK
key 10 MENU
key 11 HOME          WAKE
key 12 VOLUME_DOWN
key 13 VOLUME_UP
key 14 SEARCH
key 15 MEDIA_PLAY_PAUSE
key 16 MEDIA_PREVIOUS
key 17 MEDIA_NEXT

You can assign any valid values to those buttons, just like the hardware buttons. Might be confusing given how they are labeled on the remote, but if you're the only one using it you can customize the layout however you please (YAY!)

On a related note there is also an Audio/Video Remote Control Profile file (AVRCP.kl) which defines some remote control media operations. These are typically associated with Bluetooth devices (such as a set of headphones with ff/play/rw buttons) but is not limited to Bluetooth devices. These settings are repeated at the end of the the "telechips_keypad.kl" file, so I'm assuming if you change it in one you have to change it in the other for the new settings to take effect. I don't know, however, if these settings are for the tablet as a "control" or "target" device ("control" means the tablet controls other A/V devices, "target" means other devices control A/V on the tablet). It's also possible that this file is intended for Bluetooth devices, which this tablet can't actually use. If anyone wants to play around with the AVRCP stuff and find out you're welcome to it.

As long as I'm digging deep into the key layout files I may as well mention the "h2w_headset.kl" - it only has one button defined in it for a wired headset with a "call" button, which should wake up the tablet. I don't have a phone headset like that so I can't see if it works, but in theory you could assign the button to do anything you wanted.
 
Last edited:
A big annoyance with our M701s is the lack of required number of keys for Android to function as it should.
In the beginning it was ok, I was loving the experience and looked over it but, in time, I started missing the Home button and its functions.
That's when I started messing around trying to add that function to my tablet. Got two ways of doing that; one is reassigning one of the physical buttons to Home (I chose the "Apple Style button") and the other is getting a virtual home button with an app.

I chose the first option, reassigning a physical button to Home. The way I did it was editing the file qwerty.kl in system/usr/keylayout. You have to be rooted for that and all you have to do is open that file in a text editor (I used root explorer but I think astro file manager can do that and has a free version) and find the line that has "key 107 ENDCALL WAKE_DROPPED" in it. Then, just replace ENDCALL with HOME and restart your device. On next boot your front key will be home. Then, you may ask, how do we turn our tablets off and turn off the screen? Well, I found two apps for that: "Quick Boot (Reboot)" for shutting the tablet down and "Screen Off Trial" for turning the screen off.

And ther you have it, a physical home button that you can use on your tablet :)

As for the "Virtual home button", there is a very good aplication for that. "Button Savior" places a permanent key panel on your screen. The keys are translucid so the have minimal impact and don't compromise the screen estate, and can even be hidden, leaving only a tiny trigger to pull the keys out. Try it out if you don't want to mess around in system files (but you have to be rooted too). :)
 
There's another thread where I wrote in more detail about changing button assignments (and lower in the thread how to do the same for those of us with remote control versions), but I hadn't addressed software solutions for a missing power down button.

Personally, after mucking about with this myself, I'm happier with the button assignments the way they came - but that's the great thing about hacking an Android tablet to get things the way YOU want them. ;)
 
Back
Top