Using the Camera button for music control :)

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
Well I tried the mod to try to get the clicker on the headset to pause/start/skip the music player. It does not work for me, anybody got this to work?

http://forum.androidcentral.com/sprint-epic-4g/32646-headset-inline-control-problem-3.html

I found an alternate way and it actually worked great! I remapped the Camera button by modifying these lines in file:

/system/usr/keylayout/s3c-keypad.kl

from "key 46 CAMERA WAKE_DROPPED" to "key 46 HEADSETHOOK WAKE"

from "key 56 FOCUS WAKE_DROPPED" to "key 56 HEADSETHOOK WAKE"



Right now I'm too lazy to write step-by-step instruction but it's similar to the stuff in the other link to make the /system read-write to modify that file. (Root phone, DroidExplorer, Astro Explorer, Root Explorer, etc)


It WORKED! With the screen on or off, the button control the default music player and Pandera flawlessly. One click for Pause/Play. Two click for skip.

Obviously the Camera button no longer takes picture, but who cares. There's a touch screen button for that anyways. It feels very natural, just like the volume buttons. Yeah!

Probably should mention the obvious. You'll have to restart the phone after modifying that file before the change takes effect.
 
Last edited:
  • Like
Reactions: ragnarokx

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
Good find! I play podcasts everyday and can really use this. It's one of the first things I'm going to do after rooting EB13.
 

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
If you are using my mod above, do not modify the file:

/system/usr/keylayout/sec_jack.kl

That way the headset clicker still operates the phone. When you get a call while listening to music, you can answer with that clicker. The music will pause and continue when the call ends. Perfect for driving or jogging situations.
 
Last edited:

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
Thanks, I'll only edit s3c-keypad.kl - I've done it before for a thing or two, but never thought to look for a way to remap the camera button for audio control.
 

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
If you or somebody else would write up clear concise step-by-step instruction for the newbies, a lot more Samsung Epic people would benefit.
 

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
I made a little improvement to the mod by adding "WAKE".

The idea here is even if the the music player is not already going, wake up the phone first. Seems to help for this case, but it doesn't always work, not sure why.

A more sure way to get the music player going from this state is to:

1) Press the Volume up button 1st
2) Now press the Camera button


Actually this behavior might be a good thing because if the phone is jostling in your pocket without a music player already going, an accidental bump on Camera button would not started it. Sorta like a lock to make sure the actions to start the music player is intentional.
 
Last edited:

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
Try it out people. You'll wondered how you lived without this mod. No more fumbling around to unlock the screen, find the music player then to pause it when someone is trying to talk to you. Also skipping to the next song because you dont like the current one while jogging or driving couldn't be easier. No need to get out of your web surfing session to pause/start the music.

I'm using the DK28 build at the moment so someone else have to chime in on how this work on the EB13 build. Not sure if it works fine with other music players either. I think it would work but chime in if you find something.
 

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
The original way the Camera button work is that it's actually two buttons in one. After the camera app is started, press it soft to focus then press harder to take a pic.

You're not loosing anything because focusing can be done be tapping a region on the screen. Then take a picture by touching camera icon on the screen. There's also a pinch gesture to zoom in/out.

Another benefit of using the Camera button for music control is that it will work with or without the headset.
 

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
Ok, this mod worked well with the default music player and music mod. Skip function could be a bit difficult to master for several different reasons:

1) Camera button hard presses is required (all the way down).
2) Time between click must be fast (otherwise it'll be like single clicks)
3) In certain states the 1st click of a double-click merely is a wake

So since there is no triple-click function, with practice this is the most reliable way to execute the Skip action. Three quick hard presses. Kinda like a video game where timing matters
 

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
The original way the Camera button work is that it's actually two buttons in one. After the camera app is started, press it soft to focus then press harder to take a pic.

Sometimes it helps to talk to myself and actually listen to what I'm saying. For those that don't eat their Wheaties and have trouble with hard Camera button presses, it is possible to remap the soft Camera button too.

So to make another improvement to the mod, the "key 56 FOCUS WAKE_DROPPED" entry should be remapped too.
 
Last edited:

pdx_shark

Member
Feb 8, 2011
11
2
0
Visit site
Here's a more detailed instruction for the Camera button mod. Try it at your own risk!

On rooted Samsung Epic:

Settings->Applications->Development->USB debugging->Check
Plugin USB cable between Samsung Epic and PC
Download and install Astro file manager from the Market

On PC:>
Download and install Samsung Epic Windows driver (32 or 64 bit version to match your OS)
Download and install DroidExplorer

Start->Program->Droid Explorer->DroidExplorer (it should recognize the Epic device)
Open a Droid Explorer->Console

In Droid Explorer console ($ and # are promts, don't type these):

$su root
#cd /
#mount -o remount,rw -t yaffs2 /dev/block/stl9 /system
#cd /sytem/usr/keylayout
#cp s3c-keypad.kl s3c-keypad.bak
#chmod 664 s3c-keypad.kl
#cp s3c-keypad.kl /sdcard

On Samsung Epic use Astro file manager:

Nagivate to /sdcard
Open As text /sdcard/s3c-keypad.kl
Make edits
"key 46 CAMERA WAKE_DROPPED" to "key 46 HEADSETHOOK WAKE"
"key 56 FOCUS WAKE_DROPPED" to "key 56 HEADSETHOOK WAKE"
Save /sdcard/s3c-keypad.kl

In Droid Explorer Shell:

#cp /sdcard/s3c-keypad.kl .
#mount -o remount,r -t yaffs2 /dev/block/stl9 /system
#exit


On Samsung Epic:

Disconnect USB cable
Settings->Applications->Development->USB debugging->Uncheck
Turn off Samsung Epic
Turn on Samdung Epic

Congrats! Now try using the Camera button to control the music player (after Media scanning complete).

Observed behavior with screen off (locked) with or without the headset is as follow:

1) From deep standby, Volume up or down then a single soft Camera button click starts the music player
2) With music player going, Pause is a single soft Camera button click (5 sec wait or longer the phone goes into deep standby)
3) With music player paused and less than about 5 sec since going into pause, Play is a single soft Camera button click
4) With music player going, Skip is a double soft Camera button click

If the screen is not locked or phone is on and being charged, you can Pause as long as you want then a single soft Camera button click starts the music player
 
Last edited:
  • Like
Reactions: ragnarokx

mjbelknap

Well-known member
Dec 9, 2010
107
12
0
Visit site
I could try to package it I suppose

Ha ha! Don't strain yourself now. ;) This sounds very impressive. As it stands, the volume control is left untouched, still controlling volume while locked, right? Or is changed to a pseudo remote unlock giving direct access to whatever media player is running at the time? I didn't quite understand that from earlier in the thread.

I use Mort Player 90% of the time to listen to audio books, and if not those it's Google Listen for webcasts. Since I'm constantly interrupted throughout the day, a quick, external, pause/play function would be amazing! Having to unlock and reopen the player all the time is an annoyance.

Thank you Pdx for putting this together! (no matter the final form...) :D
 

Forum statistics

Threads
943,122
Messages
6,917,372
Members
3,158,833
Latest member
asha_kanta_sharma