All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Ferreri Tonello <eu@felipetonello.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 2/5] core/device: Call profile disconnect if ATT disconnects
Date: Thu, 8 Sep 2016 16:33:24 +0100	[thread overview]
Message-ID: <a78fe881-49e0-790e-cbc5-513b0c005f39@felipetonello.com> (raw)
In-Reply-To: <1473338340-7587-2-git-send-email-luiz.dentz@gmail.com>

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

Hi Luiz,

On 08/09/16 13:38, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> If the profile accepts connections it should also be notified when ATT
> disconnects so it can cleanup properly.
> ---
>  src/device.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/device.c b/src/device.c
> index 9586022..eda873f 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -4563,6 +4563,18 @@ static void attio_disconnected(gpointer data, gpointer user_data)
>  		attio->dcfunc(attio->user_data);
>  }
>  
> +static void disconnect_gatt_service(gpointer data, gpointer user_data)
> +{
> +	struct btd_service *service = data;
> +	struct btd_profile *profile = btd_service_get_profile(service);
> +
> +	/* Ignore if profile cannot accept connections */
> +	if (!profile->accept)
> +		return;

What if the profile has connect and not accept?

> +
> +	btd_service_disconnect(service);
> +}
> +
>  static void att_disconnected_cb(int err, void *user_data)
>  {
>  	struct btd_device *device = user_data;
> @@ -4575,6 +4587,7 @@ static void att_disconnected_cb(int err, void *user_data)
>  	DBG("%s (%d)", strerror(err), err);
>  
>  	g_slist_foreach(device->attios, attio_disconnected, NULL);
> +	g_slist_foreach(device->services, disconnect_gatt_service, NULL);
>  
>  	btd_gatt_client_disconnected(device->client_dbus);
>  
> 

-- 
Felipe

[-- Attachment #2: 0x92698E6A.asc --]
[-- Type: application/pgp-keys, Size: 7177 bytes --]

  reply	other threads:[~2016-09-08 15:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 12:38 [PATCH BlueZ 1/5] core/service: Fix setting wrong state after calling accept Luiz Augusto von Dentz
2016-09-08 12:38 ` [PATCH BlueZ 2/5] core/device: Call profile disconnect if ATT disconnects Luiz Augusto von Dentz
2016-09-08 15:33   ` Felipe Ferreri Tonello [this message]
2016-09-09 12:58     ` Luiz Augusto von Dentz
2016-09-08 12:38 ` [PATCH BlueZ 3/5] scanparam: Fix not handling accept properly Luiz Augusto von Dentz
2016-09-08 12:38 ` [PATCH BlueZ 4/5] scanparam: Make use of service user_data to store service context Luiz Augusto von Dentz
2016-09-08 12:39 ` [PATCH BlueZ 5/5] scanparam: Implement disconnect callback Luiz Augusto von Dentz
2016-09-08 14:45 ` [PATCH BlueZ 1/5] core/service: Fix setting wrong state after calling accept Felipe Ferreri Tonello
2016-09-08 15:26   ` Luiz Augusto von Dentz
2016-09-08 15:37     ` Felipe Ferreri Tonello
2016-09-09 12:35       ` Luiz Augusto von Dentz
2016-09-09 14:34         ` 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=a78fe881-49e0-790e-cbc5-513b0c005f39@felipetonello.com \
    --to=eu@felipetonello.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.