Skip to contentSkip to conversation

Fix Minimum gatttool MTU

PATCH In review Brian Gix 3 participants 4 messages Feb 16, 2011 Bluetooth drivers

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

cover Fix Minimum gatttool MTU

I am satisfied with the rest of the functionality added to the now "interactive" gatttool, so this patch fixes the one remaining deficiency from my earlier patch.

Signature · 4 lines
Brian Gix
[email protected]
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
author
#1 lore raw

PATCH 1/1 Fix Min MTU to reflect values for both L2CAP & LE

---
 attrib/gatttool.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
attrib/gatttool.c +5 -4
index 1e2a8db..38636f9 100644
@@ -44,8 +44,9 @@
 #include "gatt.h"
 #include "gatttool.h"
 
-/* Minimum MTU for L2CAP connections over BR/EDR */
-#define ATT_MIN_MTU_L2CAP 48
+/* Minimum MTU for ATT connections */
+#define ATT_MIN_MTU_LE		23
+#define ATT_MIN_MTU_L2CAP	48
 
 static gchar *opt_src = NULL;
 static gchar *opt_dst = NULL;
@@ -93,9 +94,9 @@ GIOChannel *do_connect(gchar *dst, gboolean le, BtIOConnect connect_cb)
 
 	/* This check is required because currently setsockopt() returns no
 	 * errors for MTU values smaller than the allowed minimum. */
-	if (opt_mtu != 0 && opt_mtu < ATT_MIN_MTU_L2CAP) {
+	if (opt_mtu != 0 && opt_mtu < (le ? ATT_MIN_MTU_LE : ATT_MIN_MTU_L2CAP)) {
 		g_printerr("MTU cannot be smaller than %d\n",
-							ATT_MIN_MTU_L2CAP);
+				(le ? ATT_MIN_MTU_LE : ATT_MIN_MTU_L2CAP));
 		return NULL;
 	}
 
Signature · 7 lines
1.7.1

-- 
Brian Gix
[email protected]
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
#2 lore raw

Re: [PATCH 1/1] Fix Min MTU to reflect values for both L2CAP & LE

Hi Brian,

Quoted 3 lines · Brian Gix
---
 attrib/gatttool.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Pushed upstream. Thanks.

Johan

#3 lore raw

Re: [PATCH 1/1] Fix Min MTU to reflect values for both L2CAP & LE

In reply to Brian Gix

Hi Brian,

attrib/gatttool.c line 49

Quoted 5 lines · Brian Gix
attrib/gatttool.c +3 -2
-/* Minimum MTU for L2CAP connections over BR/EDR */
-#define ATT_MIN_MTU_L2CAP 48
+/* Minimum MTU for ATT connections */
+#define ATT_MIN_MTU_LE         23
+#define ATT_MIN_MTU_L2CAP      48

on attrib/att.h we have:

#define ATT_DEFAULT_L2CAP_MTU 48
#define ATT_DEFAULT_LE_MTU 23

I think It's better to reuse them. Johan has applied your patch already, so you will need to create a fixup for it.

Regards,

Signature · 3 lines
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil