All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 1/2] android/client: Fix incorrect data parsing
@ 2014-08-26 10:20 Marcin Kraglak
  2014-08-26 10:20 ` [PATCHv3 2/2] android/pts: Update PTS GATT test results Marcin Kraglak
  2014-08-26 13:21 ` [PATCHv3 1/2] android/client: Fix incorrect data parsing Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Marcin Kraglak @ 2014-08-26 10:20 UTC (permalink / raw)
  To: linux-bluetooth

Use fill_buffer function in processing write_characteristic
and send_indication functions.
---
 android/client/if-gatt.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 8154bfd..1d8def2 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -1191,11 +1191,12 @@ static void write_characteristic_p(int argc, const char **argv)
 		return;
 	}
 
-	/* len in chars */
-	len = strlen(argv[6]);
-	scan_field(argv[6], len, value, sizeof(value));
-	/* len in bytes converted from ascii chars */
-	len = (len + 1) / 2;
+	if (argv[6][0] != '0' || (argv[6][1] != 'X' && argv[6][1] != 'x')) {
+		haltest_error("Value must be hex string");
+		return;
+	}
+
+	len = fill_buffer(argv[6] + 2, value, sizeof(value));
 
 	/* auth_req */
 	if (argc > 7)
@@ -1791,8 +1792,13 @@ static void gatts_send_indication_p(int argc, const char *argv[])
 	confirm = atoi(argv[5]);
 
 	if (argc > 6) {
-		len = strlen(argv[6]);
-		scan_field(argv[6], len, (uint8_t *) data, sizeof(data));
+		if (argv[6][0] != '0' ||
+				(argv[6][1] != 'X' && argv[6][1] != 'x')) {
+			haltest_error("Value must be hex string");
+			return;
+		}
+
+		len = fill_buffer(argv[6] + 2, (uint8_t *) data, sizeof(data));
 	}
 
 	EXEC(if_gatt->server->send_indication, server_if, attr_handle, conn_id,
-- 
1.9.3


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

* [PATCHv3 2/2] android/pts: Update PTS GATT test results.
  2014-08-26 10:20 [PATCHv3 1/2] android/client: Fix incorrect data parsing Marcin Kraglak
@ 2014-08-26 10:20 ` Marcin Kraglak
  2014-08-26 13:21 ` [PATCHv3 1/2] android/client: Fix incorrect data parsing Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Marcin Kraglak @ 2014-08-26 10:20 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/pts-gatt.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/pts-gatt.txt b/android/pts-gatt.txt
index 0220009..9d57007 100644
--- a/android/pts-gatt.txt
+++ b/android/pts-gatt.txt
@@ -468,8 +468,8 @@ TC_GAW_CL_BV_01_C	PASS	haltest:
 								handle from logs
 				gattc write_characteristic
 				gattc disconnect
-TC_GAW_CL_BV_02_C	INC	PTS issue #12446
-				haltest:
+TC_GAW_CL_BV_02_C	PASS	haltest:
+				gattc connect
 				bluetooth create_bond
 				gattc disconnect
 				gattc connect
-- 
1.9.3


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

* Re: [PATCHv3 1/2] android/client: Fix incorrect data parsing
  2014-08-26 10:20 [PATCHv3 1/2] android/client: Fix incorrect data parsing Marcin Kraglak
  2014-08-26 10:20 ` [PATCHv3 2/2] android/pts: Update PTS GATT test results Marcin Kraglak
@ 2014-08-26 13:21 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2014-08-26 13:21 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

On Tuesday 26 of August 2014 12:20:53 Marcin Kraglak wrote:
> Use fill_buffer function in processing write_characteristic
> and send_indication functions.
> ---
>  android/client/if-gatt.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> index 8154bfd..1d8def2 100644
> --- a/android/client/if-gatt.c
> +++ b/android/client/if-gatt.c
> @@ -1191,11 +1191,12 @@ static void write_characteristic_p(int argc, const char **argv)
>  		return;
>  	}
>  
> -	/* len in chars */
> -	len = strlen(argv[6]);
> -	scan_field(argv[6], len, value, sizeof(value));
> -	/* len in bytes converted from ascii chars */
> -	len = (len + 1) / 2;
> +	if (argv[6][0] != '0' || (argv[6][1] != 'X' && argv[6][1] != 'x')) {
> +		haltest_error("Value must be hex string");
> +		return;
> +	}
> +
> +	len = fill_buffer(argv[6] + 2, value, sizeof(value));
>  
>  	/* auth_req */
>  	if (argc > 7)
> @@ -1791,8 +1792,13 @@ static void gatts_send_indication_p(int argc, const char *argv[])
>  	confirm = atoi(argv[5]);
>  
>  	if (argc > 6) {
> -		len = strlen(argv[6]);
> -		scan_field(argv[6], len, (uint8_t *) data, sizeof(data));
> +		if (argv[6][0] != '0' ||
> +				(argv[6][1] != 'X' && argv[6][1] != 'x')) {
> +			haltest_error("Value must be hex string");
> +			return;
> +		}
> +
> +		len = fill_buffer(argv[6] + 2, (uint8_t *) data, sizeof(data));
>  	}
>  
>  	EXEC(if_gatt->server->send_indication, server_if, attr_handle, conn_id,
> 

Both patches applied, thanks.

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-08-26 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26 10:20 [PATCHv3 1/2] android/client: Fix incorrect data parsing Marcin Kraglak
2014-08-26 10:20 ` [PATCHv3 2/2] android/pts: Update PTS GATT test results Marcin Kraglak
2014-08-26 13:21 ` [PATCHv3 1/2] android/client: Fix incorrect data parsing Szymon Janc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.