Skip to contentSkip to conversation

Help me to test top of tree bluetooth subsystem

DISCUSSION balaji palaniswami 2 participants 2 messages May 12, 2009 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi All ,

I have upgraded the ubuntu 8.04 kernel to 2.6.30-rc5 and bluez 4.39. I did pairing with Jabra headset using below pyhton script. I got below error message. This issue is related with ubuntu application dbus. so please advise me which distribution , setup procedure would be suitable to test top tree of bluetooth subsystem.

Thanks,
Balaji.P

Traceback (most recent call last):
File "./bthstereoheadset.py", line 25, in <module>
path = audio.CreateDevice(headsetAddress)
File "/var/lib/python-support/python2.5/dbus/proxies.py", line 68, in __call__
return self._proxy_method(*args, **keywords)
File "/var/lib/python-support/python2.5/dbus/proxies.py", line 140, in __call__

    **keywords)

File "/var/lib/python-support/python2.5/dbus/connection.py", line 607, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.bluez.Error.ConnectionAttemptFailed: Host is down

Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads.yahoo.com/in/firefox/?fr=om_email_firefox

#!/usr/bin/python
import dbus
import os
import sys

def printusage():
print 'bthstereoheadset.py <options>'
print ' create - create a stereo headset'
print ' start - connect sink'
print ' stop - disconnect sink'
return

headsetAddress = os.getenv("BTSTEREO_HEADSET")

print 'BT Stereo Headset Is : => %s' % headsetAddress

bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager') bus_id = manager.ActivateService('audio')
audio = dbus.Interface(bus.get_object(bus_id, '/org/bluez/audio'), 'org.bluez.audio.Manager')

if len(sys.argv) == 1 :
printusage()
elif len(sys.argv) > 1 and sys.argv[1] == 'create' :
path = audio.CreateDevice(headsetAddress) audio.ChangeDefaultDevice(path)
sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink') sink.Connect()
print 'Stereo Headset Connect Done'
elif len(sys.argv) > 1 and sys.argv[1] == 'start' :
path = audio.DefaultDevice()
sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink') if not sink.IsConnected() :
sink.Connect()
print 'Audio connected'
elif len(sys.argv) > 1 and sys.argv[1] == 'stop' :
path = audio.DefaultDevice()
sink = dbus.Interface (bus.get_object(bus_id, path), 'org.bluez.audio.Sink') try :
sink.Disconnect()
except dbus.exceptions.DBusException:
print 'Disconnect Failed'
print 'Stereo headset disconnect complete'

#1 lore raw

Hi Balaji,

Quoted 4 lines · balaji palaniswami

Hi All ,

I have upgraded the ubuntu 8.04 kernel to 2.6.30-rc5 and bluez 4.39. I did pairing with Jabra headset using below pyhton script. I got below error message. This issue is related with ubuntu application dbus. so please advise me which distribution , setup procedure  would be suitable to test top tree of bluetooth subsystem.

There is an audio devices howto at the wiki[1], which has been updated recently (thanks Zygo!),
it covers pretty much everything.

Taking a look at the traceback and the script you have provided it seems that you still are running
a daemon from the old 3.x series. The dbus interface has changed, please take a look at the *-api.txt
files in the doc directory in a more recent version.

Quoted 16 lines

Thanks,
Balaji.P

Traceback (most recent call last):
 File "./bthstereoheadset.py", line 25, in <module>
   path = audio.CreateDevice(headsetAddress)
 File "/var/lib/python-support/python2.5/dbus/proxies.py", line 68, in __call__ return self._proxy_method(*args, **keywords)
 File "/var/lib/python-support/python2.5/dbus/proxies.py", line 140, in __call__ **keywords)
 File "/var/lib/python-support/python2.5/dbus/connection.py", line 607, in call_blocking message, timeout)
dbus.exceptions.DBusException: org.bluez.Error.ConnectionAttemptFailed: Host is down

Quoted 1 line

     Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads.yahoo.com/in/firefox/?fr=om_email_firefox

Cheers,

Signature · 4 lines
Vinicius Gomes
INdT - Instituto Nokia de Tecnologia

[1] http://wiki.bluez.org/wiki/HOWTO/AudioDevices