summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-07-08 14:51:44 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-07-13 14:03:45 +0300
commitc17747546d0024ef34083377e0645943131b31e4 (patch)
tree12e046c13f66235a2d6d8fb3bd3d5252d31fdfe1
parent05bdde05b2176b42f6334c4f478395cfc6943abf (diff)
downloadbluez-c17747546d0024ef34083377e0645943131b31e4.tar.gz
shared/gatt-client: Don't use exchange MTU with BR/EDR links
Accourding to the spec MTU should ne negotiated using L2CAP channel configuration procedures: BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 546: 4.3.1 Exchange MTU This sub-procedure shall not be used on a BR/EDR physical link since the MTU size is negotiated using L2CAP channel configuration procedures.
-rw-r--r--src/shared/gatt-client.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index adabfe351..8fd8a4500 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1622,14 +1622,25 @@ static bool gatt_client_init(struct bt_gatt_client *client, uint16_t mtu)
if (!op)
return false;
+ /*
+ * BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 546:
+ *
+ * 4.3.1 Exchange MTU
+ *
+ * This sub-procedure shall not be used on a BR/EDR physical link since
+ * the MTU size is negotiated using L2CAP channel configuration
+ * procedures.
+ */
+ if (bt_att_get_link_type(client->att) == BT_ATT_LINK_BREDR)
+ goto discover;
+
/* 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),
+ client->mtu_req_id = bt_gatt_exchange_mtu(client->att, mtu,
exchange_mtu_cb,
discovery_op_ref(op),
discovery_op_unref);