Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/5] android/gatt: Fix MTU exchange
Date: Mon, 09 Feb 2015 15:12:05 +0100	[thread overview]
Message-ID: <2809607.HhBXeZlvjU@leonov> (raw)
In-Reply-To: <1423322298-6502-1-git-send-email-szymon.janc@tieto.com>

On Saturday 07 of February 2015 16:18:14 Szymon Janc wrote:
> This fix using invalid MTU on LE link. Previous attempt to fix this
> "android/gatt: Fix initial setting of MTU" was not correct since
> on LE default MTU is always 23 and we are not allowed to send bigger
> requests before MTU exchange was performed.
> 
> This was affecting multiple PTS GATT test cases.
> ---
>  android/gatt.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index 5f3050f..f754f30 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -1490,7 +1490,7 @@ static void connect_cb(GIOChannel *io, GError *gerr,
> gpointer user_data) uint32_t status;
>  	GError *err = NULL;
>  	GAttrib *attrib;
> -	uint16_t mtu;
> +	uint16_t mtu, cid;
> 
>  	if (dev->state != DEVICE_CONNECT_READY) {
>  		error("gatt: Device not in a connecting state!?");
> @@ -1510,14 +1510,21 @@ static void connect_cb(GIOChannel *io, GError *gerr,
> gpointer user_data) goto reply;
>  	}
> 
> -	if (!bt_io_get(io, &err, BT_IO_OPT_IMTU, &mtu, BT_IO_OPT_INVALID)) {
> -		error("gatt: Could not get imtu: %s", err->message);
> +	if (!bt_io_get(io, &err, BT_IO_OPT_IMTU, &mtu, BT_IO_OPT_CID, &cid,
> +							BT_IO_OPT_INVALID)) {
> +		error("gatt: Could not get imtu or cid: %s", err->message);
>  		device_set_state(dev, DEVICE_DISCONNECTED);
>  		status = GATT_FAILURE;
>  		g_error_free(err);
>  		goto reply;
>  	}
> 
> +	DBG("mtu %u cid %u", mtu, cid);
> +
> +	/* on LE we always start with default MTU */
> +	if (cid == ATT_CID)
> +		mtu = ATT_DEFAULT_LE_MTU;
> +
>  	attrib = g_attrib_new(io, mtu);
>  	if (!attrib) {
>  		error("gatt: unable to create new GAttrib instance");

Applied.

-- 
BR
Szymon Janc

      parent reply	other threads:[~2015-02-09 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-07 15:18 [PATCH 1/5] android/gatt: Fix MTU exchange Szymon Janc
2015-02-07 15:18 ` [PATCH 2/5] android/gatt: Exchange MTU only on LE link Szymon Janc
2015-02-07 15:18 ` [PATCH 3/5] android/gatt: Disconnect ATT if MTU is too small on BR/EDR Szymon Janc
2015-02-07 15:18 ` [PATCH 4/5] android/gatt: Add helper for getting local MTU Szymon Janc
2015-02-07 15:18 ` [PATCH 5/5] android/gatt: Add helper for updating MTU Szymon Janc
2015-02-09 14:12 ` Szymon Janc [this message]

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=2809607.HhBXeZlvjU@leonov \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.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