2011-05-23 21:45:53

by Mike Brudevold

[permalink] [raw]
Subject: audio/manager.c:hf_io_cb() Refusing new connection since one already exists

I am having a problem where I can not connect my phone using HFP after
it has been once disconnected from bluetoothd.

Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011
i686 i686 i386 GNU/Linux
Bluez 4.93

Here is the initial connection:

bluetoothd[12077]: plugins/hciops.c:conn_complete() status 0x00
bluetoothd[12077]: src/adapter.c:adapter_get_device() 00:17:E3:3B:4F:DD
bluetoothd[12077]: plugins/hciops.c:remote_features_information() hci0 status 0
bluetoothd[12077]: plugins/hciops.c:remote_name_information() hci0 status 0
bluetoothd[12077]: plugins/hciops.c:link_key_request() hci0 dba
00:17:E3:3B:4F:DD
bluetoothd[12077]: plugins/hciops.c:get_auth_info() hci0 dba 00:17:E3:3B:4F:DD
bluetoothd[12077]: plugins/hciops.c:link_key_request() kernel auth
requirements = 0x04
bluetoothd[12077]: plugins/hciops.c:link_key_request() Matching key found
bluetoothd[12077]: plugins/hciops.c:link_key_request() link key type 0x00
bluetoothd[12077]: plugins/hciops.c:auth_complete() hci0 status 0
bluetoothd[12077]: plugins/hciops.c:bonding_complete() status 0x00
bluetoothd[12077]: src/event.c:btd_event_bonding_complete() status 0x00
bluetoothd[12077]: src/adapter.c:adapter_get_device() 00:17:E3:3B:4F:DD
bluetoothd[12077]: src/device.c:device_bonding_complete() bonding
(nil) status 0x00
bluetoothd[12077]: audio/manager.c:gateway_auth_cb() Accepted AG
connection from 00:17:E3:3B:4F:DD for
/org/bluez/12077/hci0/dev_00_17_E3_3B_4F_DD
bluetoothd[12077]: audio/gateway.c:newconnection_reply() Agent reply:
file descriptor passed successfully

Which then I click disconnect on my phone, yielding:

bluetoothd[12077]: plugins/hciops.c:disconn_complete() handle 42 status 0x00
bluetoothd[12077]: src/event.c:btd_event_disconn_complete()
bluetoothd[12077]: src/adapter.c:adapter_remove_connection()

After that, I press connect again on my phone, which gives the following:

bluetoothd[12077]: plugins/hciops.c:conn_complete() status 0x00
bluetoothd[12077]: src/adapter.c:adapter_get_device() 00:17:E3:3B:4F:DD
bluetoothd[12077]: plugins/hciops.c:remote_features_information() hci0 status 0
bluetoothd[12077]: plugins/hciops.c:remote_name_information() hci0 status 0
bluetoothd[12077]: plugins/hciops.c:link_key_request() hci0 dba
00:17:E3:3B:4F:DD
bluetoothd[12077]: plugins/hciops.c:get_auth_info() hci0 dba 00:17:E3:3B:4F:DD
bluetoothd[12077]: plugins/hciops.c:link_key_request() kernel auth
requirements = 0x04
bluetoothd[12077]: plugins/hciops.c:link_key_request() Matching key found
bluetoothd[12077]: plugins/hciops.c:link_key_request() link key type 0x00
bluetoothd[12077]: plugins/hciops.c:auth_complete() hci0 status 0
bluetoothd[12077]: plugins/hciops.c:bonding_complete() status 0x00
bluetoothd[12077]: src/event.c:btd_event_bonding_complete() status 0x00
bluetoothd[12077]: src/adapter.c:adapter_get_device() 00:17:E3:3B:4F:DD
bluetoothd[12077]: src/device.c:device_bonding_complete() bonding
(nil) status 0x00
bluetoothd[12077]: audio/manager.c:hf_io_cb() Refusing new connection
since one already exists
bluetoothd[12077]: plugins/hciops.c:disconn_complete() handle 43 status 0x00
bluetoothd[12077]: src/event.c:btd_event_disconn_complete()
bluetoothd[12077]: src/adapter.c:adapter_remove_connection()


It seems like there is a missing link between the disconnect event and
setting the gateway to the proper state?

Thanks,

Mike


2011-06-23 17:33:02

by Mike Brudevold

[permalink] [raw]
Subject: Re: audio/manager.c:hf_io_cb() Refusing new connection since one already exists

