From: Szymon Janc <szymon.janc@tieto.com>
To: Marcin Kraglak <marcin.kraglak@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/gatt: Fix not sending confirmation for INDICATION
Date: Thu, 22 May 2014 13:15:06 +0200 [thread overview]
Message-ID: <5289260.qhIs60D7SF@uw000953> (raw)
In-Reply-To: <1400669436-2252-1-git-send-email-marcin.kraglak@tieto.com>
Hi Marcin,
On Wednesday 21 of May 2014 12:50:36 Marcin Kraglak wrote:
> Send confirmation for ATT_OP_HANDLE_IND (opcode 0x1D). It is needed
> for flow control.
> ---
> android/gatt.c | 26 ++++++++++----------------
> 1 file changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index 89da60d..59fdc07 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -3007,20 +3007,6 @@ static void handle_notification(const uint8_t *pdu, uint16_t len,
> ev->len = len - data_offset;
> memcpy(ev->value, pdu + data_offset, len - data_offset);
>
> - if (!ev->is_notify) {
> - uint8_t *res;
> - uint16_t len;
> - size_t plen;
> -
> - res = g_attrib_get_buffer(
> - notification->conn->device->attrib,
> - &plen);
> - len = enc_confirmation(res, plen);
> - if (len > 0)
> - g_attrib_send(notification->conn->device->attrib,
> - 0, res, len, NULL, NULL, NULL);
> - }
> -
> ipc_send_notif(hal_ipc, HAL_SERVICE_ID_GATT, HAL_EV_GATT_CLIENT_NOTIFY,
> sizeof(*ev) + ev->len, ev);
> }
> @@ -4760,8 +4746,16 @@ static void att_handler(const uint8_t *ipdu, uint16_t len, gpointer user_data)
> case ATT_OP_FIND_BY_TYPE_REQ:
> status = find_by_type_request(ipdu, len, dev);
> break;
> - case ATT_OP_HANDLE_IND:
> - case ATT_OP_HANDLE_NOTIFY:
> + case ATT_OP_HANDLE_IND:
> + /*
> + * We have to send confirmation here. If some client is
> + * registered for this indication, event will be send in
> + * handle_notification
> + */
> + length = enc_confirmation(opdu, sizeof(opdu));
> + status = 0;
> + break;
> + case ATT_OP_HANDLE_NOTIFY:
> /* Client will handle this */
> return;
> case ATT_OP_EXEC_WRITE_REQ:
Applied, thanks.
--
Best regards,
Szymon Janc
prev parent reply other threads:[~2014-05-22 11:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 10:50 [PATCH] android/gatt: Fix not sending confirmation for INDICATION Marcin Kraglak
2014-05-22 11:15 ` 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=5289260.qhIs60D7SF@uw000953 \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcin.kraglak@tieto.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox