# Qualcomm Bluetooth D-Bus problem



## TheWhisp (Jun 14, 2012)

Hi, I'm an Android enthusiast and I recently started working on CM10 port for Galaxy Mini 2, most of the bugs have been already solved. Tough, I am not able to fix bluetooth. It seems the device is using some Qualcomm chip. The firmware is downloaded by hci_qcomm_init binary. Hciattach is run by init.qcom.bt.sh which is located in /etc, it calls hci_qcomm_init which outputs all the needed parameters for hciattach and in the logcat I see that the firmware (qualcomm-ibs) is downloaded successfully. Then bluetoothd is starting and bunch of d-bus related errors come up. And bluedroid stops hciattach and bluetoothd.

Logcat:


```
D/BluetoothMasReceiver( 1242): Bluetooth STATE CHANGED to 11<br />
D/dalvikvm(  350): GC_EXPLICIT freed 134K, 44% free 5890K/10375K, paused 48ms+17ms, total 270ms<br />
I/bluedroid(  350): Starting hciattach daemon<br />
I/qcom-bluetooth( 1260): /system/etc/init.qcom.bt.sh: Transport :  <br />
I/qcom-bluetooth( 1261): /system/etc/init.qcom.bt.sh: Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)<br />
I/qcom-bluetooth( 1262): /system/etc/init.qcom.bt.sh: Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3><br />
D/dalvikvm(  517): GC_EXPLICIT freed 767K, 64% free 2695K/7363K, paused 3ms+10ms, total 72ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 142K, 44% free 5886K/10375K, paused 5ms+9ms, total 106ms<br />
I/qcom-bluetooth( 1270): /system/etc/init.qcom.bt.sh: Bluetooth QSoC firmware download succeeded, /dev/ttyHS0 qualcomm-ibs 3000000<br />
I/qcom-bluetooth( 1271): /system/etc/init.qcom.bt.sh: start hciattach<br />
I/qcom-bluetooth( 1273): /system/etc/init.qcom.bt.sh: start_hciattach: pid = 1272<br />
D/dalvikvm(  350): GC_EXPLICIT freed 143K, 44% free 5907K/10375K, paused 10ms+19ms, total 137ms<br />
I/bluedroid(  350): Starting bluetoothd deamon<br />
E/BluetoothEventLoop.cpp(  350): get_adapter_path: D-Bus error: org.freedesktop.DBus.Error.ServiceUnknown (The name org.bluez was not provided by any .service files)<br />
I/abtfilt ( 1276): Ath BT Filter Daemon<br />
I/abtfilt ( 1276): Enabling Debug Information<br />
D/abtfilt ( 1276): Abf_WlanCheckSettings : wlan: wlan0<br />
D/abtfilt ( 1276): Calling Fcore Init<br />
I/abtfilt ( 1276): BT Filter Core init complete<br />
I/abtfilt ( 1276): WLAN Stack Notification init complete<br />
I/abtfilt ( 1276): AFH Classification Command will be issued on WLAN connect/disconnect<br />
I/abtfilt ( 1276): Headset Profile notifications will use HCI filter instead of DBUS<br />
E/BluetoothEventLoop.cpp(  350): get_adapter_path: D-Bus error: org.freedesktop.DBus.Error.ServiceUnknown (The name org.bluez was not provided by any .service files)<br />
I/abtfilt ( 1276): Starting the WLAN Event Handler task<br />
I/abtfilt ( 1276): Checking WLAN adapter on startup ..<br />
D/abtfilt ( 1276): Abf_WlanCheckSettings : wlan: wlan0<br />
I/abtfilt ( 1276): Starting the BT Filter task<br />
I/abtfilt ( 1276): BT Filter Core : WLAN Arrived<br />
E/abtfilt ( 1276): [DoMethodCall] Failed to invoke method call (org.bluez.Manager : method : DefaultAdapter) The name org.bluez was not provided by any .service files<br />
D/abtfilt ( 1276): Abf_WlanCheckSettings : wlan: wlan0<br />
I/abtfilt ( 1276): FLAGS = 67, Issue FE antenna configuration as single<br />
I/abtfilt ( 1276): WLAN Adapter Added<br />
E/abtfilt ( 1276): Last Error: Try again<br />
E/abtfilt ( 1276): [AcquireBtAdapter] Get Default Adapter failed<br />
E/abtfilt ( 1276): Last Error: Try again<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Manager'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Manager'<br />
I/abtfilt ( 1276): BT Stack Notification init complete<br />
D/abtfilt ( 1276): Service running, waiting for termination ....<br />
I/abtfilt ( 1276): Starting the BT Event Handler task<br />
I/abtfilt ( 1276): Entering DBus Message loop<br />
D/abtfilt ( 1276): WMI_REPORT_SLEEP_STATE_EVENTID: 6<br />
I/abtfilt ( 1276): FLAGS = 67, Issue FE antenna configuration as single<br />
I/abtfilt ( 1276): BT Filter Core : WLAN Arrived<br />
D/abtfilt ( 1276): Abf_WlanCheckSettings : wlan: wlan0<br />
I/abtfilt ( 1276): FLAGS = 67, Issue FE antenna configuration as single<br />
E/BluetoothEventLoop.cpp(  350): get_adapter_path: D-Bus error: org.freedesktop.DBus.Error.ServiceUnknown (The name org.bluez was not provided by any .service files)<br />
E/BluetoothEventLoop.cpp(  350): get_adapter_path: D-Bus error: org.bluez.Error.NoSuchAdapter (No such adapter)<br />
E/BluetoothEventLoop.cpp(  350): failure setting up Event Loop!<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276): BtAdapterAdded (/org/bluez/1275/hci0) Callback ...<br />
D/dalvikvm(  517): GC_EXPLICIT freed 764K, 64% free 2692K/7363K, paused 4ms+9ms, total 50ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 153K, 44% free 5901K/10375K, paused 5ms+11ms, total 102ms<br />
D/BluetoothEventLoop(  350): Property Changed: Pairable : false<br />
D/BluetoothEventLoop(  350): Property Changed: Powered : false<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 3<br />
E/BluetoothService.cpp(  350): setBluetoothTetheringNative true<br />
E/bluetooth_common.cpp(  350): dbus_func_args_timeout_valist: D-Bus error in Register: org.freedesktop.DBus.Error.UnknownMethod (Method "Register" with signature "ss" on interface "org.bluez.NetworkServer" doesn't exist<br />
E/bluetooth_common.cpp(  350): )<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 4<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 5<br />
D/BluetoothAdapterStateMachine(  350): WarmUp process message: 101<br />
D/BluetoothAdapterStateMachine(  350): WarmUp process message: 54<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 6<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 7<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 8<br />
D/dalvikvm(  350): GC_EXPLICIT freed 165K, 44% free 5893K/10375K, paused 4ms+7ms, total 92ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 766K, 64% free 2697K/7363K, paused 3ms+8ms, total 57ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 112K, 44% free 5893K/10375K, paused 5ms+8ms, total 89ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 113K, 44% free 5892K/10375K, paused 4ms+7ms, total 95ms<br />
D/dalvikvm(  517): GC_CONCURRENT freed 1753K, 64% free 2681K/7363K, paused 3ms+7ms, total 49ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 374K, 68% free 2415K/7363K, paused 4ms+4ms, total 39ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 120K, 44% free 5893K/10375K, paused 5ms+8ms, total 90ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 132K, 44% free 5899K/10375K, paused 5ms+7ms, total 92ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 410K, 64% free 2674K/7363K, paused 3ms+9ms, total 49ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 115K, 44% free 5896K/10375K, paused 5ms+7ms, total 90ms<br />
I/abtfilt ( 1276): BT Event Filter Set, Mask: 0x00001000:01C0003A<br />
E/abtfilt ( 1276): [IssueHCICommand] Failed to write to [URL=hci:0]hci:0[/URL] (err:100)<br />
E/abtfilt ( 1276): Last Error: Network is down<br />
E/abtfilt ( 1276): [GetAdapterInfo] Failed to get BD_ADDR<br />
E/abtfilt ( 1276): Last Error: Network is down<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Adapter'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Adapter'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Adapter'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Adapter'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez'<br />
I/abtfilt ( 1276): [HCIFilterThread] starting up<br />
I/abtfilt ( 1276): [/org/bluez/1275/hci0] BT Adapter Added<br />
I/abtfilt ( 1276): [AcquireDefaultAudioDevice]StartRegister<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Headset'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Headset'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Headset'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.Headset'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.AudioSink'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.AudioSink'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.AudioSink'<br />
D/abtfilt ( 1276):  rule to add: type='signal',interface='org.bluez.AudioSink'<br />
I/abtfilt ( 1276): [AcquireDefaultAudioDevice]EndRegister<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/dalvikvm(  350): GC_EXPLICIT freed 112K, 44% free 5897K/10375K, paused 4ms+8ms, total 89ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 669K, 64% free 2677K/7363K, paused 3ms+8ms, total 58ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 113K, 44% free 5896K/10375K, paused 4ms+7ms, total 92ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 112K, 44% free 5897K/10375K, paused 7ms+8ms, total 97ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 688K, 64% free 2695K/7363K, paused 8ms+8ms, total 57ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 113K, 44% free 5896K/10375K, paused 5ms+6ms, total 90ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 112K, 44% free 5897K/10375K, paused 4ms+7ms, total 96ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 723K, 64% free 2697K/7363K, paused 3ms+8ms, total 50ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 113K, 44% free 5896K/10375K, paused 4ms+8ms, total 89ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 116K, 44% free 5898K/10375K, paused 5ms+8ms, total 89ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 714K, 64% free 2696K/7363K, paused 6ms+8ms, total 53ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 114K, 44% free 5897K/10375K, paused 4ms+8ms, total 91ms<br />
D/dalvikvm(  350): GC_EXPLICIT freed 112K, 44% free 5897K/10375K, paused 4ms+8ms, total 90ms<br />
D/dalvikvm(  517): GC_EXPLICIT freed 722K, 64% free 2698K/7363K, paused 3ms+8ms, total 52ms<br />
D/BluetoothAdapterStateMachine(  350): WarmUp process message: 104<br />
E/BluetoothAdapterStateMachine(  350): Bluetooth adapter SDP failed to load<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/abtfilt ( 1276):  Got DBus Message ...<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 7<br />
E/BluetoothService.cpp(  350): setBluetoothTetheringNative false<br />
E/bluetooth_common.cpp(  350): dbus_func_args_timeout_valist: D-Bus error in Unregister: org.freedesktop.DBus.Error.UnknownMethod (Method "Unregister" with signature "s" on interface "org.bluez.NetworkServer" doesn't exist<br />
E/bluetooth_common.cpp(  350): )<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 6<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 5<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 4<br />
D/BluetoothEventLoop(  350): Property Changed: UUIDs : 3<br />
I/bluedroid(  350): Stopping bluetoothd deamon<br />
D/dalvikvm(  350): GC_EXPLICIT freed 139K, 44% free 5894K/10375K, paused 5ms+10ms, total 97ms<br />
I/bluedroid(  350): Stopping hciattach deamon<br />
D/BluetoothAdapterStateMachine(  350): Bluetooth state 11 -> 10<br />
D/BluetoothAdapterStateMachine(  350): PowerOff process message: 101<br />
D/dalvikvm(  350): GC_EXPLICIT freed 141K, 44% free 5901K/10375K, paused 7ms+9ms, total 105ms<br />
D/DockEventReceiver(  607): finishStartingService: stopping service<br />
D/BluetoothMasReceiver( 1242): Bluetooth STATE CHANGED to 10
```
Samsung has done some changes in the bluetooth source, but they have just put the whole external/bluetooth folder in their opensource package so I don't know what they have changed in there. This goes way ahead of my knowledge, I asked the same on XDA forums, but haven't got a single response yet. I know there are a lot of developers here who could point me in the correct direction and maybe even know where the problem could be. I've "fought" with this problem for over a month.









Could some experienced developer help me with this? I am not expecting that someone will just solve it for me, but like I said, I need to be put on the correct path, if you know what I mean. Thanks


----------



## JBirdVegas (Jun 11, 2011)

You may be missing a package external/bluez

```
<br />
E/BluetoothEventLoop.cpp(  350): get_adapter_path: D-Bus error: org.freedesktop.DBus.Error.ServiceUnknown (The name org.bluez was not provided by any .service files)<br />
```
here is the interface docs so you can see the errors https://github.com/android/platform_external_bluez/blob/master/utils/doc/manager-api.txt

if you do have that package check the commit history of the repo and work backwards till you can get it to work.

Another thing you may want to investigate are these lines.

```
<br />
I/qcom-bluetooth( 1260): /system/etc/init.qcom.bt.sh: Transport : <br />
I/qcom-bluetooth( 1261): /system/etc/init.qcom.bt.sh: Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)<br />
I/qcom-bluetooth( 1262): /system/etc/init.qcom.bt.sh: Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3><br />
```


----------



## TheWhisp (Jun 14, 2012)

Thank you for the reply. The power class is also not set on the stock ROM, it's default as 1, it shouldn't be any issue. I was thinking of D-Bus error. Could it be because the hci device is not initialized? Though it seems that ABTFilt is able to recieve dbus messages and it also sees BT adapter.

edit: I tried enabling BT on stock ROM, there the bluetoothd starts before all the dbus stuff, but on my CM10 build it's vice versa... could this be a problem?

edit 2: Problem solved. Gingerbread is using older Bluez stack. I needed to forward-port some changes from Samsung's open source package.
Here is the commit in case someone else has the same problem: https://github.com/TheWhisp/android_device_samsung_jena/commit/29d33ed695ce6de8780567d1248088023b2e892d


----------

