liamw9534 / bt-manager

A library for managing bluetooth devices using Python, Bluez and DBus.
GNU General Public License v3.0
24 stars 14 forks source link

AttributeError: 'SBCAudioSource' object has no attribute 'access_type' #3

Open sami-sweng opened 9 years ago

sami-sweng commented 9 years ago

Hello,

Whenever I try to launch the demo.py and try to ouput sound to a speaker I got this error:

media-encode /endpoint/a2dpsource ~/out.pcm
Traceback (most recent call last):
  File "demo.py", line 739, in <module>
    invoke_bt_command(text)
  File "demo.py", line 699, in invoke_bt_command
    cmd_entry.func(args)
  File "demo.py", line 541, in media_encode
    ep.register_transport_ready_event(media_encode_handler, (ep, fd))
  File "/usr/local/lib/python2.7/dist-packages/bt_manager/audio.py", line 211, in register_transport_ready_event
    if ('r' in self.access_type):
AttributeError: 'SBCAudioSource' object has no attribute 'access_type'

If you have any idea from where that could come from you would help a lot! Thank you!

Ps. here is the output of device discovery if it can help:

=========================================================
{'0100': 'Hands-Free unit',
 u'BluetoothProfileDescriptorList': [[{u'uuid': <uuid:0000111E-0000-1000-8000-00805F9B34FB name:Handsfree desc:Hands-Free Profile (HFP) NOTE: Used as both Service Class Identifier and Profile Identifier.>},
                                      '0x0105']],
 u'LanguageBaseAttributeIDList': ['0x656e', '0x006a', '0x0100'],
 u'ProtocolDescriptorList': [[{u'uuid': <uuid:00000100-0000-1000-8000-00805F9B34FB name:L2CAP desc:Bluetooth Core Specification>}],
                             [{u'uuid': <uuid:00000003-0000-1000-8000-00805F9B34FB name:RFCOMM desc:RFCOMM with TS 07.10>},
                              '0x01']],
 u'ServiceClassIDList': [{u'uuid': <uuid:0000111E-0000-1000-8000-00805F9B34FB name:Handsfree desc:Hands-Free Profile (HFP) NOTE: Used as both Service Class Identifier and Profile Identifier.>},
                         {u'uuid': <uuid:00001203-0000-1000-8000-00805F9B34FB name:GenericAudio desc:N/A>}],
 u'ServiceRecordHandle': '0x00010000',
 u'SupportedFeatures': '0x0011'}
=========================================================
{'0311': '0x0001',
 u'BluetoothProfileDescriptorList': [[{u'uuid': <uuid:0000110D-0000-1000-8000-00805F9B34FB name:AdvancedAudioDistribution desc:Advanced Audio Distribution Profile (A2DP)>},
                                      '0x0102']],
 u'ProtocolDescriptorList': [[{u'uuid': <uuid:00000100-0000-1000-8000-00805F9B34FB name:L2CAP desc:Bluetooth Core Specification>},
                              '0x0019'],
                             [{u'uuid': <uuid:00000019-0000-1000-8000-00805F9B34FB name:AVDTP desc:Audio/Video Distribution Transport Protocol (AVDTP)>},
                              '0x0102']],
 u'ServiceClassIDList': [{u'uuid': <uuid:0000110B-0000-1000-8000-00805F9B34FB name:AudioSink desc:Advanced Audio Distribution Profile (A2DP)>}],
 u'ServiceRecordHandle': '0x00010001'}
=========================================================
{u'PrimaryRecord': 'true',
 u'ProductID': '0xba20',
 u'ServiceClassIDList': [{u'uuid': <uuid:00001200-0000-1000-8000-00805F9B34FB name:PnPInformation desc:Device Identification (DID) NOTE: Used as both Service Class Identifier and Profile Identifier.>}],
 u'ServiceRecordHandle': '0x00010002',
 u'SpecificationID': '0x0103',
 u'VendorID': '0x046d',
 u'VendorIDSource': '0x0002',
 u'Version': '0x0406'}
=========================================================
{u'PrimaryRecord': 'true',
 u'ProductID': '0xba20',
 u'ServiceClassIDList': [{u'uuid': <uuid:00001200-0000-1000-8000-00805F9B34FB name:PnPInformation desc:Device Identification (DID) NOTE: Used as both Service Class Identifier and Profile Identifier.>}],
 u'ServiceRecordHandle': '0x00010003',
 u'SpecificationID': '0x0103',
 u'VendorID': '0x046d',
 u'VendorIDSource': '0x0002',
 u'Version': '0x0406'}
