summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 7e6af42cd..e82508241 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,6 +50,7 @@
#include "log.h"
#include "backtrace.h"
+#include "shared/att-types.h"
#include "lib/uuid.h"
#include "hcid.h"
#include "sdpd.h"
@@ -104,6 +105,7 @@ static const char *policy_options[] = {
static const char *gatt_options[] = {
"Cache",
"MinEncKeySize",
+ "ExchangeMTU",
NULL
};
@@ -419,6 +421,18 @@ static void parse_config(GKeyFile *config)
if (val >=7 && val <= 16)
main_opts.min_enc_key_size = val;
}
+
+ val = g_key_file_get_integer(config, "GATT", "ExchangeMTU", &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ } else {
+ /* Ensure the mtu is within a valid range. */
+ val = MIN(val, BT_ATT_MAX_LE_MTU);
+ val = MAX(val, BT_ATT_DEFAULT_LE_MTU);
+ DBG("ExchangeMTU=%d", val);
+ main_opts.gatt_mtu = val;
+ }
}
static void init_defaults(void)
@@ -442,6 +456,8 @@ static void init_defaults(void)
main_opts.did_vendor = 0x1d6b; /* Linux Foundation */
main_opts.did_product = 0x0246; /* BlueZ */
main_opts.did_version = (major << 8 | minor);
+
+ main_opts.gatt_mtu = BT_ATT_MAX_LE_MTU;
}
static void log_handler(const gchar *log_domain, GLogLevelFlags log_level,