Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 6/6] hfp_hf_bluez5: Handle org.bluez.Profile1.Release()
Date: Wed, 21 Aug 2013 10:21:55 -0500	[thread overview]
Message-ID: <5214DB13.3070507@gmail.com> (raw)
In-Reply-To: <CABBYNZJVqmvtEBf5094t1GPizups6Kdd=nA2Zh3rzHamC9ztqg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2746 bytes --]

Hi Luiz,

On 08/21/2013 05:29 AM, Luiz Augusto von Dentz wrote:
> Hi Denis,
>
> On Tue, Aug 20, 2013 at 6:41 PM, Denis Kenzior <denkenz@gmail.com> wrote:
>> Hi Luiz,
>>
>>
>>>> I agree. Going to fix, and send a patch to BlueZ to add that label.
>>>
>>>
>>> While at it you might consider actually handling the Release because
>>> right now oFono doesn't react to either org.bluez disappearing nor
>>> adapter proxy being removed so if one of those events happen without
>>> calling RequestDisconnection oFono will keep the connection.
>>>
>>
>> As long as BlueZ calls shutdown() on the socket, the resources will be
>> cleaned up by the oFono HUP handler.
>
> That works as long bluetoothd doesn't crash so it is probably a good
> idea to at least check if the org.bluez has disappeared and cleanup if
> any connection still exists. I also don't understand how the
> enumeration is supposed to work in hfp_hf_bluez5, it doesn't seems to
> be able to detect devices being removed as there is no proxy_removed
> callback, Im missing something?

Correct me if I'm wrong, but BlueZ disappearing should be handled by 
freeing all the proxies associated with it when it goes away.  e.g. 
inside gdbus/client.c message_filter().

oFono does not use proxy_removed, instead we use 
g_dbus_proxy_set_removed_watch.  This lets us avoid an unnecessary hash 
lookup.

>
>>
>>> Before anyone asks, there is another difference between Release and
>>> RequestDisconnection, the former should cause a forceful disconnect if
>>> connected while the latter should disconnect gracefully so bluetoothd
>>> will wait for the response so in theory Release can happen without
>>> RequestDisconnection being called before.
>>>
>>
>> The only time BlueZ calls Release() today is when gracefully shutting down.
>> It calls shutdown() then anyway.
>>
>> It might be argued that we should shut down the SCO server socket if BlueZ
>> has called Release() on our profile.  Looking at the code, it looks like we
>> only accept SCO connections when a given handsfree_audio_card matches a
>> connection request.  So assuming the kernel has SCO defer setup handling, we
>> should be okay with the current behavior.  Comments?
>
> That can create a situation where nobody else can listen on SCO even
> before oFono register HFP, while this is mostly fine as platforms
> should probably have a single solution for HFP it would probably be
> safer to start listening to SCO only when registered so we give a nice
> example how to implement external profiles properly.
>
>

The HFP plugin registers the profile with BlueZ on startup.  So who 
would try to open a SCO socket in that small time window?

Regards,
-Denis

  reply	other threads:[~2013-08-21 15:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16  2:26 [PATCH 0/6] hfp_hf_bluez5: Add support for Transparent SCO Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 1/6] bluetooth: Add define for SCO voice settings Vinicius Costa Gomes
2013-08-19 17:59   ` Denis Kenzior
2013-08-16  2:26 ` [PATCH 2/6] handsfree-audio: Add setting SCO air mode Vinicius Costa Gomes
2013-08-19 17:49   ` Denis Kenzior
2013-08-19 18:42     ` Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 3/6] handsfree-audio: Add support for detecting Transparent SCO support Vinicius Costa Gomes
2013-08-19 17:55   ` Denis Kenzior
2013-08-19 19:36     ` Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 4/6] handsfree-audio: Set the voice setting for outgoing connections Vinicius Costa Gomes
2013-08-19 17:56   ` Denis Kenzior
2013-08-16  2:26 ` [PATCH 5/6] hfp_hf_bluez5: Handle org.bluez.Profile1.Cancel() Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 6/6] hfp_hf_bluez5: Handle org.bluez.Profile1.Release() Vinicius Costa Gomes
2013-08-19 17:57   ` Denis Kenzior
2013-08-19 18:47     ` Vinicius Costa Gomes
2013-08-20 13:51       ` Luiz Augusto von Dentz
2013-08-20 15:41         ` Denis Kenzior
2013-08-21 10:29           ` Luiz Augusto von Dentz
2013-08-21 15:21             ` Denis Kenzior [this message]
2013-08-22 14:41               ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5214DB13.3070507@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox