[Mod] Change Headset Button Control - AT&T, Rogers, Bell, Telus Samsung Galaxy S III

I take no credit for this Mod. I found this posted in the i9300 section here http://forum.xda-developers.com/showthread.php?t=1767954&page=2. All credit goes to andrewilley.
What this does is map the volume up and down controls on the headset to next and previous track instead. I suggest that you only use this if you are using the wired headphones and want that functionality. Because this will change it for bluetooth devices also. So if you have a headset that already has buttons for both volume and tracks this isn't for you.
Here is andrews post from that thread.
Code:
I've managed to get the second and third headset buttons acting as next/previous track functions - without needing any extra software (although of course you can add extra facilities using Headset Button Controller later if you wish). The side volume rocker still works for volume control.
Christoph Kober pointed me to some documentation on the Android key mapping files (http://source.android.com/tech/input...out-files.html) which helped me in the right direction. I first tried to edit the small file which looked like it handled the headset, but that did not change anything. Then I tried editing the master key mapper file, and that did the job. I assumed that this would also remap the on-device volume buttons too, but fortunately there is another mapping file which overrides the generic one to handle the four hardware buttons - so they get re-mapped back to volume again. Perfect!
You'll need root access and a text editor for this. Don't mess with this lightly, you are editing system files!!!
1) Navigate to folder /system/usr/keylayout/
2) Backup the current Generic.kl file (you were going to do that anyway, right? If you weren't, probably best not go any further...)
3) Edit the file Generic.kl using a text editor
3) Comment out the lines for keys 114 and 115 (just put a # at the start of those two lines) thus:
# key 114 VOLUME_DOWN WAKE
# key 115 VOLUME_UP WAKE
4) Find the lines for keys 163 and 165, which look like this:
key 163 MEDIA_NEXT WAKE
key 165 MEDIA_PREVIOUS WAKE
5) change the numbers from '163' to '115', and from '165' to '114', thus:
key 115 MEDIA_NEXT WAKE
key 114 MEDIA_PREVIOUS WAKE
6) Save and reboot
Andre
Here are recovery zips if you want to flash. You can also use these to flash back and forth if need be. Files were taken from LG1.
Download: http://d-h.st/asK
MD5: aa8334da5d76d8e0a0dd26eafac269c6
Uninstaller Download (reverts back to stock): http://d-h.st/2DC
MD5: c2bd8ccbe81c230ef97997267b600d0c

crawrj said:
I take no credit for this Mod. I found this posted in the i9300 section here http://forum.xda-developers.com/showthread.php?t=1767954&page=2. All credit goes to andrewilley.
What this does is map the volume up and down controls on the headset to next and previous track instead. I suggest that you only use this if you are using the wired headphones and want that functionality. Because this will change it for bluetooth devices also. So if you have a headset that already has buttons for both volume and tracks this isn't for you.
Here is andrews post from that thread.
Code:
I've managed to get the second and third headset buttons acting as next/previous track functions - without needing any extra software (although of course you can add extra facilities using Headset Button Controller later if you wish). The side volume rocker still works for volume control.
Christoph Kober pointed me to some documentation on the Android key mapping files (http://source.android.com/tech/input...out-files.html) which helped me in the right direction. I first tried to edit the small file which looked like it handled the headset, but that did not change anything. Then I tried editing the master key mapper file, and that did the job. I assumed that this would also remap the on-device volume buttons too, but fortunately there is another mapping file which overrides the generic one to handle the four hardware buttons - so they get re-mapped back to volume again. Perfect!
You'll need root access and a text editor for this. Don't mess with this lightly, you are editing system files!!!
1) Navigate to folder /system/usr/keylayout/
2) Backup the current Generic.kl file (you were going to do that anyway, right? If you weren't, probably best not go any further...)
3) Edit the file Generic.kl using a text editor
3) Comment out the lines for keys 114 and 115 (just put a # at the start of those two lines) thus:
# key 114 VOLUME_DOWN WAKE
# key 115 VOLUME_UP WAKE
4) Find the lines for keys 163 and 165, which look like this:
key 163 MEDIA_NEXT WAKE
key 165 MEDIA_PREVIOUS WAKE
5) change the numbers from '163' to '115', and from '165' to '114', thus:
key 115 MEDIA_NEXT WAKE
key 114 MEDIA_PREVIOUS WAKE
6) Save and reboot
Andre
Here are recovery zips if you want to flash. You can also use these to flash back and forth if need be. Files were taken from LG1.
Download: http://d-h.st/asK
MD5: aa8334da5d76d8e0a0dd26eafac269c6
Uninstaller Download (reverts back to stock): http://d-h.st/2DC
MD5: c2bd8ccbe81c230ef97997267b600d0c
Click to expand...
Click to collapse
Works like a charm
Sent from my SAMSUNG-SGH-I747 using xda premium

