Active Topics

 



Notices


Reply
Thread Tools
Posts: 207 | Thanked: 31 times | Joined on Apr 2008
#11
I install package dbus-scripts-settings 1.1 and set when my BT headphone connected start /usr/bin/kagu. When I connect headphone kagu doesn't start. How can I debug why?

I know that it is possible to connect headphone using script.
Can anybody show me how.
Sorry for stupid questions.
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#12
What is the content of /etc/dbus-scripts.d/dbus-scripts-settings ?

The script runs as root, so if kagu needs to run as a user, you need to write some script that will use su or sudo to run kagu.

The way I debug is always use a script, instead of using the program directly, and I include a line such as:

date >> /tmp/my.log

so I can at least tell if the script ran when it was supposed to.
 
Posts: 207 | Thanked: 31 times | Joined on Apr 2008
#13
I write 2 scrips for start and stop kagu and test it from root.
It works. But when device connected kagu doesn't start.

cat /etc/dbus-scripts.d/dbus-scripts-settings
/usr/local/bin/start-kagu * * org.bluez.Adapter RemoteDeviceConnected 00:0D:3C:A6:CC:13
/usr/local/bin/stop-kagu * * org.bluez.Adapter RemoteDeviceConnected 00:0D:3C:A6:CC:13

dbus-scripts --debug --system
Parsing conf file /etc/dbus-scripts.d/....
Parsing conf file /etc/dbus-scripts.d/.....
Parsing conf file /etc/dbus-scripts.d/dbus-scripts-settings...
Parsing conf file /etc/dbus-scripts.d/dbus-scripts-example...
Script file /usr/local/bin/start-kagu: arg 1 = *, arg 2 = *, arg 3 = org.bluez.Adapter, arg 4 = RemoteDeviceConnected, arg 5 = 00:0D:3C:A6:CC:13,
Script file /usr/local/bin/stop-kagu: arg 1 = *, arg 2 = *, arg 3 = org.bluez.Adapter, arg 4 = RemoteDeviceConnected, arg 5 = 00:0D:3C:A6:CC:13,
=================================
Arg 1: org.freedesktop.DBus
Arg 2: :1.351
Arg 3: org.freedesktop.DBus
Arg 4: NameAcquired
Arg 5: :1.351
=================================
Arg 1: :1.49
Arg 2: null
Arg 3: org.kernel.kevent
Arg 4: add
=================================
Arg 1: :1.32
Arg 2: null
Arg 3: org.bluez.Adapter
Arg 4: RemoteDeviceConnected
Arg 5: 00:0D:3C:A6:CC:13
Script /usr/local/bin/start-kagu matches
Script /usr/local/bin/stop-kagu matches
=================================
Arg 1: :1.33
Arg 2: null
Arg 3: com.nokia.btcond.signal
Arg 4: connection_status
Arg 5: 00:0D:3C:A6:CC:13
Arg 6: connected
=================================
Arg 1: :1.32
Arg 2: null
Arg 3: org.bluez.Adapter
Arg 4: RemoteNameUpdated
Arg 5: 00:0D:3C:A6:CC:13
Arg 6: Nokia BH-501
=================================
Arg 1: :1.33
Arg 2: null
Arg 3: com.nokia.btcond.signal
Arg 4: link_key_ok
Arg 5: 00:0D:3C:A6:CC:13
=================================
Arg 1: :1.34
Arg 2: null
Arg 3: org.bluez.audio.Headset
Arg 4: Connected
=================================
Arg 1: :1.11
Arg 2: null
Arg 3: org.freedesktop.DBus.Properties
Arg 4: Notify
Arg 5: com.nokia.bluez_headset_proxy
Arg 6: State
Arg 7: Connected
=================================
Arg 1: :1.49
Arg 2: null
Arg 3: org.kernel.kevent
Arg 4: add
=================================
Arg 1: :1.34
Arg 2: null
Arg 3: org.bluez.audio.Headset
Arg 4: Playing
=================================
Arg 1: :1.11
Arg 2: null
Arg 3: org.freedesktop.DBus.Properties
Arg 4: Notify
Arg 5: com.nokia.bluez_headset_proxy
Arg 6: State
Arg 7: Playing
=================================
Arg 1: :1.34
Arg 2: null
Arg 3: org.bluez.audio.Control
Arg 4: Connected
=================================
 
Posts: 207 | Thanked: 31 times | Joined on Apr 2008
#14
I accidentlly kill dbus daemon. IT rebooted and know everything wokr

One more question.
Is it possible to execute script via dbus-script on headphone button press?

Now I use python script to pause kagu when button press.
I have to start it from xterm each time when I start kagu.
Will be nice if need only start BT on IT and nothing more

#!/usr/bin/env python2.5

from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

import dbus
import gobject
import os

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

def on_button_pressed (sender=None):
os.system('echo pause > /home/user/.kagu/fifo')


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.he adset')
headset_iface.connect_to_signal('button_pressed', on_button_pressed, sender_keyword='sender')

dbus_loop.run()
 
Posts: 207 | Thanked: 31 times | Joined on Apr 2008
#15
I mean something like this in /etc/dbus-scripts.d/dbus-scripts-settings
...
/usr/local/bin/pause-kagu * * com.nokia.osso_hp_ls_controller.headset button_pressed 00:0D:3C:A6:CC:13
or
/usr/local/bin/pause-kagu * * org.bluez.audio.Headset AnswerRequested 00:0D:3C:A6:CC:13

Last edited by svs57; 2009-02-27 at 14:07.
 
bongo's Avatar
Posts: 291 | Thanked: 124 times | Joined on Feb 2006 @ Trier, Germany
#16
I tried to find a way to find out if the headphones are connected. The dbus signal is always the same for connect/disconnect
__________________
ongo bongo!
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#17
You seem to have both scripts running on connect. The on_disconnect (kagu_stop) should have RemoteDeviceDisconnect, not RemoteDeviceConnect.

As far as I can tell this is not a dbus-scripts-setting bug. Are you sure you selected disconnect for the second line?

About getting the same dbus signal for connect/disconnect - there are other such events, such as keyboard slide (same signal when openned and closed) USB device connect/disconnect. In such cases you need to have the script running on both events, and the script should use some other method for finding out which event actually happened (and be really careful of race conditions).
 
bongo's Avatar
Posts: 291 | Thanked: 124 times | Joined on Feb 2006 @ Trier, Germany
#18
Originally Posted by Matan View Post

About getting the same dbus signal for connect/disconnect - there are other such events, such as keyboard slide (same signal when openned and closed) USB device connect/disconnect. In such cases you need to have the script running on both events, and the script should use some other method for finding out which event actually happened (and be really careful of race conditions).
I know that, but how can I find out if the headphone is connected?
__________________
ongo bongo!
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#19
There is a file /sys/devices/platform/retu-headset/hookdet which apprently gives the value of retu adc 5. Values of less than 80 appear to indicate headset connected, while values of more, appear to indicate not connected.
 
Posts: 207 | Thanked: 31 times | Joined on Apr 2008
#20
It was mistake. I changed second line to disconnect.
I think the should be way to extend the program and add headphone button monitor.
Now I have one script to monitor connect/disconnect BT and one for monitor BT button.
 
Reply


 
Forum Jump


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