Hello,

I have been doing some Bluetooth SPP development with an HTC Legend
which was working just fine.
Today I received my HTC Desire and I cant get an SPP connection to
work.

The first thing I had to do is remove the mAdapter.cancelDiscovery()
call in the connectThread().
It seems there is some sort of timing issue here and with the faster
processor its not working like this.

Below is an extract from the logs when mAdapter.cancelDiscovery() was
being called just prior to mmSocket.connect();

04-19 16:30:58.984: DEBUG/BluetoothSppService(759): Running
mConnectThread
04-19 16:30:58.984: ERROR/BluetoothEventLoop.cpp(92): pollData[0] is
revented, check next one
04-19 16:30:58.984: ERROR/BluetoothService.cpp(92):
stopDiscoveryNative: D-Bus error in StopDiscovery:
org.bluez.Error.Failed (Invalid discovery session)
04-19 16:30:59.024: DEBUG/DEVICE(293): BLTA -
*************DiscoverServices********


I get a little farther after this change and it almost seems as if the
connection is up because the BT Icon on my laptop changes to green but
then the connection fails anyway.
Here is an extract of the stack after the call to mmSocket.connect();

04-19 16:33:40.314: DEBUG/DEVICE(293): BLTA -
*************DiscoverServices********
04-19 16:33:40.314: INFO/DTUN_HCID_BZ4(293):
dtun_client_get_remote_svc_channel: starting discovery on
(uuid16=0x0011)
04-19 16:33:40.314: INFO/DTUN_HCID_BZ4(293): bdaddr=00:23:4D:F3:3B:BE
04-19 16:33:40.314: INFO/DTUN_CLNT(293): Client calling
DTUN_METHOD_DM_GET_REMOTE_SERVICE_CHANNEL (id 4)
04-19 16:33:40.314: INFO/(260): DTUN_ReceiveCtrlMsg: [DTUN] Received
message [BTLIF_DTUN_METHOD_CALL] 4354
04-19 16:33:40.314: INFO/(260): handle_method_call:
handle_method_call :: received
DTUN_METHOD_DM_GET_REMOTE_SERVICE_CHANNEL (id 4), len 134
04-19 16:33:40.314: ERROR/BTLD(260): ****************search UUID =
1101***********
04-19 16:33:40.314: INFO//system/bin/btld(256):
btapp_dm_GetRemoteServiceChannel()
04-19 16:33:40.314: INFO//system/bin/btld(256): ##### USerial_Ioctl:
BT_Wake, 0x8003 ####
04-19 16:33:40.914: INFO//system/bin/btld(256): ##### USerial_Ioctl:
BT_Sleep, 0x8004 ####
04-19 16:33:41.394: WARN/BTLD(260): ccb timer ticks: 0
04-19 16:33:41.394: INFO//system/bin/btld(256): ##### USerial_Ioctl:
BT_Wake, 0x8003 ####
04-19 16:33:41.464: WARN/BTLD(260): info:x10
04-19 16:33:41.464: INFO/BTL-IFS(260): send_ctrl_msg: [BTL_IFS CTRL]
send BTLIF_DTUN_SIGNAL_EVT (CTRL) 10 pbytes (hdl 14)
04-19 16:33:41.464: DEBUG/DTUN_HCID_BZ4(293): dtun_dm_sig_link_up()
04-19 16:33:41.464: INFO/DTUN_HCID_BZ4(293): dtun_dm_sig_link_up:
dummy_handle = 260
04-19 16:33:41.464: DEBUG/ADAPTER(293):
adapter_get_device(00:23:4D:F3:3B:BE)
04-19 16:33:41.464: ERROR/BluetoothEventLoop.cpp(92): pollData[0] is
revented, check next one
04-19 16:33:41.464: ERROR/BluetoothEventLoop.cpp(92): event_filter:
Received signal org.bluez.Device:PropertyChanged from /org/bluez/293/
hci0/dev_00_23_4D_F3_3B_BE
04-19 16:33:41.584: WARN/BTLD(260): process_service_search_attr_rsp
04-19 16:33:41.624: INFO/BTL-IFS(260): send_ctrl_msg: [BTL_IFS CTRL]
send BTLIF_DTUN_SIGNAL_EVT (CTRL) 13 pbytes (hdl 14)
04-19 16:33:41.624: INFO/DTUN_HCID_BZ4(293):
dtun_dm_sig_rmt_service_channel: success=0, service=00000000
04-19 16:33:41.624: ERROR/DTUN_HCID_BZ4(293): discovery unsuccessful!
04-19 16:33:42.126: INFO//system/bin/btld(256): ##### USerial_Ioctl:
BT_Sleep, 0x8004 ####
04-19 16:33:42.724: INFO//system/bin/btld(256): ##### USerial_Ioctl:
BT_Wake, 0x8003 ####
04-19 16:33:42.824: INFO/BTL-IFS(260): send_ctrl_msg: [BTL_IFS CTRL]
send BTLIF_DTUN_SIGNAL_EVT (CTRL) 11 pbytes (hdl 14)
04-19 16:33:42.824: DEBUG/DTUN_HCID_BZ4(293): dtun_dm_sig_link_down()
04-19 16:33:42.824: INFO/DTUN_HCID_BZ4(293): dtun_dm_sig_link_down
device = 0xf4f8 handle = 260 reason = 22
04-19 16:33:42.824: ERROR/BluetoothEventLoop.cpp(92): pollData[0] is
revented, check next one
04-19 16:33:42.824: ERROR/BluetoothEventLoop.cpp(92): event_filter:
Received signal org.bluez.Device:PropertyChanged from /org/bluez/293/
hci0/dev_00_23_4D_F3_3B_BE
04-19 16:33:42.824: DEBUG/BluetoothA2dpService(92): Received intent
Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED (has
extras) }
04-19 16:33:43.334: INFO//system/bin/btld(256): ##### USerial_Ioctl:
BT_Sleep, 0x8004 ####
04-19 16:33:46.334: DEBUG/CachedBluetoothDevice(168): updating
profiles for APOLLO-4
04-19 16:33:46.344: ERROR/CachedBluetoothDevice(168): onUuidChanged:
Time since last connect866040
04-19 16:33:46.344: DEBUG/BluetoothService(92): Cleaning up failed
UUID channel lookup: 00:23:4D:F3:3B:BE
00001101-0000-1000-8000-00805f9b34fb
04-19 16:33:46.354: ERROR/BluetoothSppService(805): BT Connection
exception
        java.io.IOException: Service discovery failed
        at android.bluetooth.BluetoothSocket
$SdpHelper.doSdp(BluetoothSocket.java:377)
        at
android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:201)
        at com.sozonoff.android.bluetooth.BluetoothSppService
$ConnectThread.run(BluetoothSppService.java:272)

So basically it fails with a java.io.IOException: Service discovery
failed.... I have no idea why.
Anyone have any ideas?

Thanks,
Serge

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to