How can this be used on the actual phone volume buttons instead of the headset? It does work good tho.

KryPTiCk0d3 said:
How can this be used on the actual phone volume buttons instead of the headset? It does work good tho.
Click to expand...
Click to collapse
You would have to find to volume rocker buttons and change them but then you couldn't change the volume with them.
Sent from my SAMSUNG-SGH-I747 using xda premium

Would that be in the same generic.kl? or in a different spot? I use that an awful lot, more than volume adjust... so I could live with it for now until a custom rom comes out with it included, not sure of any yet.

KryPTiCk0d3 said:
Would that be in the same generic.kl? or in a different spot? I use that an awful lot, more than volume adjust... so I could live with it for now until a custom rom comes out with it included, not sure of any yet.
Click to expand...
Click to collapse
I haven't dug into it yet so not sure. I would expect it to be though. When I get some time I will check it out.
Sent from my SPH-D710 using xda premium

I wanna set that when I hold the headset button that it launches S Voice :good:

XblackdemonX said:
I wanna set that when I hold the headset button that it launches S Voice :good:
Click to expand...
Click to collapse
Doesn't it already do that? Thought I read that on the stock headphones?
Edit: Guess not I just tried it. But I discovered that if you double tap play button it will skip to next track.
Sent from my SPH-D710 using xda premium

crawrj said:
Doesn't it already do that? Thought I read that on the stock headphones?
Edit: Guess not I just tried it. But I discovered that if you double tap play button it will skip to next track.
Sent from my SPH-D710 using xda premium
Click to expand...
Click to collapse
lol i know that double-click skips track...
that doesn't help me lol

is there any way to make it like the g2 where it doesn't change tracks unless you hold it? and if you just click it it still increases or decreases the volume

I have been unable to get this to work on JB AOKP. Installing the flashable or direct edit results in losing all controls from the headphones. If anybody has been able to get this running on AOKP i would love to know how.

Maybe in this generic.kl file we can set those headsets with "iphone made" buttons to work with android?
I have one with 3 buttons, and all of them gives me google now when pressed. (JB)

ih8mydroid said:
I have been unable to get this to work on JB AOKP. Installing the flashable or direct edit results in losing all controls from the headphones. If anybody has been able to get this running on AOKP i would love to know how.
Click to expand...
Click to collapse
I would like to get this working, anyone else have any ideas?

Related

[Q] Remapping the trackpad

Hi, I was wondering if I could remap the trackpad button on my Droid Incredible to the home button. Kind of like how if you press the center button on the iPhone, it goes back to the home screen. Is this possible? and I do not want to flash another ROM. Thanks.
Uhm, this phone already has a "home" button.....
mmmark111 said:
Uhm, this phone already has a "home" button.....
Click to expand...
Click to collapse
can't we just answer the question? sometimes ppl. I would assume if he has a dinc he knows about the home shaped icon under the screen there, with that said I've never seen this question asked b4 but would assume no bcuz of already in place "home" button
Sent from my ADR6300 using XDA App
I know there is a button, but I want to use the track pad button for the same function.
I think this would be useful as well.
JC
Look at the Optical joy stick wake thread. It's in the keymap file somewhere. I don't know what all you can remap it too but I know they remapped it to wake the device (though inconstantly but thats a sleeping problem)
Just a thought, but would you not loose all of the intended functionality as a result of doing this? For instance, how would you take a picture or record a video?
I have ruby rom so there already is a record button or camera button on the screen itself so it's not a problem.
-steve
Redemption rom use to have a tweak that let you hold down the search button key and it would start the camera application. This was done by editing the incredible-keypad.kl file in /system/usr/keylayout and changing the line "key 217 SEARCH WAKE_DROPPED" to "key 217 CAMERA WAKE_DROPED" i figure you could add a line "key 232 HOME WAKE_DROPPED" and get the home to open when the trackpad was pressed, but that didn't worked.
I've been trying to remap my trackpad to camera since I rooted my phone and still can't get the working. I hope this thread will spread some light on how to properly remap the DPAD_CENTER button.
stevethekorean said:
I have ruby rom so there already is a record button or camera button on the screen itself so it's not a problem.
-steve
Click to expand...
Click to collapse
Those two aplications remove the need for the trackpad button, however its usefulness doesn't end.there. the.ability to.scroll through text to edit without endlessly, 'push and pray' u get it in the right spot I would.imagine would get lost as well. The trackpad also can seek in some flash players too.
Sent from my ADR6300 using XDA App
Okay. So this is not possible at all? Because i can edit text by zooming in on the website...
-steve
It doesn't seem to be possible... or if anyone has figured out how they don't want to share. Editing the kl files doesn't work like it does for other hardware buttons. Here's my thread asking the same thing:
[Q] Can't remap optical joystick?
would this be possible
if you were to look at the file text for the real home key maybe if you copy-pasted that txt into your trackpad txt file it would do the same function .......just a thought

