Thread Tools
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,356 times | Joined on Sep 2007 @ Looking at y'all and sighing
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/ to change the program it runs.

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/ 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, 1779 views)

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

The Following 54 Users Say Thank You to qwerty12 For This Useful Post:
tz1's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
I needed the python-dbus support installed.

Also, it doesn't seem to work. I have an aliph jawbone on an n810 with diablo. I get:

signal sender=:1.0 -> dest=(null destination) path=/com/nokia/osso_hp_ls_controller;; member=button_pressed
signal sender=:1.0 -> dest=(null destination) path=/com/nokia/osso_hp_ls_controller;; member=button_released
when I press and release, not the hal events.

The Following User Says Thank You to tz1 For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,356 times | Joined on Sep 2007 @ Looking at y'all and sighing
Well, this is for the wired headset. (My bad, I should have mentioned that). if you want to use a bluetooth headset, check out
tz1's Avatar
Posts: 716 | Thanked: 236 times | Joined on Dec 2007
I forgot the original headset had that button. Actually this might be even better.
Posts: 4,556 | Thanked: 1,622 times | Joined on Dec 2007
I always wondered what that even did by default (I never figured it out).
Originally Posted by ysss View Post
They're maemo and MeeGo...

"Meamo!" sounds like what Zorro would say to catherine zeta jones... after she slaps him for looking at her dirtily...
Posts: 22 | Thanked: 0 times | Joined on Dec 2007
That's great!! Working fine with the bundle headset, Thanks!

But seem like can't work with my another headset, which is come with my N81 phone


Last edited by sakamoto; 2008-07-25 at 02:52.
Saturn's Avatar
Posts: 1,633 | Thanked: 2,066 times | Joined on Mar 2007 @ UNKLE's Never Never Land
Originally Posted by Laughing Man View Post
I always wondered what that even did by default (I never figured it out).
one thing it does by default is to answer or end a call in the 'internet call' application.

The Following User Says Thank You to Saturn For This Useful Post:
Posts: 21 | Thanked: 4 times | Joined on Apr 2008
Would it be possible to make this compatible with both bluetooth headset button as well as wired button?

That would be much appreciated among the community.

Or even dream up a way that makes it possible for people to easily change the event of the button press from a seprate file so that the function of the button can be changed easily simply by overwriting a file.

but really, the community has been waiting for a way to pause canola with a bluetooth headset button for a very very long time.

Thanks for the work.
Posts: 21 | Thanked: 4 times | Joined on Apr 2008
I tried to hack this together myself.
But its not working.
I used the deb installer and replaced /usr/lib/hsetvtrl/ with the below script which used dbus to start and stop canola/mplayer.

If i run just 'dbus-send /com/nokia/osso_media_server' in the terminal while canola is running I get a working play/pause system. However this does not work when trying to use it in the script below.

Here's the script I am using:
#!/usr/bin/env python2.5
from dbus.mainloop.glib import DBusGMainLoop

import dbus
import gobject
import os

def main():

	dbus_loop = gobject.MainLoop()
	bus = dbus.SystemBus()

		def on_button_pressed (sender=None):
		os.system(' dbus-send /com/nokia/osso_media_server 2> /dev/null 1> /dev/null')

headset = bus.get_object('', '/com/nokia/osso_hp_ls_controller')
headset_iface = dbus.Interface(headset, dbus_interface='')
headset_iface.connect_to_signal('button_pressed', on_button_pressed, sender_keyword='sender')

if __name__ == "__main__":
Do you see any flaws? Why does my bluetooth button not calling the dbus command properly? I'm not to certian what all is done by the deb installer, and im a python newb. so, any comments are welsome.
Posts: 30 | Thanked: 2 times | Joined on Jan 2008 @ The Hague, The Netherlands

I see there has been no activity for some time on this thread but I will still give my question a try:

What are the commands to put into the code to enable play/pause while having Canola configured with mplayer for the music?

Background is that I want to use mplayer in stead of oms in Canola to boost the volume. I also want the play/pause functionality described here which works very nicely with oms running for music. So I now just want best of both worlds ;-)

ad-54/hs-45, headset button

Thread Tools

Forum Jump

All times are GMT. The time now is 04:10.