Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] android/client: Fix reversing send_response values
@ 2014-06-05 16:32 Marcin Kraglak
  2014-06-05 16:32 ` [PATCH 2/2] android/pts: Update GATT test result Marcin Kraglak
  2014-06-05 16:54 ` [PATCH 1/2] android/client: Fix reversing send_response values Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Marcin Kraglak @ 2014-06-05 16:32 UTC (permalink / raw)
  To: linux-bluetooth

We don't want to reverse data passed to send_response.
---
 android/client/if-gatt.c | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 0375126..a9c8644 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -1750,6 +1750,30 @@ static void gatts_send_indication_p(int argc, const char *argv[])
 							len, confirm, data);
 }
 
+/*
+ * convert hex string to uint8_t array
+ */
+static int fill_buffer(const char *str, uint8_t *out, int out_size)
+{
+	int len = strlen(str);
+	int length = 0;
+	int i;
+
+	memset(out, 0, out_size);
+	if (out_size * 2 > len + 1)
+		out_size = (len + 1) / 2;
+
+	for (i = 0; i < out_size && len > length; ++i) {
+		if (len >= length)
+			sscanf(str + length, "%02hhx", &out[i]);
+		else
+			sscanf(str, "%1hhx", &out[i]);
+		length += 2;
+	}
+
+	return len/2;
+}
+
 /* send_response */
 
 static void gatts_send_response_p(int argc, const char *argv[])
@@ -1772,15 +1796,13 @@ static void gatts_send_response_p(int argc, const char *argv[])
 	data.attr_value.auth_req = 0;
 	data.attr_value.len = 0;
 
-	if (argc > 7) {
-		data.attr_value.len = strlen(argv[7]);
-		scan_field(argv[7], data.attr_value.len, data.attr_value.value,
+	if (argc > 7)
+		data.attr_value.len = fill_buffer(argv[7],
+						data.attr_value.value,
 						sizeof(data.attr_value.value));
-	}
 
 	haltest_info("conn_id %d, trans_id %d, status %d", conn_id, trans_id,
 									status);
-
 	EXEC(if_gatt->server->send_response, conn_id, trans_id, status, &data);
 }
 
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] android/pts: Update GATT test result
  2014-06-05 16:32 [PATCH 1/2] android/client: Fix reversing send_response values Marcin Kraglak
