Notices


Reply
Thread Tools
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#21
Have a look at the MediaButtonsHandler here:

https://github.com/gpodder/gpodder/b...mlui/helper.py

You can even remove all the Qt stuff around it, and just use the "dbus" module (be sure to use a GLib or Qt main loop though, as you are connecting to signals).

HTH
 

The Following 2 Users Say Thank You to thp For This Useful Post:
Posts: 1,417 | Thanked: 2,619 times | Joined on Jan 2011 @ Touring
#22
Originally Posted by thp View Post
Have a look at the MediaButtonsHandler here:
here is that code:

import dbus
system_bus = dbus.SystemBus()
system_bus.add_signal_receiver(self.handle_button, 'Condition',
'org.freedesktop.Hal.Device', None, headset_path)
if gpodder.ui.harmattan:
system_bus.add_signal_receiver(self.handle_button, 'Condition',
'org.freedesktop.Hal.Device', None, headset_path2)

def handle_button(self, signal, button):
if signal == 'ButtonPressed':
if button in ('play-cd', 'phone'):
self.playPressed.emit()
elif button == 'pause-cd':
self.pausePressed.emit()
elif button == 'previous-song':
self.previousPressed.emit()
elif button == 'next-song':
self.nextPressed.emit()

playPressed = QtCore.Signal()
pausePressed = QtCore.Signal()
previousPressed = QtCore.Signal()
nextPressed = QtCore.Signal()

I think the "Phone" it is talking about though is phone in use not the headset button?
 

The Following User Says Thank You to biketool For This Useful Post:
Posts: 1,417 | Thanked: 2,619 times | Joined on Jan 2011 @ Touring
#23
Misiak
I started this thread in Maemo5 dev http://talk.maemo.org/showthread.php?p=1226840
Hoping it leads to a headset control enabler package similar to the wired headset control but for Bluetooth.
If you had this would it just be left to testing for bugs?
What else do you need?
thanks again!
 
Posts: 1,417 | Thanked: 2,619 times | Joined on Jan 2011 @ Touring
#24
Question,
Where does Headset Button Enabler package grab the wired headset signal so it can be sent to dbus? I imagine the bluetooth answer button sends to the same process.

This for the N810 seems obsolete for the N900/Maemo5 but I could be wrong. http://talk.maemo.org/archive/index.php/t-21182.html Still waiting for my N900 so I cant check.

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

Last edited by biketool; 2012-06-26 at 09:47.
 

The Following User Says Thank You to biketool For This Useful Post:
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#25
Originally Posted by biketool View Post
Question,
Where does Headset Button Enabler package grab the wired headset signal so it can be sent to dbus? I imagine the bluetooth answer button sends to the same process.

This for the N810 seems obsolete for the N900/Maemo5 but I could be wrong. http://talk.maemo.org/archive/index.php/t-21182.html Still waiting for my N900 so I cant check.

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
I think that "Headset button enabler" package only changes policies in post-install scripts, it doesn't actually emit any dbus messages. It's "headset control" (for mediaplayer) that has executable "headset-controld" which checks for button press and emits dbus signal. On N900 with only "headset button enabler" package installed, i don't see any messages in dbus when pressing headset button. Only when "headset control" is installed and "headset-controld" is running. So we would need a change in "headset control" package, otherwise there will be conflicts with any other package trying to read button press on headset (e.g. saera will start to listen and, at the same time media player will start to play music).

Thanks for your help And sorry for delays, I'm a busy man lately...
 
Posts: 1,417 | Thanked: 2,619 times | Joined on Jan 2011 @ Touring
#26
No worries, we appreciate the work you are doing when you can!
I hope the input and research helps.
 
Posts: 435 | Thanked: 769 times | Joined on Apr 2010
#27
Originally Posted by gionni88 View Post
On n900 if I don't remember wrong the wired button is disabled but you may enable it just with an amixer command. You don't need anything else, just to enable the wired button and listen to dbus events.
From QRadio:

Code:
//To connect to wired headset button:
QDBusConnection::systemBus().connect(QString(),  "/org/freedesktop/Hal/devices/computer_logicaldev_input_1",
                                         "org.freedesktop.Hal.Device",
                                         "Condition",
                                         this, SLOT(headSetButtonPressed()));

//to enable headset button, it's a shell command
amixer -qc0 cset iface=MIXER,name='Jack Bias Switch' on

//to disable:
amixer -qc0 cset iface=MIXER,name='Jack Bias Switch' off
HeadsetButtonEnabler configures your alsa settings to keep the headset working. By default on the N900 NO current goes up to the headset button when outside any call.
__________________
My Fremantle projects: InternetRadioPlayer, QRadio, InternetRadioWidget, AutoRemoveSms, PSAutoLock, TodoListWidget, MediaPlayerWidget
My Harmattan projects: InternetRadioPlayer, QMLRadio, SigmaPlayer, WidgetCanvas, NotesExporter, 3DTris, NoStopPlayer, NotesImporter
 

The Following User Says Thank You to gionni88 For This Useful Post:
Posts: 1,417 | Thanked: 2,619 times | Joined on Jan 2011 @ Touring
#28
So it seems that the information is gathered here to build a bluetooth version of HeadsetButtonEnabler for general purpose control of ausio in addition to applications in Saera. Now someone needs to change a few lines of code and rename the package to reflect bluetooth rather than wired headset and compile it to get the bluetooth headset presses to show up in dbus for apps to see?
 
Posts: 34 | Thanked: 11 times | Joined on Dec 2012
#29
okay,thank you
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#30
Originally Posted by biketool View Post
So it seems that the information is gathered here to build a bluetooth version of HeadsetButtonEnabler for general purpose control of ausio in addition to applications in Saera. Now someone needs to change a few lines of code and rename the package to reflect bluetooth rather than wired headset and compile it to get the bluetooth headset presses to show up in dbus for apps to see?
To enable dbus signals, the deamon should be written which listens to HAL signals and emits dbus signals And I'm not sure if it's just as easy as "someone needs to change a few lines of code and rename the package".
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 11:32.