[Samsung Epic 4G Touch] Glenn54:
This fix allows you to use the one button or middle button on your headsets. You will be able to pause/start music answer/hangup phone for Samsung Galaxy S II and other phones using Gingerbread that the headset buttons may no longer work on.

I spent way too much time on this, so I figured I would share a how to for all of you.

You WILL need to Root your phone. I’ve found what I think is the best/easiest way of doing this. This Root process WILL NOT flash or change your OS.

Step 1:

Root your phone with DooMLoRD fantastic ‘Easy Root Toolkit’ link http://xdaforums.com/showthread.php?t=1321582 you can read the 27 plus page link like I did or just trust me it works great. I rebooted the phone before running the install I used his V2 on the first page. Download his DooMLoRD_v2_ROOT-zergRush-busybox-su.zip <NEW> from the link on the first page. Again his process DOES NOT flash your phone as other rooting processes with ODIN will. He also has an unRoot.

Step 2:

Install one of the file managers I use Linda File Manager and/or File Expert from the market.

Install a texted editor I use Text Edit from the market.

Install a terminal emulator I use Android Terminal Emulator from the market.

Install Jays Headset Control. (This app is no longer available from the market for the SGS2. Compatibility issues stemming from the improper coding the sec_jack.kl file. The developer of Jays Headset is kind enough to post a link to app, see link at the bottom of this post.)

Step 3:

Open the terminal emulator

(To bring up the soft keyboard hit the menu button then the toggle soft keyboard “the menu button is at the bottom left of the SGS2” ) now type and enter the following commands:

cd /sdcard

mkdir fixbutton

cp /system/usr/keylayout/sec_jack.kl /sdcard/fixbutton/sec_jack.kl

cd /sdcard/fixbutton

ls

You should see the sec_jack.kl file.

To make a backup of the original type and enter the following command:

cp /system/usr/keylayout/sec_jack.kl /sdcard/fixbutton/sec_jack.kl.bkp

(if you have this problem where the i to turns into an I in the mkdir command the work around is type mkdi then hit the menu key and the toggle soft keyboard twice then enter the r)

Hit the home button

Step 4:

Open Linda File Manager

Hit SD Card

Scroll to fixbutton directory hit it

Hit the sec_jack.kl

Select Text Edit

It will look like this:

key 163 MEDIA_NEXT WAKE

key 165 MEDIA_PREVIOUS WAKE

key 226 SEND_END WAKE

change SEND_END to HEADSETHOOK

And add

key 164 MEDIA_PLAY_PAUSE WAKE

hit menu key then save.

It should look like this

key 163 MEDIA_NEXT WAKE

key 164 MEDIA_PLAY_PAUSE WAKE

key 165 MEDIA_PREVIOUS WAKE

key 226 HEADSETHOOK WAKE

Step5:

Find the mount point of /system . On my SGS2 its /dev/block/mmcblk0p9

Open Terminal Emulator and type and enter the following command (this is just a display command):

mount

The /system mount point is in the middle. If you click on the attachment below you will see a display from my SGS2, in the middle of the display on line 14 is the mount point

/dev/block/mmcblk0p9 /system ext4 ro,realtime,battier=1,data=ordered 0 0

The mount point is the first part of that line, on my SGS2 its:

/dev/block/mmcblk0p9

Other phones will be different, so write it down.

Step 6:

Remount /system in read write mode and copy the modified kl file back. (Click Allow for the su command when it pops up). If your mount point is different then /dev/block/mmcblk0p9 replace your mount point in the mount command below.

Open the terminal emulator and enter the following commands:

su

mount -o remount,rw /dev/block/mmcblk0p9 /system

cp /sdcard/fixbutton/sec_jack.kl /system/usr/keylayout/sec_jack.kl

hit the back button power off and power on

Step 7:

Open Jays Headset Controller

Choose Advanced

Hit Button Actions

Change Phone options right side of Click and Hold to Answer and End call

Change Headset options left side of Click and Hold to whatever you want (I like Play/Pause)

Enjoy, Click and Hold button for a second or 2 this will

Startup Music Player / Pause / Start / Music / Answer / Hangup phone calls

That’s it, if this helps you give me a thumbs up and send money to the people that created the software that helps you!

Another tip, to save a lot of battery life, every time you reboot the phone hit Settings>Applications>Running services then hit DRM content > stop > ok, turn your display down to under 50%

:cool:

Jays software can be found here http://xdaforums.com/showpost.php?p=20033923&postcount=86

Now in a Flashable zip file

Made by ravizzle....thank you

Ok so i made a flashable zip of this mod. Op feel free to add this to the first post. Thanks for the mod in the first place!

Instructions:

1)Download zip

2)Flash in cwm

3)download "Jays headset control"

4)open Jays headset control app~ choose advanced~ button actions~ change phone options next to "click and hold" to answer and end call ~ change options on music icon next to "click and hold" to desired actions (OP used for pause/play, i personally use it to skip to next track.)

5) Enjoy!

if you have any problems or instructions are unclear please let me know and i will try to correct them.

Attached Files Headset button mod-signed.zip here or at the bottom of this post

/*

Anyone using a Custom ROM can use this code for the sec_jack.kl file, it will allow for more options working:

key 226 HEADSETHOOK WAKE

key 164 HEADSETHOOK WAKE #V2 Hardware support

key 163 MEDIA_NEXT WAKE

key 165 MEDIA_PREVIOUS WAKE

key 168 MEDIA_REWIND WAKE #V2 Hardware support

key 208 MEDIA_FAST_FORWARD WAKE #v2 Hardware support

key 115 VOLUME_UP WAKE

key 114 VOLUME_DOWN WAKE

key 107 ENDCALL WAKE

key 113 MUTE WAKE

key 231 CALL WAKE

key 248 HEADSETHOOK WAKE

key 76 HEADSETHOOK WAKE