rfcomm error with BT headset

392 views
Skip to first unread message

Vishveshwar

unread,
Jan 20, 2011, 7:44:16 AM1/20/11
to android-porting
Hi,

I am trying to get a generic BT headset with only HSP/HFP working with
my android froyo device running kernel 2.6.32. The FS is based off
rowboat android repository.

I am able to pair with the headset, but the headset does not get
connected and I see rfcomm error in logcat.
The rfcomm error appears only for the headset.
But, I am able to pair a mobile phone with the device and transfer
files to and fro without any problem.

I'm not able to tell where the problem could be. Any help will be
appreciated.

Thanks and Regards,
Vishveshwar

Here is the relevant snippet from logcat:
E/BluetoothEventLoop.cpp( 924): event_filter: Received signal
org.bluez.Adapter:DeviceCreated from /org/bluez/1264/hci0
D/BluetoothService( 924): 00:EF:81:63:97:0C bond state 10 -> 11 (0)
E/BluetoothEventLoop.cpp( 924): event_filter: Received signal
org.bluez.Adapter:PropertyChanged from /org/bluez/1264/hci0
V/BluetoothEventRedirector( 1252): Received
android.bluetooth.device.action.BOND_STATE_CHANGED
E/BluetoothEventLoop.cpp( 924): event_filter: Received signal
org.bluez.Device:PropertyChanged from /org/bluez/1264/hci0/
dev_00_EF_81_63_97_0C
I/BluetoothEventLoop.cpp( 924): agent_event_filter: Received method
org.bluez.Agent:RequestPinCode
I/BluetoothEventLoop.cpp( 924): agent_event_filter: Received method
org.bluez.Agent:Release
E/BluetoothEventLoop.cpp( 924): event_filter: Received signal
org.bluez.Device:PropertyChanged from /org/bluez/1264/hci0/
dev_00_EF_81_63_97_0C
D/BluetoothService( 924): 00:EF:81:63:97:0C bond state 11 -> 12 (0)
V/BluetoothEventRedirector( 1252): Received
android.bluetooth.device.action.BOND_STATE_CHANGED
D/BT HSHFP( 1025): Saved priority 00:EF:81:63:97:0C = 100
W/BackupManagerService( 924): dataChanged but no participant
pkg='com.android.providers.settings' uid=1001
E/BluetoothEventLoop.cpp( 924): event_filter: Received signal
org.bluez.Device:PropertyChanged from /org/bluez/1264/hci0/
dev_00_EF_81_63_97_0C
D/BluetoothService( 924): updateDeviceServiceChannelCache(00:EF:
81:63:97:0C)
D/BluetoothService( 924): uuid(system):
0000111e-0000-1000-8000-00805f9b34fb 3
D/BluetoothService( 924): uuid(system):
00001108-0000-1000-8000-00805f9b34fb 2
V/BluetoothEventRedirector( 1252): Received
android.bleutooth.device.action.UUID
D/CachedBluetoothDevice( 1252): []
D/CachedBluetoothDevice( 1252): Adding: CONNECT Address:00:EF:
81:63:97:0C Profile:HEADSET TimeSent:not yet
D/CachedBluetoothDevice( 1252): processCommands:[CONNECT Address:00:EF:
81:63:97:0C Profile:HEADSET TimeSent:not yet]
D/BT HSHFP( 1025): Headset state 0 -> 1, result = 1
D/BT HSHFP( 1025): Saved priority 00:EF:81:63:97:0C = 1000
W/BackupManagerService( 924): dataChanged but no participant
pkg='com.android.providers.settings' uid=1001
D/BT HSHFP( 1025): SDP UUID: TYPE_HANDSFREE
I/BT HSHFP( 1025): Created RFCOMM socket fd 36.
I/BT HSHFP( 1025): async connect is in progress (Operation now in
progress)
D/CachedBluetoothDevice( 1252): Command sent successfully:CONNECT
Address:00:EF:81:63:97:0C Profile:HEADSET TimeSent:00:03:17
V/BluetoothEventRedirector( 1252): Received
android.bluetooth.headset.action.STATE_CHANGED
D/CachedBluetoothDevice( 1252): onProfileStateChanged:[CONNECT Address:
00:EF:81:63:97:0C Profile:HEADSET TimeSent:00:03:17]
E/BT HSHFP( 1025): RFCOMM async connect() error: Unknown error: 0 (0),
nr = 1
I/BT HSHFP( 1025): Created RFCOMM socket fd 36.
E/BT HSHFP( 1025): async connect error: Device or resource busy (16)
I/BT HSHFP( 1025): Failed to re-open RFCOMM socket!
I/BT HSHFP( 1025): Trying to connect to rfcomm socket again after 1
sec
D/dalvikvm( 1252): GC_FOR_MALLOC freed 9517 objects / 608648 bytes in
45ms
I/BT HSHFP( 1025): Created RFCOMM socket fd 36.
I/BT HSHFP( 1025): async connect is in progress (Operation now in
progress)
E/BT HSHFP( 1025): RFCOMM async connect() error: Unknown error: 0 (0),
nr = 1
I/BT HSHFP( 1025): Created RFCOMM socket fd 36.
E/BT HSHFP( 1025): async connect error: Device or resource busy (16)
I/BT HSHFP( 1025): Failed to re-open RFCOMM socket!
D/BT HSHFP( 1025): RFCOMM connection attempt took 1286 ms
W/BT HSHFP( 1025): headset.waitForAsyncConnect() error: -16
D/BT HSHFP( 1025): Rfcomm error
D/BT HSHFP( 1025): Headset state 1 -> 0, result = 0
V/BluetoothEventRedirector( 1252): Received
android.bluetooth.headset.action.STATE_CHANGED
I/BluetoothEventRedirector( 1252): Failed to connect BT headset
D/CachedBluetoothDevice( 1252): onProfileStateChanged:[CONNECT Address:
00:EF:81:63:97:0C Profile:HEADSET TimeSent:00:03:17]
D/CachedBluetoothDevice( 1252): processCommands:[]
E/BluetoothEventLoop.cpp( 924): event_filter: Received signal
org.bluez.Device:PropertyChanged from /org/bluez/1264/hci0/
dev_00_EF_81_63_97_0C