Remapping soft keys

So I'm looking at remaping the soft keys (specifically the search) on the front of the phone. There appears to only be one "SEARCH" in the /system/usr/keylayout/vision-keypad.kl - key 217 (see code below) - that if changed has the following 2 effects:
1. Alters the functions of both the soft key on the front of the phone and the search key on the hardware keyboard. When I remap one, they both change to match your modification.
2. When changed, long press functionality of the soft key is lost. It will only accept a short press.
"SEARCH" can be successfully changed to "MENU", "BACK", and "CALL" (possibly others I have not tried) then pushed to the phone in recovery and function perfectly. However, when I map it to be the "POWER", the soft key does nothing on press, while the hardware search key on the slide-out works fine.
Has anyone found a way around this?
We remap the track pad to wake because we dont like using the top mounted power button, but it only does a half-ass job because when you want to shut the screen back off, you still have to reach for the power button. I think the track pad wake mod needs its own 'bacon bits'
Code:
# column 0
key 185 USER3 WAKE_DROPPED
key 100 ALT_RIGHT WAKE_DROPPED
key 217 SEARCH WAKE_DROPPED
key 28 ENTER WAKE_DROPPED
key 38 L WAKE_DROPPED
key 14 DEL WAKE_DROPPED
key 54 SHIFT_RIGHT WAKE_DROPPED
I think you're out of luck with regard to an easy fix. I just did a quick experiment with evtest and it looks like the softkeys on the screen are just areas of the touchscreen that the window manager treats specially and generates synthetic key events in response to touches on, instead of being actual mappable keys.
teferi said:
I think you're out of luck with regard to an easy fix. I just did a quick experiment with evtest and it looks like the softkeys on the screen are just areas of the touchscreen that the window manager treats specially and generates synthetic key events in response to touches on, instead of being actual mappable keys.
Click to expand...
Click to collapse
Well the are mappable. I managed to make it be the menu button and the back button just fine. It just doesnt want to be the power button..
The same key can be used as a single quick press or a long press. It is considered two different keys though. So you would have to figure out what the long press equivalent of the search button would be and change that one.
The way this thread can stay in developmental, is show steps on how you are remapping the keys.
For others to gain knowledge or this thread is moving to Q&A
Mikey1022 said:
The way this thread can stay in developmental, is show steps on how you are remapping the keys.
For others to gain knowledge or this thread is moving to Q&A
Click to expand...
Click to collapse
Maybe I'm off here, but if I was making this post to show the steps, would that not fall under a "How To" or "Guide"? My goal here is development. Development –noun 1. the act or process of developing; growth; progress. Or in my case, I'm in the act/process of developing a remapped key file to make the search soft key into a power key, and to then share with the rest of the forum. My progress so far is that I've managed to map it to a menu key and a back key with no problems, and am reaching out to others for help as to why it is that when I change it to the power key, it doesn't accept my changes.
Its kinda a gray zone, in that if I were to successfully remap it to the power button and post the file here, it would, technically speaking, be less of a development thread than it is now - because it would be finished developing and instead, merely contain a file with instructions.
However, as requested, and for those who are interested:
The file you are looking for, is as mentioned in the OP, "vision-keypad.kl" and is located in /system/usr/keylayout. You can edit it with a text editor like Notepad++. The line that I am looking at, also refer to OP, is key 217.
I'm thinking now, after messing with it some more, that maybe because it is a soft key it cant be mapped to power, being that as soon as the screen shuts off it no longer functions... But then again there exists widgets that, upon press, turn off the screen and they function fine, so I see no reason this shouldn't. I'll keep you posted on what I find, and would appreciate any help in the mean time.
i'd love to be able to map a longpress menu and a longpress back action. Cyanogen 6.1 allows longpress back to be turned into force kill foreground process. So there is a way to capture longpress on those 4 keys, the question is, what does the system read that keypress as and how can it be mapped.
sundar2012 said:
i'd love to be able to map a longpress menu and a longpress back action. Cyanogen 6.1 allows longpress back to be turned into force kill foreground process. So there is a way to capture longpress on those 4 keys, the question is, what does the system read that keypress as and how can it be mapped.
Click to expand...
Click to collapse
So it is doable! There are some .bin files in the /system/usr/keychar folder that correspond to the .kl files in the ../keylayout folder, but i havent been able to read them. Maybe thats it.. Gonna figure that out when I land tomorrow and get my computer set up
I changed the Search function key to Camera and it only works on a long press and I get no result on a short press. So maybe the function you are trying to rename the Search key to has to be specific to either way i.e. short or long press but not both.
So it will either work as a long press key for some functions or a short press key for others.
Read the window manager source (from AOSP or CM), determine what scancodes it synthesizes in response to touches or long-touches on the softkeys, edit keylayout accordingly.
Doesn't ButtonRemapper from Android App Dev section work on G2? :S
hey guys, i dont know if you all figured this out or not, I just got the g2, and to remap the key to power button you have to change it to "ENDCALL" not "POWER", after, reboot and voila! your search button now acts like a power button!!!!! Hope this helps!!!!!
Need to Map Back button to one of the soft key
Rceently I bought HTC Desire Z (no warranty), and I am facing the problem with 4 bottom buttons of the touch screen (menu, back, home and search). So I am planning to do hardware map for one of the softkeys to BACK button.
Could you please provide me step-by-step installation of all the softwares and the procedure I need to do for updating "vision-keypad.kl" file. Appreciate your help.
My one more doubt is that what is the difference between "WAKE_DROPPED" & "WAKE". I have seen these keywords in ".kl" file in GITHUB.
Please give me reply ASAP. I am frustrated with the way the mobile is working. Just imagine how it will be if back button stop working and you are in the middle of some application. I restarted my mobile some dozens of times.

[MOD] Play/pause music player by trackball while screen off & device locked

I made little mod for HTC Desire rooted roms.
It adds physical trackball pressing action (play/pause default Android player) while screen is off and device locked. When unlocked, trackball works normally.
All you must to do is add file (curcial-oj.kl) from attachment to your /system/usr/keylayout/ .
It contains just one line:
Code:
key 272 MEDIA_PLAY_PAUSE WAKE_DROPPED
(key mapped as '272' (trackball) is execute "MEDIA_PLAY_PAUSE" command with 'WAKE_DOPPED' flag)
You can also swap this command for one of these: MEDIA_NEXT (next song) , MEDIA_PREVIOUS (and previous one).
I'm still looking for option to control music player (next/previous) with other buttons, without loosing posibility for eg. changing volume levels by physical keys (if I map volume buttons as changers).
Anyone could help me?
May I suggest a zip to flash?
It would be much easier to use...
Thx, very useful for me
BalooZ said:
May I suggest a zip to flash?
It would be much easier to use...
Click to expand...
Click to collapse
I'll afford your order, soon.
Oligoy said:
Thx, very useful for me
Click to expand...
Click to collapse
Youre welcome.

[MOD] Disable screen wake from volume and headset buttons

This mod removes the screen wake from volume buttons and headset buttons press.
Install with adb or root explorer to system/usr/
Make a backup of the keylayout folder first.
Will function on all rom versions.
Mine doesn't even wake up from pressing the volume buttons. But nice.
Sent from my Samsung Galaxy SII with XDA Premium
prodygee said:
Mine doesn't even wake up from pressing the volume buttons. But nice.
Sent from my Samsung Galaxy SII with XDA Premium
Click to expand...
Click to collapse
I does if you have music player active, but this mod disables it.
DocRambone said:
I does if you have music player active, but this mod disables it.
Click to expand...
Click to collapse
My music player isn't used and the vol. Buttons still wakes up the screen
Sent from my GT-I9100 using XDA Premium App
PoTi_96 said:
My music player isn't used and the vol. Buttons still wakes up the screen
Sent from my GT-I9100 using XDA Premium App
Click to expand...
Click to collapse
Did you apply this mod?, and did you reboot?
Is this only with stock player?.because i have no problem with poweramp.
Nice work
Doc.. Any chance we'll see a kitchen or docrom for sgsII soon?
Sent from my GT-I9100 using XDA App
+1 doc need ur rom on my sgs 2
+1 from me too Welcome back to Samsung Doc.
Sent from my GT-I9100 using Tapatalk
+1 saw you here even before I got my G2 in the battery thread. Seems it worked out for you. Hope to see your online kitchen magic soon.
On topic. Just tried this on villain ROM and didn't get the issue. (Ke7)
Cheers
Sent from my GT-I9100 using XDA Premium App
DocRambone said:
Did you apply this mod?, and did you reboot?
Click to expand...
Click to collapse
No, I thought the first guy didn't use this mod...
Maybe he wasn't BUT I noticed that on the stock rom from austria (3) it didn't wake up the screen but on stock KE7 it does... Maybe 3 had changed it?
Sent from my overclocked GT-I9100 using XDA Premium App
Is it possible to wake the phone up by pressing volume button?
My power button is wearing lately.
I did try to editing the attachment by adding "wake". But it didn't work.
WidgetLocker/NoLock works occasionally but not all the time
Navigate to using root explorer, make sure it is r/w
/system/usr/keylayout
edit the following file
sec_key.kl
See the "WAKE" on the same row as
key 116 POWER?
Do the same for
key 115 VOLUME_UP (and DOWN if you want both)
Reboot and all done
DocRambone said:
This mod removes the screen wake from volume buttons and headset buttons press.
Install with adb or root explorer to system/usr/
Make a backup of the keylayout folder first.
Will function on all rom versions.
Click to expand...
Click to collapse
Thank you. I can finally completely disable the stupid lock screen with nolock. Before this mod, I couldn't do it because then the volume keys woke up the device, but now thanks to you I don't have that problem.
s2d4 said:
Navigate to using root explorer, make sure it is r/w
/system/usr/keylayout
edit the following file
sec_key.kl
See the "WAKE" on the same row as
key 116 POWER?
Do the same for
key 115 VOLUME_UP (and DOWN if you want both)
Reboot and all done
Click to expand...
Click to collapse
Tried this, but no success
don't really know why.
Code:
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 102 HOME WAKE
key 107 ENDCALL
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 103 DPAD_UP
key 108 DPAD_DOWN
key 232 DPAD_CENTER
key 116 POWER WAKE
key 212 CAMERA WAKE
guitarz said:
Tried this, but no success
don't really know why.
Code:
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 102 HOME WAKE
key 107 ENDCALL
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 103 DPAD_UP
key 108 DPAD_DOWN
key 232 DPAD_CENTER
key 116 POWER WAKE
key 212 CAMERA WAKE
Click to expand...
Click to collapse
Reboot and check the content of that file, if something is wrong with that file, it goes back to previous..
It is rather sensitive to edits and only likes it in correct spacings as I had it fail on me once before..
s2d4 said:
Reboot and check the content of that file, if something is wrong with that file, it goes back to previous..
It is rather sensitive to edits and only likes it in correct spacings as I had it fail on me once before..
Click to expand...
Click to collapse
thank you so much
i already tried editing few times, and it didn't work at all
how many space do i need?
actually, the original file already contains "wake" after key 115 volume up, but it didn't work, so i have been trying to modified it.
can anyone upload the original folder?
thanks
I flashed the latest ICS beta ROM, XXLPB, and was disappointed to see this mod not work. So I took it upon myself to mod the keylayout files so that volume buttons don't wake up the device if lockscreen is disabled entirely.
As usual, make sure you have a nandroid backup before trying this. Copy all files to system/usr/ and reboot.
All credits go to the original finder of this mod, DocRambone.
http://www.mediafire.com/?f4hlqmyg8ibcigp

