All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] shared/gatt-client: Don't send Exchange MTU for default value
@ 2016-03-04 12:24 Luiz Augusto von Dentz
  2016-03-04 12:24 ` [PATCH BlueZ 2/2] core/device: Don't set MTU when acting as a peripheral Luiz Augusto von Dentz
  2016-03-11 14:44 ` [PATCH BlueZ 1/2] shared/gatt-client: Don't send Exchange MTU for default value Luiz Augusto von Dentz
  0 siblings, 2 replies; 16+ messages in thread
From: Luiz Augusto von Dentz @ 2016-03-04 12:24 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If the MTU to be exchange is the default there is no pointing in sending
it since the remote already assumes it anyway.
---
 src/shared/gatt-client.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index b255175..45acf7b 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1544,6 +1544,11 @@ static bool gatt_client_init(struct bt_gatt_client *client, uint16_t mtu)
 	if (!op)
 		return false;
 
+	/* Check if MTU needs to be send */
+	mtu = MAX(BT_ATT_DEFAULT_LE_MTU, mtu);
+	if (mtu == BT_ATT_DEFAULT_LE_MTU)
+		goto discover;
+
 	/* Configure the MTU */
 	client->mtu_req_id = bt_gatt_exchange_mtu(client->att,
 						MAX(BT_ATT_DEFAULT_LE_MTU, mtu),
@@ -1558,6 +1563,20 @@ static bool gatt_client_init(struct bt_gatt_client *client, uint16_t mtu)
 	client->in_init = true;
 
 	return true;
+
+discover:
+	client->discovery_req = bt_gatt_discover_all_primary_services(
+							client->att, NULL,
+							discover_primary_cb,
+							discovery_op_ref(op),
+							discovery_op_unref);
+	if (!client->discovery_req) {
+		discovery_op_free(op);
+		return false;
+	}
+
+	client->in_init = true;
+	return true;
 }
 
 struct pdu_data {
-- 
2.5.0


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

end of thread, other threads:[~2016-03-11 14:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 12:24 [PATCH BlueZ 1/2] shared/gatt-client: Don't send Exchange MTU for default value Luiz Augusto von Dentz
2016-03-04 12:24 ` [PATCH BlueZ 2/2] core/device: Don't set MTU when acting as a peripheral Luiz Augusto von Dentz
2016-03-04 12:51   ` Łukasz Rymanowski
2016-03-04 13:12     ` Luiz Augusto von Dentz
2016-03-04 13:35       ` Szymon Janc
2016-03-04 14:38         ` Luiz Augusto von Dentz
2016-03-04 15:46       ` Łukasz Rymanowski
2016-03-09 12:13         ` Luiz Augusto von Dentz
2016-03-10  7:59           ` Łukasz Rymanowski
2016-03-10  8:30             ` Luiz Augusto von Dentz
2016-03-10  9:17               ` Łukasz Rymanowski
2016-03-10  9:35                 ` Luiz Augusto von Dentz
2016-03-10  9:42                   ` Szymon Janc
2016-03-10 10:26                     ` Luiz Augusto von Dentz
2016-03-11 14:46                       ` Luiz Augusto von Dentz
2016-03-11 14:44 ` [PATCH BlueZ 1/2] shared/gatt-client: Don't send Exchange MTU for default value Luiz Augusto von Dentz

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.