[android-developers] Re: Bluetooth RFCOMM connection dying immediately after .connect()

2010-04-20 Thread ssozonoff
So here is the status regarding a similar issue I am having with the
bluetooth connection.

Works on HTC Legened and Google Nexus 1
Fails on the HTC Desire

what sucks is that normally the HTC Desire and N1 are supposedly based
on the same hardware.

I checked the firmware version between the two and they are the same
however the kernel version seems to be different.

HTC Desire is kernel 2.6.29-97 (Built by HTC I presume)
Nexus 1 is 2.6.29-01117

Serge

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Bluetooth RFCOMM connection dying immediately after .connect()

2010-04-19 Thread Max Gilead
Any Bluetooth fellow devs willing to try and give some hints maybe? :)

The updated version of this issue is at:
http://stackoverflow.com/questions/2660968/how-to-prevent-android-bluetooth-rfcomm-connection-from-dying-immediately-after

Cheers,
Max


On 18 April 2010 02:36, Max Gilead  wrote:

> Hi!
>
> I'm trying to connect to Zeemote (http://zeemote.com/) gaming controller
> from Moto Droid running 2.0.1 firmware. The test application below does
> connect to the device (LED flashes) but connection is dropped immediately. I
> can connect to the device perfectly fine using bluez tools (log attached as
> well).
>
> I'm quite at a loss here, I work on it for so long that I ran out of ideas
> so any help would be very much appreciated.
>
> Btw, looks like this issue is somewhat similar to
> http://groups.google.com/group/android-developers/browse_thread/thread/a7ff7771ae3be1c/6f8bb2bc0300806c?hl=en&lnk=gst&q=bluetooth+connecting#6f8bb2bc0300806c
>
> Thanks,
> Max
>
> === Code:
>
> package zee.test;
>
> import java.io.IOException;
> import java.io.InputStream;
> import java.util.UUID;
>
> import android.app.Activity;
> import android.bluetooth.BluetoothAdapter;
> import android.bluetooth.BluetoothDevice;
> import android.bluetooth.BluetoothSocket;
> import android.os.Bundle;
> import android.util.Log;
>
> public class ZeeTest extends Activity {
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> try {
> test();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>
> public void test() throws IOException {
> BluetoothDevice zee =
> BluetoothAdapter.getDefaultAdapter().getRemoteDevice("00:1C:4D:02:A6:55");
> Log.d("ZeeTest", " Creating socket");
> BluetoothSocket sock =
> zee.createRfcommSocketToServiceRecord(UUID.fromString("8e1f0cf7-508f-4875-b62c-fbb67fd34812"));
> Log.d("", " Connecting");
> sock.connect();
> Log.d("", " Connected");
>
>
> final InputStream in = sock.getInputStream();
> new Thread() {
> @Override
> public void run() {
> byte[] buffer = new byte[32];
> int bytes = 0;
> int x = 0;
> Log.d("", " Listening...");
> while (x < 200) {
> x++;
> try {
> bytes = in.read(buffer);
> Log.d("ZeeTest", " Read "+ bytes +" bytes");
> } catch (IOException e) {
> if (x % 50 == 0) {
> Log.d("", "Tried "+ x +" times ("+ bytes +")");
> }
> try { Thread.sleep(100); } catch
> (InterruptedException ie) {}
> }
> }
> Log.d("ZeeTest", " Done: thread exit");
> }
> }.start();
> Log.d("ZeeTest", " Done: test()");
> }
> }
>
>
> === Log:
>
> I/ActivityManager( 1169): Start proc zee.test for activity
> zee.test/.ZeeTest: pid=4294 uid=10084 gids={3002, 3001, 3003}
> I/dalvikvm( 4294): Debugger thread not active, ignoring DDM send
> (t=0x41504e4d l=38)
> D/dalvikvm( 4287): LinearAlloc 0x0 used 640700 of 5242880 (12%)
> I/dalvikvm( 4294): Debugger thread not active, ignoring DDM send
> (t=0x41504e4d l=20)
> D/ZeeTest ( 4294):  Creating socket
> D/( 4294):  Connecting
> E/BluetoothEventLoop.cpp( 1169): event_filter: Received signal
> org.bluez.Device:PropertyChanged from
> /org/bluez/1240/hci0/dev_00_1C_4D_02_A6_55
> I/usbd( 1068): process_usb_uevent_message(): buffer = add@
> /devices/virtual/bluetooth/hci0/hci0:1
> I/usbd( 1068): main(): call select(...)
> E/BluetoothEventLoop.cpp( 1169): event_filter: Received signal
> org.bluez.Adapter:DeviceFound from /org/bluez/1240/hci0
> V/BluetoothEventRedirector( 1242): Received
> android.bluetooth.device.action.FOUND
> V/BluetoothEventRedirector( 1242): Received
> android.bleutooth.device.action.UUID
> D/( 4294):  Connected
> D/ZeeTest ( 4294):  Done: test()
> D/( 4294):  Listening...
> I/ActivityManager( 1169): Displayed activity zee.test/.ZeeTest: 2296 ms
> (total 2296 ms)
> E/BluetoothEventLoop.cpp( 1169): event_filter: Received signal
> org.bluez.Device:PropertyChanged from
> /org/bluez/1240/hci0/dev_00_1C_4D_02_A6_55
> I/usbd( 1068): process_usb_uevent_message(): buffer = remove@
> /devices/virtual/bluetooth/hci0/hci0:1
> I/usbd( 1068): main(): call select(...)
> V/BluetoothEventRedirector( 1242): Received
> android.bleutooth.device.action.UUID
> D/( 4294): Tried 50 times (0)
> D/( 4294): Tried 100 times (0)
> D/( 4294): Tried 150 times (0)
> D/( 4294): Tried 200