@ 2014-06-05 16:32 ` Marcin Kraglak
  2014-06-05 16:49   ` Marcel Holtmann
  2014-06-05 16:54 ` [PATCH 1/2] android/client: Fix reversing send_response values Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Marcin Kraglak @ 2014-06-05 16:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Eva Kolanska

From: Eva Kolanska <eva.kolanska@tieto.com>

---
 android/pts-gatt.txt | 128 +++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 114 insertions(+), 14 deletions(-)

diff --git a/android/pts-gatt.txt b/android/pts-gatt.txt
index 08ade26..3f986ee 100644
--- a/android/pts-gatt.txt
+++ b/android/pts-gatt.txt
@@ -748,7 +748,16 @@ TC_GAW_SR_BI_06_C	PASS	haltest:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 12
-TC_GAW_SR_BV_05_C	INC
+TC_GAW_SR_BV_05_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response:
+						repeat with correct value
 TC_GAW_SR_BI_07_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
@@ -760,7 +769,15 @@ TC_GAW_SR_BI_08_C	PASS	haltest:
 				gatts add_characteristic:
 						<properties> 2 <permissions> 1
 				gatts start_service
-TC_GAW_SR_BI_09_C	INC
+TC_GAW_SR_BI_09_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response: <status> 7
 TC_GAW_SR_BI_11_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
@@ -788,14 +805,60 @@ TC_GAW_SR_BI_13_C	PASS	haltest:
 						<data> value greater than MTU
 						repeat with correct offset
 				gatts send_response: <status> 12
-TC_GAW_SR_BV_06_C	INC
-TC_GAW_SR_BV_10_C	INC
-TC_GAW_SR_BI_14_C	INC
-TC_GAW_SR_BI_15_C	INC
-TC_GAW_SR_BI_17_C	INC
-TC_GAW_SR_BI_18_C	INC
-TC_GAW_SR_BI_19_C	INC
-TC_GAW_SR_BV_07_C	INC
+TC_GAW_SR_BV_06_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						repeat with correct value
+TC_GAW_SR_BV_10_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response:
+						repeat with correct value
+TC_GAW_SR_BI_14_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response: <status> 1
+TC_GAW_SR_BI_15_C	PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response: <status> 3
+TC_GAW_SR_BI_17_C	PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response: <status> 8
+TC_GAW_SR_BI_18_C	PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response: <status> 5
+TC_GAW_SR_BI_19_C	PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response: <status> 12
+TC_GAW_SR_BV_07_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						repeat with correct value
 TC_GAW_CL_BV_08_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
@@ -838,7 +901,18 @@ TC_GAW_SR_BI_24_C	PASS	haltest:
 				gatts add_descriptor: <permmisions> 17
 				gatts start_service
 				gatts send_response: <status> 12
-TC_GAW_SR_BV_09_C	INC
+TC_GAW_SR_BV_09_C        PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response:
+						repeat with correct value
 TC_GAW_SR_BI_25_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
@@ -852,7 +926,16 @@ TC_GAW_SR_BI_26_C	PASS	haltest:
 						<properties> 10 <permissions> 17
 				gatts add_descriptor: <permmisions> 1
 				gatts start_service
-TC_GAW_SR_BI_27_C	INC
+TC_GAW_SR_BI_27_C       PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts add_descriptor: <permmisions> 1
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response: <status> 7
 TC_GAW_SR_BI_29_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
@@ -881,7 +964,15 @@ TC_GAW_SR_BI_32_C	PASS	haltest:
 				gatts start_service
 				gatts send_response
 				gatts send_response: <status> 13
-TC_GAW_SR_BI_33_C	INC
+TC_GAW_SR_BI_33_C	PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response: <status> 13
 TC_GAW_SR_BI_34_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
@@ -890,7 +981,16 @@ TC_GAW_SR_BI_34_C	PASS	haltest:
 				gatts start_service
 				gatts send_response
 				gatts send_response: <status> 13
-TC_GAW_SR_BI_35_C	INC
+TC_GAW_SR_BI_35_C	PASS	haltest:
+				gatts add_service
+				gatts add_characteristic:
+						<properties> 10 <permissions> 17
+				gatts add_descriptor: <permmisions> 17
+				gatts start_service
+				gatts send_response:
+						<data> value greater than MTU
+						repeat with correct offset
+				gatts send_response: <status> 13
 TC_GAN_CL_BV_01_C	PASS	haltest:
 				gattc connect
 				gattc search_service
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] android/pts: Update GATT test result
  2014-06-05 16:32 ` [PATCH 2/2] android/pts: Update GATT test result Marcin Kraglak
@ 2014-06-05 16:49   ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2014-06-05 16:49 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth, Eva Kolanska

Hi Eva,

> ---
> android/pts-gatt.txt | 128 +++++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 114 insertions(+), 14 deletions(-)
> 
> diff --git a/android/pts-gatt.txt b/android/pts-gatt.txt
> index 08ade26..3f986ee 100644
> --- a/android/pts-gatt.txt
> +++ b/android/pts-gatt.txt
> @@ -748,7 +748,16 @@ TC_GAW_SR_BI_06_C	PASS	haltest:
> 						<properties> 10 <permissions> 17
> 				gatts start_service
> 				gatts send_response: <status> 12
> -TC_GAW_SR_BV_05_C	INC
> +TC_GAW_SR_BV_05_C       PASS	haltest:

can we please stick with using tabs here.

Regards

