Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Marcin Kraglak <marcin.kraglak@tieto.com>
Cc: linux-bluetooth@vger.kernel.org,
	Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Subject: Re: [PATCH 1/8] android/gatt: Fix sending att responses
Date: Tue, 13 May 2014 15:04:26 +0200	[thread overview]
Message-ID: <2770088.jWxQEZVvW7@uw000953> (raw)
In-Reply-To: <1399899758-4944-2-git-send-email-marcin.kraglak@tieto.com>

Hi,

On Monday 12 of May 2014 15:02:31 Marcin Kraglak wrote:
> From: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
> 
> In case of error we should respond and not fail silently.
> Before sending we should also check length value as, opdu is filled
> only for some ATT operations and some are handled by read callbacks,
> sending their own responses. We should be gradually moving to the later,
> using response data queue.
> ---
>  android/gatt.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index 157ebe6..d8bcfb5 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -4321,18 +4321,12 @@ static void att_handler(const uint8_t *ipdu, uint16_t len, gpointer user_data)
>  		break;
>  	case ATT_OP_WRITE_REQ:
>  		status = write_req_request(ipdu, len, dev);
> -		if (!status)
> -			return;
>  		break;
>  	case ATT_OP_WRITE_CMD:
>  		status = write_cmd_request(ipdu, len, dev);
> -		if (!status)
> -			return;
>  		break;
>  	case ATT_OP_PREP_WRITE_REQ:
>  		status = write_prep_request(ipdu, len, dev);
> -		if (!status)
> -			return;
>  		break;
>  	case ATT_OP_EXEC_WRITE_REQ:
>  		/* TODO */
> @@ -4344,7 +4338,7 @@ static void att_handler(const uint8_t *ipdu, uint16_t len, gpointer user_data)
>  	default:
>  		DBG("Unsupported request 0x%02x", ipdu[0]);
>  		status = ATT_ECODE_REQ_NOT_SUPP;
> -		goto done;
> +		break;
>  	}
>  
>  done:
> @@ -4352,7 +4346,8 @@ done:
>  		length = enc_error_resp(ipdu[0], 0x0000, status, opdu,
>  							ATT_DEFAULT_LE_MTU);
>  
> -	g_attrib_send(dev->attrib, 0, opdu, length, NULL, NULL, NULL);
> +	if (length)
> +		g_attrib_send(dev->attrib, 0, opdu, length, NULL, NULL, NULL);
>  }
>  
>  static void create_listen_connections(void *data, void *user_data)
> 

This patch doesn't change function flow, I suppose it would matter later in
series. Please put patches in proper order.

-- 
Best regards, 
Szymon Janc

  reply	other threads:[~2014-05-13 13:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 13:02 [PATCH 0/8] Fix reading attribute value in database Marcin Kraglak
2014-05-12 13:02 ` [PATCH 1/8] android/gatt: Fix sending att responses Marcin Kraglak
2014-05-13 13:04   ` Szymon Janc [this message]
2014-05-12 13:02 ` [PATCH 2/8] shared/gatt: Extend gatt_db_read function Marcin Kraglak
2014-05-13 13:07   ` Szymon Janc
2014-05-12 13:02 ` [PATCH 3/8] android/gatt: Refactor ATT read operations Marcin Kraglak
2014-05-13 13:30   ` Szymon Janc
2014-05-12 13:02 ` [PATCH 4/8] shared/gatt: Make read by type use response queue Marcin Kraglak
2014-05-13 13:35   ` Szymon Janc
2014-05-12 13:02 ` [PATCH 5/8] shared/gatt: Refactor find information Marcin Kraglak
2014-05-13 13:41   ` Szymon Janc
2014-05-12 13:02 ` [PATCH 6/8] shared/gatt: Add function to get end group handle Marcin Kraglak
2014-05-12 13:02 ` [PATCH 7/8] shared/gatt: Make 'find_by_type_value' callback compatible Marcin Kraglak
2014-05-12 13:02 ` [PATCH 8/8] shared/gatt: Refactor read_by_group_type Marcin Kraglak
2014-05-13 13:50   ` Szymon Janc

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=2770088.jWxQEZVvW7@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=jakub.tyszkowski@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