From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> If an instance already exists there is no reason to create a second one as they both will bind to HCI_CHANNEL_CONTROL. --- src/shared/mgmt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c index 277e361a6..0721f73f2 100644 --- a/src/shared/mgmt.c +++ b/src/shared/mgmt.c @@ -81,6 +81,8 @@ struct mgmt_notify { void *user_data; }; +static struct mgmt *default_mgmt; + static void destroy_request(void *data) { struct mgmt_request *request = data; @@ -432,6 +434,9 @@ struct mgmt *mgmt_new_default(void) } addr; int fd; + if (default_mgmt) + return mgmt_ref(default_mgmt); + fd = socket(PF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, BTPROTO_HCI); if (fd < 0) @@ -455,6 +460,8 @@ struct mgmt *mgmt_new_default(void) mgmt->close_on_unref = true; + default_mgmt = mgmt; + return mgmt; } -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html