Ajith Kamath

unread,
Jan 21, 2011, 12:30:11 AM1/21/11
to vishves...@aim.com, android-porting
Hi
 
Please put logs in BluetoothHandsfree.java and BluetoothHeadsetService.java as to where the connect is getting called
and once the connect returns pls specify the same
 
I'm guessing this is because of your Headset, Some headset take a little delay to connect
So if connection terminates it will probably be bacause of it.
 
Please mention what headset you are using. Also paste the logs after the changes
If you want to go further, introduce a little delay before connect and also before audioon()(Sco socket creation)
may be 1 or 1.5 secs or 2 secs for that matter and send those logs too
 
Regards,
Ajith


Vishveshwar

unread,
Jan 21, 2011, 4:35:39 AM1/21/11
to android-porting
Just a question.. Is it necessary that the android device has to have
phone functionality for HSP to work?
My device does not have phone functionality. I simply want to stream
the music to the BT headset.

- Vishveshwar

On Jan 21, 10:30 am, Ajith Kamath <sjce.aj...@gmail.com> wrote:
> Hi
>
> Please put logs in BluetoothHandsfree.java and BluetoothHeadsetService.java
> as to where the connect is getting called
> and once the connect returns pls specify the same
>
> I'm guessing this is because of your Headset, Some headset take a little
> delay to connect
> So if connection terminates it will probably be bacause of it.
>
> Please mention what headset you are using. Also paste the logs after the
> changes
> If you want to go further, introduce a little delay before connect and also
> before audioon()(Sco socket creation)
> may be 1 or 1.5 secs or 2 secs for that matter and send those logs too
>
> Regards,
> Ajith
>
> > unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsu...@googlegroups.com>
> > website:http://groups.google.com/group/android-porting

Vishveshwar

unread,
Jan 21, 2011, 5:15:06 AM1/21/11
to android-porting
Hi Ajith,

Thanks for the hints. I am testing with a no-brand headset while
waiting for some good headsets to be procured.

rfcomm connection is successfully established after I increased the
delay to 1 second.

For others' reference the file is packages/apps/Phone/src/com/android/
phone/BluetoothHeadsetService.java
Function private int waitForConnect(HeadsetBase headset)
I changed this line
//result = headset.waitForAsyncConnect(500,
mConnectedStatusHandler); // default - does not work
result = headset.waitForAsyncConnect(1000,
mConnectedStatusHandler); // increased delay to 1000ms

Thanks,
Vishveshwar

On Jan 21, 10:30 am, Ajith Kamath <sjce.aj...@gmail.com> wrote:
> Hi
>
> Please put logs in BluetoothHandsfree.java and BluetoothHeadsetService.java
> as to where the connect is getting called
> and once the connect returns pls specify the same
>
> I'm guessing this is because of your Headset, Some headset take a little
> delay to connect
> So if connection terminates it will probably be bacause of it.
>
> Please mention what headset you are using. Also paste the logs after the
> changes
> If you want to go further, introduce a little delay before connect and also
> before audioon()(Sco socket creation)
> may be 1 or 1.5 secs or 2 secs for that matter and send those logs too
>
> Regards,
> Ajith
>
> > unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsu...@googlegroups.com>
> > website:http://groups.google.com/group/android-porting

Ajith Kamath

unread,
Jan 21, 2011, 6:17:26 AM1/21/11
to vishves...@aim.com, android-porting
Hi
 
Good to know its working
btw HSP/HF is required on your device to support streaming of music
 
Regards,
Ajith

Ash

unread,
Jan 21, 2011, 1:57:49 PM1/21/11
to android-porting
I would suggest to use A2DP for streaming music. HSP/HFP are for call
handling.

If it is not a phone then you might have to strip out some of the code
to get it working.



On Jan 21, 4:17 pm, Ajith Kamath <sjce.aj...@gmail.com> wrote:
> Hi
>
> Good to know its working
> btw HSP/HF is required on your device to support streaming of music
>
> Regards,
> Ajith
>
> > > > unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsubscribe@ googlegroups.com>
> > <android-porting%2Bunsu...@googlegroups.com<android-porting%252Bunsubsc ri...@googlegroups.com>
>
> > > > website:http://groups.google.com/group/android-porting
>
> > --
> >  unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsubscribe@ googlegroups.com>
> > website:http://groups.google.com/group/android-porting

Vishveshwar

unread,
Jan 24, 2011, 12:01:13 AM1/24/11
to android-porting
My intention is that all audio should system sounds, music etc, go
into the BT headset (HSP or A2DP depending on headset capabilities) if
the headset is active and connected. If not by default, then perhaps
by some menu option. Similar to what appears for the BT headset
options screen ( connected to Phone audio)

Does this require big changes?
Reply all
Reply to author
Forward
0 new messages