=========================================================
{u'BluetoothProfileDescriptorList': [[{u'uuid': <uuid:0000110E-0000-1000-8000-00805F9B34FB name:AVRemoteControl desc:Audio/Video Remote Control Profile (AVRCP) NOTE: Used as both Service Class Identifier and Profile Identifier.>},
                                      '0x0104']],
 u'ProtocolDescriptorList': [[{u'uuid': <uuid:00000100-0000-1000-8000-00805F9B34FB name:L2CAP desc:Bluetooth Core Specification>},
                              '0x0017'],
                             [{u'uuid': <uuid:00000017-0000-1000-8000-00805F9B34FB name:AVCTP desc:Audio/Video Control Transport Protocol (AVCTP)>},
                              '0x0103']],
 u'ServiceClassIDList': [{u'uuid': <uuid:0000110E-0000-1000-8000-00805F9B34FB name:AVRemoteControl desc:Audio/Video Remote Control Profile (AVRCP) NOTE: Used as both Service Class Identifier and Profile Identifier.>},
                         {u'uuid': <uuid:0000110F-0000-1000-8000-00805F9B34FB name:AVRemoteControlController desc:Audio/Video Remote Control Profile (AVRCP) NOTE: __The AVRCP specification v1.3 and later require that 0x110E also be included in the ServiceClassIDList before 0x110F for backwards compatibility.>}],
 u'ServiceRecordHandle': '0x00010004',
 u'SupportedFeatures': '0x0001'}
=========================================================
{'0100': 'LWACP',
 u'LanguageBaseAttributeIDList': ['0x656e', '0x006a', '0x0100'],
 u'ProtocolDescriptorList': [[{u'uuid': <uuid:00000100-0000-1000-8000-00805F9B34FB name:L2CAP desc:Bluetooth Core Specification>}],
                             [{u'uuid': <uuid:00000003-0000-1000-8000-00805F9B34FB name:RFCOMM desc:RFCOMM with TS 07.10>},
                              '0x05']],
 u'ServiceClassIDList': [{u'uuid': <uuid:00001101-0000-1000-8000-00805F9B34FB name:SerialPort desc:Serial Port Profile (SPP) NOTE: __The example SDP record in SPP v1.0 does not include a BluetoothProfileDescriptorList attribute, but some implementations may also use this UUID for the Profile Identifier.>}],
 u'ServiceRecordHandle': '0x00010005'}
=========================================================
{u'BluetoothProfileDescriptorList': [[{u'uuid': <uuid:0000110E-0000-1000-8000-00805F9B34FB name:AVRemoteControl desc:Audio/Video Remote Control Profile (AVRCP) NOTE: Used as both Service Class Identifier and Profile Identifier.>},
                                      '0x0104']],
 u'ProtocolDescriptorList': [[{u'uuid': <uuid:00000100-0000-1000-8000-00805F9B34FB name:L2CAP desc:Bluetooth Core Specification>},
                              '0x0017'],
                             [{u'uuid': <uuid:00000017-0000-1000-8000-00805F9B34FB name:AVCTP desc:Audio/Video Control Transport Protocol (AVCTP)>},
                              '0x0103']],
 u'ServiceClassIDList': [{u'uuid': <uuid:0000110C-0000-1000-8000-00805F9B34FB name:AVRemoteControlTarget desc:Audio/Video Remote Control Profile (AVRCP)>}],
 u'ServiceRecordHandle': '0x00010006',
 u'SupportedFeatures': '0x0002'}
=========================================================
{'0100': 'Wireless iAP',
 u'LanguageBaseAttributeIDList': ['0x656e', '0x006a', '0x0100'],
 u'ProtocolDescriptorList': [[{u'uuid': <uuid:00000100-0000-1000-8000-00805F9B34FB name:L2CAP desc:Bluetooth Core Specification>}],
                             [{u'uuid': <uuid:00000003-0000-1000-8000-00805F9B34FB name:RFCOMM desc:RFCOMM with TS 07.10>},
                              '0x06']],
 u'ServiceAvailability': ['0xff'],
 u'ServiceClassIDList': [{u'uuid': '000000-DECA-FADE-DECA-DEAFDECACAFF'}],
 u'ServiceRecordHandle': '0x00010007'}
=========================================================
luan007 commented 9 years ago

same error w/ Bluez 4.100.. wonders which version of bluez is recommended here..

liamw9534 commented 9 years ago

Which device are you connecting to as A2DP source? Is it an iPhone?

I think 4.100 should be fine.

I can try to replicate if you let me know what you are connecting with.

liamw9534 commented 9 years ago

Also tell me the sequence of steps you go through to establish a connection and when you are starting the audio stream on the A2DP source device.