Thursday, June 9, 2011

[android-developers] Bluetooth: Can't connect to socket on a linux box

Hello.

I'm running the Bluetooth Chat example trying to trick it into
connecting to a linux box where I have a service registered with the
UUID of the chat service, but although it finds the service, it never
connects and throws an error:

D/BluetoothChat( 4078): onActivityResult -1
D/BluetoothChatService( 4078): connect to: 00:1F:5B:DF:5F:17
D/BluetoothChatService( 4078): setState() 1 -> 2
E/BluetoothChat( 4078): + ON RESUME +
I/BluetoothChat( 4078): MESSAGE_STATE_CHANGE: 2
I/BluetoothChatService( 4078): BEGIN mConnectThread
SocketType:Insecure
E/BluetoothService.cpp( 109): stopDiscoveryNative: D-Bus error in
StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothService.cpp( 109): stopDiscoveryNative: D-Bus error in
StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
E/BluetoothEventLoop.cpp( 109): event_filter: Received signal
org.bluez.Device:PropertyChanged from /org/bluez/280/hci0/
dev_00_1F_5B_DF_5F_17
D/BluetoothService( 109): updateDeviceServiceChannelCache(00:1F:5B:DF:
5F:17)
D/BluetoothService( 109): uuid(application): 8ce255c0-200a-11e0-
ac64-0800200c9a66 210
D/BluetoothService( 109): Making callback for 8ce255c0-200a-11e0-
ac64-0800200c9a66 with result 210
E/BluetoothChatService( 4078): unable to connect()
E/BluetoothChatService( 4078): java.io.IOException: Invalid argument
E/BluetoothChatService( 4078): at
android.bluetooth.BluetoothSocket.connectNative(Native Method)
E/BluetoothChatService( 4078): at
android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:204)
E/BluetoothChatService( 4078): at
com.example.android.BluetoothChat.BluetoothChatService
$ConnectThread.run(BluetoothChatService.java:387)
D/BluetoothChatService( 4078): start
D/BluetoothChatService( 4078): setState() 2 -> 1

So from the log we can see that the service is found, but for some
reason the connect() fails with errno=EINVAL. I haven't rooted this
Nexus S so I cannot know more about what the native code is doing, but
has anyone encountered this? Connecting to another Android phone
works, of course.

Thanks,
André

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

No comments:

Post a Comment