Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2] adapter: Fix initializing GATT server for BR/EDR only controllers
Date: Wed, 14 Feb 2018 15:58:15 +0200	[thread overview]
Message-ID: <20180214135815.18250-1-luiz.dentz@gmail.com> (raw)

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

Controller that do not support LE bearer shall not use GATT server for
anything.
---
v2: Add check for main_opts.mode and remove change to main.conf

 src/adapter.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index bd5c1e150..fcb102411 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7745,6 +7745,13 @@ static int adapter_register(struct btd_adapter *adapter)
 		agent_unref(agent);
 	}
 
+	/* Don't start GATT database and advertising managers on
+	 * non-LE controllers.
+	 */
+	if (!(adapter->supported_settings & MGMT_SETTING_LE) ||
+					main_opts.mode == BT_MODE_BREDR)
+		goto load;
+
 	adapter->database = btd_gatt_database_new(adapter);
 	if (!adapter->database) {
 		btd_error(adapter->dev_id,
@@ -7753,18 +7760,14 @@ static int adapter_register(struct btd_adapter *adapter)
 		return -EINVAL;
 	}
 
-	/* Don't start advertising managers on non-LE controllers. */
-	if (adapter->supported_settings & MGMT_SETTING_LE)
-		adapter->adv_manager = btd_adv_manager_new(adapter);
-	else
-		btd_info(adapter->dev_id,
-			"LEAdvertisingManager skipped, LE unavailable");
+	adapter->adv_manager = btd_adv_manager_new(adapter);
 
 	db = btd_gatt_database_get_db(adapter->database);
 	adapter->db_id = gatt_db_register(db, services_modified,
 							services_modified,
 							adapter, NULL);
 
+load:
 	load_config(adapter);
 	fix_storage(adapter);
 	load_drivers(adapter);
-- 
2.14.3


             reply	other threads:[~2018-02-14 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 13:58 Luiz Augusto von Dentz [this message]
2018-02-16 18:03 ` [PATCH v2] adapter: Fix initializing GATT server for BR/EDR only controllers Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180214135815.18250-1-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox