Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] androd/client: Extend history line size and depth
@ 2014-09-05 12:48 Grzegorz Kolodziejczyk
  2014-09-05 12:48 ` [PATCH 2/2] android/client: Check if hex string is byte format Grzegorz Kolodziejczyk
  2014-09-05 13:29 ` [PATCH 1/2] androd/client: Extend history line size and depth Szymon Janc
  0 siblings, 2 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-09-05 12:48 UTC (permalink / raw)
  To: linux-bluetooth

For some commands current history line size isn't enough to store it
complete. For complex/long run, extended history depth can be helpful.
---
 android/client/history.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/client/history.c b/android/client/history.c
index 3dae27a..ca4664c 100644
--- a/android/client/history.c
+++ b/android/client/history.c
@@ -24,8 +24,8 @@
 
 /* Very simple history storage for easy usage of tool */
 
-#define HISTORY_DEPTH 20
-#define LINE_SIZE 100
+#define HISTORY_DEPTH 40
+#define LINE_SIZE 200
 static char lines[HISTORY_DEPTH][LINE_SIZE];
 static int last_line = 0;
 static int history_size = 0;
-- 
1.9.3


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

* [PATCH 2/2] android/client: Check if hex string is byte format
  2014-09-05 12:48 [PATCH 1/2] androd/client: Extend history line size and depth Grzegorz Kolodziejczyk
@ 2014-09-05 12:48 ` Grzegorz Kolodziejczyk
  2014-09-05 13:28   ` Szymon Janc
  2014-09-05 13:29 ` [PATCH 1/2] androd/client: Extend history line size and depth Szymon Janc
  1 sibling, 1 reply; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-09-05 12:48 UTC (permalink / raw)
  To: linux-bluetooth

Data strings should be byte format.
---
 android/client/if-gatt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index c8352b5..5cae7e8 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -803,6 +803,10 @@ static int fill_buffer(const char *str, uint8_t *out, int out_size)
 
 	str_len = strlen(str);
 
+	/* Hex string must be byte format */
+	if (str_len%2 != 0)
+		return -1;
+
 	for (i = 0, j = 0; i < out_size && j < str_len; i++, j++) {
 		c = str[j];
 
@@ -1201,6 +1205,10 @@ static void write_characteristic_p(int argc, const char **argv)
 	}
 
 	GET_VERIFY_HEX_STRING(argv[6], value, len);
+	if (len < 0) {
+		haltest_error("Value must be byte hex string\n");
+		return;
+	}
 
 	/* auth_req */
 	if (argc > 7)
-- 
1.9.3


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

* Re: [PATCH 2/2] android/client: Check if hex string is byte format
  2014-09-05 12:48 ` [PATCH 2/2] android/client: Check if hex string is byte format Grzegorz Kolodziejczyk
@ 2014-09-05 13:28   ` Szymon Janc
  0 siblings, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-09-05 13:28 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Friday 05 of September 2014 14:48:27 Grzegorz Kolodziejczyk wrote:
> Data strings should be byte format.
> ---
>  android/client/if-gatt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> index c8352b5..5cae7e8 100644
> --- a/android/client/if-gatt.c
> +++ b/android/client/if-gatt.c
> @@ -803,6 +803,10 @@ static int fill_buffer(const char *str, uint8_t *out, int out_size)
>  
>  	str_len = strlen(str);
>  
> +	/* Hex string must be byte format */
> +	if (str_len%2 != 0)

if (str_len % 2)

> +		return -1;
> +
>  	for (i = 0, j = 0; i < out_size && j < str_len; i++, j++) {
>  		c = str[j];
>  
> @@ -1201,6 +1205,10 @@ static void write_characteristic_p(int argc, const char **argv)
>  	}
>  
>  	GET_VERIFY_HEX_STRING(argv[6], value, len);
> +	if (len < 0) {
> +		haltest_error("Value must be byte hex string\n");
> +		return;
> +	}

Move this check to GET_VERIFY_HEX_STRING() macro (after fill_bufer()) so that
all users gets updated.

>  
>  	/* auth_req */
>  	if (argc > 7)
> 

-- 
Best regards, 
Szymon Janc

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

* Re: [PATCH 1/2] androd/client: Extend history line size and depth
  2014-09-05 12:48 [PATCH 1/2] androd/client: Extend history line size and depth Grzegorz Kolodziejczyk
  2014-09-05 12:48 ` [PATCH 2/2] android/client: Check if hex string is byte format Grzegorz Kolodziejczyk
@ 2014-09-05 13:29 ` Szymon Janc
  1 sibling, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-09-05 13:29 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Friday 05 of September 2014 14:48:26 Grzegorz Kolodziejczyk wrote:
> For some commands current history line size isn't enough to store it
> complete. For complex/long run, extended history depth can be helpful.
> ---
>  android/client/history.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/android/client/history.c b/android/client/history.c
> index 3dae27a..ca4664c 100644
> --- a/android/client/history.c
> +++ b/android/client/history.c
> @@ -24,8 +24,8 @@
>  
>  /* Very simple history storage for easy usage of tool */
>  
> -#define HISTORY_DEPTH 20
> -#define LINE_SIZE 100
> +#define HISTORY_DEPTH 40
> +#define LINE_SIZE 200
>  static char lines[HISTORY_DEPTH][LINE_SIZE];
>  static int last_line = 0;
>  static int history_size = 0;
> 

This patch is now applied. Thanks.

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-09-05 13:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 12:48 [PATCH 1/2] androd/client: Extend history line size and depth Grzegorz Kolodziejczyk
2014-09-05 12:48 ` [PATCH 2/2] android/client: Check if hex string is byte format Grzegorz Kolodziejczyk
2014-09-05 13:28   ` Szymon Janc
2014-09-05 13:29 ` [PATCH 1/2] androd/client: Extend history line size and depth Szymon Janc

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