2015-04-29 09:15:50

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 1/4] android/client: Fix missing new line character

New line character is missing for haltest_info. Without this logs are
distorted after receiving configure mtu callback log.
---
android/client/if-gatt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
index 70287fc..e66cc20 100644
--- a/android/client/if-gatt.c
+++ b/android/client/if-gatt.c
@@ -679,7 +679,7 @@ static void gattc_listen_cb(int status, int client_if)
/* Callback invoked when the MTU for a given connection changes */
static void gattc_configure_mtu_cb(int conn_id, int status, int mtu)
{
- haltest_info("%s: conn_id=%d, status=%d, mtu=%d", __func__, conn_id,
+ haltest_info("%s: conn_id=%d, status=%d, mtu=%d\n", __func__, conn_id,
status, mtu);
}

--
2.1.0



2015-04-29 09:15:53

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 4/4] android/gatt: Fix updating mtu for no registered app

Gatt shouldn't notify about updating mtu if no apps are registered.
Without this patch, while connecting crash can occur.
---
android/gatt.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/android/gatt.c b/android/gatt.c
index 04f89af..157b89d 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -978,6 +978,11 @@ static void notify_mtu_change(void *data, void *user_data)
if (conn->device != device)
return;

+ if (!conn->app) {
+ error("gatt: can't notify mtu - no app registered for conn");
+ return;
+ }
+
switch (conn->app->type) {
case GATT_CLIENT:
notify_client_mtu_change(conn, true);
--
2.1.0


2015-04-29 09:15:52

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 3/4] android/gatt: Send notify mtu change for BR/EDR success conn

This patch fixes sending mtu change notification for BR/EDR gatt
connections. For unsuccessful connection, notify mtu change shouldn't be
sent. This avoid sending bogus mtu values as notify mtu change.
---
android/gatt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index 656abfc..04f89af 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -1652,7 +1652,7 @@ reply:
&data);

/* For BR/EDR notify about MTU since it is not negotiable*/
- if (cid != ATT_CID)
+ if (cid != ATT_CID && status == GATT_SUCCESS)
queue_foreach(app_connections, notify_mtu_change, dev);

device_unref(dev);
--
2.1.0


2015-04-29 09:15:51

by Grzegorz Kolodziejczyk

[permalink] [raw]
Subject: [PATCH 2/4] android/gatt: Remove redundant comment line

This patch removes redundant line from multiple line comment.
---
android/gatt.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index 4da959f..656abfc 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -1642,7 +1642,6 @@ reply:
/*
* There is no ongoing bonding, lets search for primary
* services
- *
*/
search_dev_for_srvc(conn, NULL);
}
--
2.1.0


2015-05-08 13:03:28

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 1/4] android/client: Fix missing new line character

Hi Grzegorz,

On Wednesday 29 of April 2015 11:15:50 Grzegorz Kolodziejczyk wrote:
> New line character is missing for haltest_info. Without this logs are
> distorted after receiving configure mtu callback log.
> ---
> android/client/if-gatt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c
> index 70287fc..e66cc20 100644
> --- a/android/client/if-gatt.c
> +++ b/android/client/if-gatt.c
> @@ -679,7 +679,7 @@ static void gattc_listen_cb(int status, int client_if)
> /* Callback invoked when the MTU for a given connection changes */
> static void gattc_configure_mtu_cb(int conn_id, int status, int mtu)
> {
> - haltest_info("%s: conn_id=%d, status=%d, mtu=%d", __func__, conn_id,
> + haltest_info("%s: conn_id=%d, status=%d, mtu=%d\n", __func__, conn_id,
> status, mtu);
> }

All patches applied, thanks.

--
BR
Szymon Janc