Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Michael Janssen <jamuraa@chromium.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 1/4] android/tester-gatt: DRY/bugfix search single PDUs
Date: Wed, 12 Nov 2014 21:51:37 +0100	[thread overview]
Message-ID: <18635217.Ko6fFRuu7e@leonov> (raw)
In-Reply-To: <1415823779-346-2-git-send-email-jamuraa@chromium.org>

HI Michael,

On Wednesday 12 of November 2014 12:22:56 Michael Janssen wrote:

This "DRY/" in commit subject is intended?

> The search service with a single service response PDUs are repeated
> multiple times throughout the testing data.  Use a macro instead.
> 
> Also, the final PDU was malformed on many of these (had 0x11 instead of
> 0x10 in the "request opcode in error" slot) which this fixes.
> ---
>  android/tester-gatt.c | 106
> +++++++++++++------------------------------------- 1 file changed, 26
> insertions(+), 80 deletions(-)
> 
> diff --git a/android/tester-gatt.c b/android/tester-gatt.c
> index 13e096f..b88eeff 100644
> --- a/android/tester-gatt.c
> +++ b/android/tester-gatt.c
> @@ -832,11 +832,14 @@ static struct send_resp_data send_resp_data_2 = {
>  	.response = &response_2,
>  };
> 
> +#define SEARCH_SERVICE_SINGLE_SUCCESS_PDUS				\
> +	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),		\
> +	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),	\
> +	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),		\
> +	raw_pdu(0x01, 0x10, 0x11, 0x00, 0x0a)				\
> +
>  static struct iovec search_service[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x10, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	end_pdu
>  };
> 
> @@ -857,10 +860,7 @@ static struct iovec search_service_3[] = {
>  };
> 
>  static struct iovec get_characteristic_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -869,10 +869,7 @@ static struct iovec get_characteristic_1[] = {
>  };
> 
>  static struct iovec get_descriptor_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -885,10 +882,7 @@ static struct iovec get_descriptor_1[] = {
>  };
> 
>  static struct iovec get_descriptor_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -901,10 +895,7 @@ static struct iovec get_descriptor_2[] = {
>  };
> 
>  static struct iovec get_descriptor_3[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -915,10 +906,7 @@ static struct iovec get_descriptor_3[] = {
>  };
> 
>  static struct iovec get_included_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
>  	raw_pdu(0x09, 0x08, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00, 0xff, 0xfe),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x02, 0x28),
> @@ -927,10 +915,7 @@ static struct iovec get_included_1[] = {
>  };
> 
>  static struct iovec get_included_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
>  	raw_pdu(0x09, 0x06, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00),
>  	raw_pdu(0x0a, 0x15, 0x00),
> @@ -942,20 +927,14 @@ static struct iovec get_included_2[] = {
>  };
> 
>  static struct iovec get_included_3[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
>  	raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),
>  	end_pdu
>  };
> 
>  static struct iovec read_characteristic_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -966,10 +945,7 @@ static struct iovec read_characteristic_1[] = {
>  };
> 
>  static struct iovec read_characteristic_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -980,10 +956,7 @@ static struct iovec read_characteristic_2[] = {
>  };
> 
>  static struct iovec read_descriptor_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -998,10 +971,7 @@ static struct iovec read_descriptor_1[] = {
>  };
> 
>  static struct iovec read_descriptor_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1016,10 +986,7 @@ static struct iovec read_descriptor_2[] = {
>  };
> 
>  static struct iovec write_characteristic_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1029,10 +996,7 @@ static struct iovec write_characteristic_1[] = {
>  };
> 
>  static struct iovec write_characteristic_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1043,10 +1007,7 @@ static struct iovec write_characteristic_2[] = {
>  };
> 
>  static struct iovec write_characteristic_3[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1057,10 +1018,7 @@ static struct iovec write_characteristic_3[] = {
>  };
> 
>  static struct iovec write_descriptor_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1075,10 +1033,7 @@ static struct iovec write_descriptor_1[] = {
>  };
> 
>  static struct iovec write_descriptor_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1093,10 +1048,7 @@ static struct iovec write_descriptor_2[] = {
>  };
> 
>  static struct iovec notification_1[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1105,10 +1057,7 @@ static struct iovec notification_1[] = {
>  };
> 
>  static struct iovec notification_2[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
> @@ -1119,10 +1068,7 @@ static struct iovec notification_2[] = {
>  };
> 
>  static struct iovec notification_3[] = {
> -	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
> -	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
> -	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
> +	SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
>  	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
>  	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
>  	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),

-- 
BR
Szymon Janc

  reply	other threads:[~2014-11-12 20:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 20:22 [PATCH BlueZ 0/4] android fixes and gattrib shim Michael Janssen
2014-11-12 20:22 ` [PATCH BlueZ 1/4] android/tester-gatt: DRY/bugfix search single PDUs Michael Janssen
2014-11-12 20:51   ` Szymon Janc [this message]
2014-11-13 15:30     ` Michael Janssen
2014-11-13 16:16       ` Luiz Augusto von Dentz
2014-11-12 20:22 ` [PATCH BlueZ 2/4] android/tester-gatt: deduplicate read-by-type PDUs Michael Janssen
2014-11-12 20:22 ` [PATCH BlueZ 3/4] android/gatt: dummy callback for indications Michael Janssen
2014-11-12 20:56   ` Szymon Janc
2014-11-12 20:22 ` [PATCH BlueZ 4/4] GATT shim to src/shared bt_att Michael Janssen
2014-11-12 21:14   ` Szymon Janc
2014-11-13  0:49     ` Arman Uguray
2014-11-13 14:05       ` 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=18635217.Ko6fFRuu7e@leonov \
    --to=szymon.janc@tieto.com \
    --cc=jamuraa@chromium.org \
    --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