Volume Rocker wake option

Ive looked around but couldnt find any threads about it (sorry if it should be in the Dev area but cant post there yet) Just wondering if anyone has a mod to get the Volume Rocker wake option. Ive recently gone back to custom Sense ROMs and find it disappointing that they dont have this option. Any help is appreciated.
I thought there was an option in Widgetlocker to do that. Maybe you can use that app, it's a good lockscreen replacement app!
There is a app on google store that can help, it's called Wake All
https://play.google.com/store/apps/details?id=org.firezenk.wakeall&hl=en
cheers! Dnt forget to hit the thanks button
Sent from my HTC Wildfire S A510e using xda premium
Thank you Wake all seems to work good. Will keep it until I can elarn how to navigate the directorys and sort out the Vol waker.
mackay508 said:
Thank you Wake all seems to work good. Will keep it until I can elarn how to navigate the directorys and sort out the Vol waker.
Click to expand...
Click to collapse
There's an option volume rocker wake in settings > display in cm9 and 10 no idea is that option available in sense roms
Sent from my Android lappy
Im pretty sure i have seen a way to do it by editing the directory. Seen this post but not sure how to go about it TBH
Tigger31337 said:
1. Navigate to this directory on your phone:
\system\usr\keylayout
2. Modify the file "marvel-keypad.kl" by removing the following lines:
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
(Delete the entire lines)
3. Perform the same mod on the file "qwerty.kl"
4. Reboot.
5. If works, click Thanks and buy me a beer. If you're short on time, just buy me a beer.
Click to expand...
Click to collapse

Categories

Resources