Marcel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] android/client: Fix reversing send_response values
  2014-06-05 16:32 [PATCH 1/2] android/client: Fix reversing send_response values Marcin Kraglak
  2014-06-05 16:32 ` [PATCH 2/2] android/pts: Update GATT test result Marcin Kraglak
@ 2014-06-05 16:54 ` Marcel Holtmann
  2014-06-06  4:14   ` Szymon Janc
  1 sibling, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2014-06-05 16:54 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

> We don't want to reverse data passed to send_response.
> ---
> android/client/if-gatt.c | 32 +++++++++++++++++++++++++++-----
> 1 file changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> index 0375126..a9c8644 100644
> --- a/android/client/if-gatt.c
> +++ b/android/client/if-gatt.c
> @@ -1750,6 +1750,30 @@ static void gatts_send_indication_p(int argc, const char *argv[])
> 							len, confirm, data);
> }
> 
> +/*
> + * convert hex string to uint8_t array
> + */
> +static int fill_buffer(const char *str, uint8_t *out, int out_size)
> +{
> +	int len = strlen(str);
> +	int length = 0;
> +	int i;
> +
> +	memset(out, 0, out_size);
> +	if (out_size * 2 > len + 1)
> +		out_size = (len + 1) / 2;
> +
> +	for (i = 0; i < out_size && len > length; ++i) {
> +		if (len >= length)
> +			sscanf(str + length, "%02hhx", &out[i]);
> +		else
> +			sscanf(str, "%1hhx", &out[i]);
> +		length += 2;
> +	}
> +
> +	return len/2;
> +}

it is just the client code, but what is this function doing? My brain seriously takes a core dump trying to understand this.

Has anybody actually looked into decode_hex_own_buf or similar from oFono. Using sscanf seems the most inefficient way of handling this.

Regards

Marcel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] android/client: Fix reversing send_response values
  2014-06-05 16:54 ` [PATCH 1/2] android/client: Fix reversing send_response values Marcel Holtmann
@ 2014-06-06  4:14   ` Szymon Janc
  0 siblings, 0 replies; 5+ messages in thread
From: Szymon Janc @ 2014-06-06  4:14 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Marcin Kraglak, linux-bluetooth

Hi Marcin, Marcel,

On Thursday 05 of June 2014 18:54:51 Marcel Holtmann wrote:
> Hi Marcin,
> 
> > We don't want to reverse data passed to send_response.
> > ---
> > android/client/if-gatt.c | 32 +++++++++++++++++++++++++++-----
> > 1 file changed, 27 insertions(+), 5 deletions(-)
> > 
> > diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> > index 0375126..a9c8644 100644
> > --- a/android/client/if-gatt.c
> > +++ b/android/client/if-gatt.c
> > @@ -1750,6 +1750,30 @@ static void gatts_send_indication_p(int argc, const
> > char *argv[])> 
> > 							len, confirm, data);
> > 
> > }
> > 
> > +/*
> > + * convert hex string to uint8_t array
> > + */
> > +static int fill_buffer(const char *str, uint8_t *out, int out_size)
> > +{
> > +	int len = strlen(str);
> > +	int length = 0;
> > +	int i;
> > +
> > +	memset(out, 0, out_size);
> > +	if (out_size * 2 > len + 1)
> > +		out_size = (len + 1) / 2;
> > +
> > +	for (i = 0; i < out_size && len > length; ++i) {
> > +		if (len >= length)
> > +			sscanf(str + length, "%02hhx", &out[i]);
> > +		else
> > +			sscanf(str, "%1hhx", &out[i]);
> > +		length += 2;
> > +	}
> > +
> > +	return len/2;
> > +}
> 
> it is just the client code, but what is this function doing? My brain
> seriously takes a core dump trying to understand this.
> 
> Has anybody actually looked into decode_hex_own_buf or similar from oFono.
> Using sscanf seems the most inefficient way of handling this.

Check hex2buf() in hidhost code.

> 
> Regards
> 
> Marcel
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
BR
Szymon Janc

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-06  4:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-05 16:32 [PATCH 1/2] android/client: Fix reversing send_response values Marcin Kraglak
2014-06-05 16:32 ` [PATCH 2/2] android/pts: Update GATT test result Marcin Kraglak
2014-06-05 16:49   ` Marcel Holtmann
2014-06-05 16:54 ` [PATCH 1/2] android/client: Fix reversing send_response values Marcel Holtmann
2014-06-06  4:14   ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox