Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
crawrj
Old
(Last edited by crawrj; 1st August 2012 at 03:03 PM.)
#1  
crawrj's Avatar
Senior Member - OP
Thanks Meter 2742
Posts: 2,974
Join Date: Nov 2007
Default [Mod] Change Headset Button Control

I take no credit for this Mod. I found this posted in the i9300 section here http://forum.xda-developers.com/show...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
The Following User Says Thank You to crawrj For This Useful Post: [ Click to Expand ]
 
rambo8987
Old
#2  
rambo8987's Avatar
Senior Member
Thanks Meter 76
Posts: 948
Join Date: May 2011
Quote:
Originally Posted by crawrj View Post
I take no credit for this Mod. I found this posted in the i9300 section here http://forum.xda-developers.com/show...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
Works like a charm

Sent from my SAMSUNG-SGH-I747 using xda premium
The Following User Says Thank You to rambo8987 For This Useful Post: [ Click to Expand ]
 
KryPTiCk0d3
Old
#3  
KryPTiCk0d3's Avatar
Senior Member
Thanks Meter 10
Posts: 146
Join Date: Dec 2010
Location: Cold Igloo
How can this be used on the actual phone volume buttons instead of the headset? It does work good tho.
Galaxy S3 SGH-I747M Blue:
ROM: CyanogenMod 10 - Latest Nightly
KERNEL: Stock
RECOVERY: ClockWorkMod 6.0.1.4 Touch
RADIO: I747MVLLE8

Galaxy S3 SGH-I747M Red:
ROM: Stock
KERNEL: Stock
RECOVERY: ClockWorkMod 6.0.1.4 Touch
RADIO: I747MVLDLK4
 
crawrj
Old
#4  
crawrj's Avatar
Senior Member - OP
Thanks Meter 2742
Posts: 2,974
Join Date: Nov 2007
Quote:
Originally Posted by KryPTiCk0d3 View Post
How can this be used on the actual phone volume buttons instead of the headset? It does work good tho.
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
 
KryPTiCk0d3
Old
#5  
KryPTiCk0d3's Avatar
Senior Member
Thanks Meter 10
Posts: 146
Join Date: Dec 2010
Location: Cold Igloo
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.
Galaxy S3 SGH-I747M Blue:
ROM: CyanogenMod 10 - Latest Nightly
KERNEL: Stock
RECOVERY: ClockWorkMod 6.0.1.4 Touch
RADIO: I747MVLLE8

Galaxy S3 SGH-I747M Red:
ROM: Stock
KERNEL: Stock
RECOVERY: ClockWorkMod 6.0.1.4 Touch
RADIO: I747MVLDLK4
 
crawrj
Old
#6  
crawrj's Avatar
Senior Member - OP
Thanks Meter 2742
Posts: 2,974
Join Date: Nov 2007
Quote:
Originally Posted by KryPTiCk0d3 View Post
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.
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
 
XblackdemonX
Old
#7  
XblackdemonX's Avatar
Senior Member
Thanks Meter 158
Posts: 759
Join Date: May 2008
Location: Montreal

 
DONATE TO ME
I wanna set that when I hold the headset button that it launches S Voice
Galaxy SIII SGH-I747M (16GB+64GB SD)
Rom: Vanilla RootBox Nightly 05/12
Kernel: Leankernel v5.9
----------------------------------------------
Nexus 7 16GB
Rom: Vanilla RootBox
Kernel: M-Kernel - a53
 
crawrj
Old
(Last edited by crawrj; 4th August 2012 at 04:14 AM.)
#8  
crawrj's Avatar
Senior Member - OP
Thanks Meter 2742
Posts: 2,974
Join Date: Nov 2007
Quote:
Originally Posted by XblackdemonX View Post
I wanna set that when I hold the headset button that it launches S Voice
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
 
XblackdemonX
Old
#9  
XblackdemonX's Avatar
Senior Member
Thanks Meter 158
Posts: 759
Join Date: May 2008
Location: Montreal

 
DONATE TO ME
Quote:
Originally Posted by crawrj View Post
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
lol i know that double-click skips track...

that doesn't help me lol
Galaxy SIII SGH-I747M (16GB+64GB SD)
Rom: Vanilla RootBox Nightly 05/12
Kernel: Leankernel v5.9
----------------------------------------------
Nexus 7 16GB
Rom: Vanilla RootBox
Kernel: M-Kernel - a53
 
pedroisweird
Old
#10  
Member
Thanks Meter 19
Posts: 60
Join Date: Dec 2010
Location: Minneapolis

 
DONATE TO ME
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

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

report this ad
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Guide Your Sheep to Safety with Finger Shepherd

Just a coupe of days ago, we brought you news about a game calledAgent Sheep. In that … more

Nandroid Manager Receives Major Update

Do you find yourself obsessively jumping from ROM to ROM? And do you hate having to restore a full … more

Careers in Android: Recruiter Reveals How Resumes are Chosen – XDA Developer TV

XDA Developer TV Producer Jayce released a video a … more

HttpClient Tutorial to Upload and Download with Your App

Developers wanting to interact with the Internet need to choose a package to do the … more