Headset inline control problem

I have a bit of a work-around but it is a little cumbersome and requires root. I should warn you that I know nothing about Android and just enough about linux for this to work. Samsung has bound the headset button to trigger the keycode SEND_END, what that does from there is bit hard to find for me to figure out (brings up the call log, ends calls?, nothing else?)

As far as I can tell the stock behavior should have the keycode HEADSETHOOK. See here. So if you rebind this keycode to headset button scancode it works somewhat. I guess Samsung left this keycode in the event caller? (Again I don't really know what I'm talking about). The appropriate file that needs to be changed is: /system/usr/keylayout/sec_jack.kl

A button press still does nothing in the stock music player, but the cubed (3) player does recognize the presses and will play/pause and skip tracks. The button will also answer incoming calls and mute/unmute the mic when a call is in progress (I wasn't able to end a call). Appears to do nothing in Pandora. This is my first android phone so I'm not even sure what "stock" behavior should be in these apps.
 
I have a bit of a work-around but it is a little cumbersome and requires root. I should warn you that I know nothing about Android and just enough about linux for this to work. Samsung has bound the headset button to trigger the keycode SEND_END, what that does from there is bit hard to find for me to figure out (brings up the call log, ends calls?, nothing else?)

As far as I can tell the stock behavior should have the keycode HEADSETHOOK. See here. So if you rebind this keycode to headset button scancode it works somewhat. I guess Samsung left this keycode in the event caller? (Again I don't really know what I'm talking about). The appropriate file that needs to be changed is: /system/usr/keylayout/sec_jack.kl

A button press still does nothing in the stock music player, but the cubed (3) player does recognize the presses and will play/pause and skip tracks. The button will also answer incoming calls and mute/unmute the mic when a call is in progress (I wasn't able to end a call). Appears to do nothing in Pandora. This is my first android phone so I'm not even sure what "stock" behavior should be in these apps.

Excellent find. Perhaps someone more experienced with Android programs and the like can elaborate more on this, but it's encouraging that there may be a software fix available for this.
 
The button will also answer incoming calls and mute/unmute the mic when a call is in progress (I wasn't able to end a call).

I think you need to long-press the button to end call. At least that's how it works on my Evo.
 
Long press (or multiple presses) doesn't seem to end a call, this doesn't bother me too much though. A long press when a call isn't going on will restart the music app if it isn't running (not the built-in app). FYI using the HEADSETHOOK method above works with the cubed player, mixzing, and double-twist (that's all I tried).

Also I'm not sure if another keycode would have better functionality. I tried MEDIA_PLAY_PAUSE which only paused/played music (even in the stock app) but didn't do anything in the phone app. I don't what keycode the other Samsung phones use. Probably the only solution without rooting is to get developers to modify their apps to listen for the SEND_END keycode sent on the EPIC, or maybe it's possible to write an app to listen for this keycode and broadcast another?
 
This is likely a stupid question but . . . even with root (superuser installed, root explorer installed), I can't seem to edit the file mentioned above or change its permissions.

Is there a service running that is using it that I need to stop somehow? Any tips?

EDIT: Nevermind. Setting rw mode in terminal worked. Odd that root explorer couldn't do this (although it explicitly said it was mounted in rw).
 
Last edited:
This is likely a stupid question but . . . even with root (superuser installed, root explorer installed), I can't seem to edit the file mentioned above or change its permissions.

Is there a service running that is using it that I need to stop somehow? Any tips?

The /system file system has to remounted as rw in order to make changes to that file. I couldn't get root explorer to remount it properly but an app called root manager seemed to work for me. You could also use a terminal program and remount it manually ie:
Code:
su
mount -o remount,rw /dev/block/stl9 /system
Then you can edit the sec_jack.kl file, there doesn't seem to be a simple text editor that can used from the terminal, but I used root explorer to edit it directly and it worked (once the file system was mounted as rw). I suppose you could also create the file elsewhere and copy it over via terminal or root explorer. Oddly root explorer did properly remount /system as read-only, but you could also just reboot after the edits are made and it should remount as ro.
 
You're right, terminal doesn't seem to have vi or anything like that installed. Once I set rw with terminal, however, I was able to edit the file with root explorer. Thanks for the help!
 
I just updated to EL22 (ACS ICS ROM) and now this is broken again. I tried everything suggested in this forum and no luck. Has anyone gotten this working on GB?
 
I just updated to EL22 (ACS ICS ROM) and now this is broken again. I tried everything suggested in this forum and no luck. Has anyone gotten this working on GB?

Nevermind, I figured it out just needed to set /system/usr/keylayout/sec_jack.kl to:
key 163 MEDIA_NEXT WAKE
key 165 MEDIA_PREVIOUS WAKE
key 248 HEADSETHOOK WAKE