View Single Post
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#1
This daemon monitors when the button on the headset is pressed and makes the media player pause the playing song.

Download: Attached.

Install instructions :
  1. Install deb.
  2. Run Media player or Canola.
  3. Play a track.
  4. Press headset button.
  5. Enjoy as song pauses.
  6. If you wish, edit /usr/lib/hsetctrl/hsetctrl.py to change the program it runs.


Credits:
Media players supported by the default configuration:
  • The built-in, included media player with OS2008.
  • Canola*

"Configurations" available:
Default - This config uses dbus-send to send a pause message to the osso-media-server. So this config would only work with those players that use osso-media-server.
MPlayer - This one uses key-presses sent via xte to manipulate mplayer. Pressing the headset button will send a Return key press and pause the playing video.

Your Own. - Make your own command run when you press the button. If your program can be controlled by dbus, run dbus-monitor and make a dbus-send command. Or if by key presses, find out which one and make xte send that key press. Also, for example, on the bitsmithy website, there is a command to run flite to speak the time.

The original script to do this with a Bluetooth headset used xte to control the built in media player. I replaced that xte command with the dbus one as it didn't require focus to be on the media player window.
I don't really have an easy way to switch so edit /usr/bin/hsetctrl.py as root, manually. I've put comments in the file.

*For canola, it only works for playing/pausing the music by default as that uses osso-media-server. Movies won't work for example because that uses mplayer. But it wouldn't be hard to find the key press event and make the headset-control app run that instead.

(BTW. If anyone is into headset modding, grab the kernel source and look at retu-headset.c)

(If you get unable to install (it probably won't say that but for me it does (with EVERY program that adds something to init), do this:
sudo gainroot
mv /etc/rc2.d/S99hsetctrl /etc/rc2.d/S99hsetctrl1
apt-get -f install
mv /etc/rc2.d/S99hsetctrl1 /etc/rc2.d/S99hsetctrl
)

EDIT: Version 0.2 uploaded. Little bugs fixed.
Attached Files
File Type: deb headsetcontrol_0.2_armel.deb (15.0 KB, 1873 views)

Last edited by qwerty12; 2008-06-25 at 13:41.
 

The Following 54 Users Say Thank You to qwerty12 For This Useful Post: