Go Back   maemo.org - Talk > Software > Multimedia
 
Register FAQ Community Calendar Today's Posts Search

Notices

Reply
 
Thread Tools
  #1  
Old 2008-06-22, 07:09
qwerty12's Avatar
qwerty12 qwerty12 is offline
 
Join Date: Sep 2007
Location: Looking at y'all and sighing
Posts: 4,274
Thanks!: 5,528
Thanked 5,358 Times in 1,954 Posts
Default [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

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, 1828 views)

Last edited by qwerty12; 2008-06-25 at 13:41.
Reply With Quote
  #2  
Old 2008-07-12, 21:21
tz1's Avatar
tz1 tz1 is offline
 
Join Date: Dec 2007
Posts: 716
Thanks!: 50
Thanked 236 Times in 148 Posts
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

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:

Code:
signal sender=:1.0 -> dest=(null destination) path=/com/nokia/osso_hp_ls_controller; interface=com.nokia.osso_hp_ls_controller.headset; member=button_pressed
signal sender=:1.0 -> dest=(null destination) path=/com/nokia/osso_hp_ls_controller; interface=com.nokia.osso_hp_ls_controller.headset; member=button_released
when I press and release, not the hal events.
Reply With Quote
The Following User Says Thank You to tz1 For This Useful Post:
  #3  
Old 2008-07-12, 21:25
qwerty12's Avatar
qwerty12 qwerty12 is offline
 
Join Date: Sep 2007
Location: Looking at y'all and sighing
Posts: 4,274
Thanks!: 5,528
Thanked 5,358 Times in 1,954 Posts
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

Well, this is for the wired headset. (My bad, I should have mentioned that). if you want to use a bluetooth headset, check out www.bitsmithy.net
Reply With Quote
  #4  
Old 2008-07-13, 16:11
tz1's Avatar
tz1 tz1 is offline
 
Join Date: Dec 2007
Posts: 716
Thanks!: 50
Thanked 236 Times in 148 Posts
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

I forgot the original headset had that button. Actually this might be even better.
Reply With Quote
  #5  
Old 2008-07-14, 01:48
Laughing Man Laughing Man is offline
 
Join Date: Dec 2007
Posts: 4,556
Thanks!: 558
Thanked 1,624 Times in 956 Posts
Send a message via Skype™ to Laughing Man
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

I always wondered what that even did by default (I never figured it out).
__________________
Quote:
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...
Reply With Quote
  #6  
Old 2008-07-14, 02:19
sakamoto sakamoto is offline
 
Join Date: Dec 2007
Posts: 22
Thanks!: 1
Thanked 0 Times in 0 Posts
Thumbs up Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

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

Saka

Last edited by sakamoto; 2008-07-25 at 02:52.
Reply With Quote
  #7  
Old 2008-07-26, 23:20
Saturn's Avatar
Saturn Saturn is offline
 
Join Date: Mar 2007
Location: UNKLE's Never Never Land
Posts: 1,648
Thanks!: 564
Thanked 2,122 Times in 738 Posts
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

Quote:
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.
Reply With Quote
The Following User Says Thank You to Saturn For This Useful Post:
  #8  
Old 2008-07-27, 20:39
ericcmi ericcmi is offline
 
Join Date: Apr 2008
Posts: 21
Thanks!: 2
Thanked 4 Times in 2 Posts
Default Possible to make it compatable with both blutooth button as well as wired buton?

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.
Reply With Quote
  #9  
Old 2008-07-28, 06:09
ericcmi ericcmi is offline
 
Join Date: Apr 2008
Posts: 21
Thanks!: 2
Thanked 4 Times in 2 Posts
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

I tried to hack this together myself.
But its not working.
I used the deb installer and replaced /usr/lib/hsetvtrl/hsetctrl.py with the below script which used dbus to start and stop canola/mplayer.

If i run just 'dbus-send --dest=com.nokia.osso_media_server /com/nokia/osso_media_server com.nokia.osso_media_server.music.pause' 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:
Code:
#!/usr/bin/env python2.5
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

import dbus
import gobject
import os

def main():

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


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

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

	dbus_loop.run()

if __name__ == "__main__":
	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.
Reply With Quote
  #10  
Old 2008-10-14, 06:54
Nif Nif is offline
 
Join Date: Jan 2008
Location: The Hague, The Netherlands
Posts: 30
Thanks!: 7
Thanked 2 Times in 2 Posts
Default Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.

Hi

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 ;-)
Reply With Quote
Reply

Tags
ad-54/hs-45, headset button


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 20:14.