On Thu, Jun 23, 2011 at 11:36 AM, Mike <[email protected]> wrote:
> On Wed, Jun 22, 2011 at 2:17 PM, Mike <[email protected]> wrote:
>> On Mon, May 23, 2011 at 4:45 PM, Mike <[email protected]> wrote:
>>> I am having a problem where I can not connect my phone using HFP after
>>> it has been once disconnected from bluetoothd.
>>>
>>
>> I'm still having this problem (just tested on bluez 4.94). ?I can
>> disconnect my phone and execute the GetProperties method on
>> org.bluez.HandsfreeGateway and the return State is connected. ?If I
>> execute the Disconnect method over DBus (org.bluez.HandsfreeGateway),
>> the state of the connection is set properly to disconnected. ?After
>> doing this, I can reconnect my phone without error (of course it will
>> fail again if I disconnect/reconnect).
>>
>> The one thing that has me curious is the lack of a call to
>> "g_io_add_watch" for the hands free rfcomm. ?It looks like most other
>> io connections use this to detect the channel closing (e.g. the sco
>> channel or the ag_confirm code). ?Is this an oversight?
>>
>> Mike
>>
>
> OK, I get the feeling that the Bluez code is correct, but that the
> agent (in this case ofono) is supposed to call the Disconnect method.
> Can anyone confirm that this is the intention? ?If so, I will take my
> problems to the ofono mailing list :)
>

OK, a little surprised that all I hear are crickets. In any case, I
hacked together a fix for ofono that calls the Disconnect method when
ofono determines that the connection is disconnected. But I'm not
entirely sure that that is the right solution. The documentation of
org.bluez.HandsfreeAgent does not call out such a requirement, so it
leaves me to believe that bluez should already handle this on its own.
Mainly bluez just needs to call "change_state(device,
GATEWAY_STATE_DISCONNECTED);" somehow so that connections will be
accepted again. I appear to have working code, so it doesn't matter
to me if this discussion hits a dead-end, but I'm not about to submit
a patch unless it's confirmed which app is at fault (bluez or ofono).

Mike

2011-06-23 16:36:36

by Mike Brudevold

[permalink] [raw]
Subject: Re: audio/manager.c:hf_io_cb() Refusing new connection since one already exists

On Wed, Jun 22, 2011 at 2:17 PM, Mike <[email protected]> wrote:
> On Mon, May 23, 2011 at 4:45 PM, Mike <[email protected]> wrote:
>> I am having a problem where I can not connect my phone using HFP after
>> it has been once disconnected from bluetoothd.
>>
>
> I'm still having this problem (just tested on bluez 4.94). ?I can
> disconnect my phone and execute the GetProperties method on
> org.bluez.HandsfreeGateway and the return State is connected. ?If I
> execute the Disconnect method over DBus (org.bluez.HandsfreeGateway),
> the state of the connection is set properly to disconnected. ?After
> doing this, I can reconnect my phone without error (of course it will
> fail again if I disconnect/reconnect).
>
> The one thing that has me curious is the lack of a call to
> "g_io_add_watch" for the hands free rfcomm. ?It looks like most other
> io connections use this to detect the channel closing (e.g. the sco
> channel or the ag_confirm code). ?Is this an oversight?
>
> Mike
>

OK, I get the feeling that the Bluez code is correct, but that the
agent (in this case ofono) is supposed to call the Disconnect method.
Can anyone confirm that this is the intention? If so, I will take my
problems to the ofono mailing list :)

2011-06-22 19:17:15

by Mike Brudevold

[permalink] [raw]
Subject: Re: audio/manager.c:hf_io_cb() Refusing new connection since one already exists

On Mon, May 23, 2011 at 4:45 PM, Mike <[email protected]> wrote:
> I am having a problem where I can not connect my phone using HFP after
> it has been once disconnected from bluetoothd.
>

I'm still having this problem (just tested on bluez 4.94). I can
disconnect my phone and execute the GetProperties method on
org.bluez.HandsfreeGateway and the return State is connected. If I
execute the Disconnect method over DBus (org.bluez.HandsfreeGateway),
the state of the connection is set properly to disconnected. After
doing this, I can reconnect my phone without error (of course it will
fail again if I disconnect/reconnect).

The one thing that has me curious is the lack of a call to
"g_io_add_watch" for the hands free rfcomm. It looks like most other
io connections use this to detect the channel closing (e.g. the sco
channel or the ag_confirm code). Is this an oversight?

Mike