All of lore.kernel.org
 help / color / mirror / Atom feed
From: "João Paulo Rechi Vita" <jprvita@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Claudio Takahasi <claudio.takahasi@openbossa.org>
Subject: [PATCH BlueZ v5 08/14] core: Replace interleaved by LE scanning
Date: Tue,  4 Sep 2012 16:04:36 -0300	[thread overview]
Message-ID: <1346785482-13359-9-git-send-email-jprvita@openbossa.org> (raw)
In-Reply-To: <1346785482-13359-1-git-send-email-jprvita@openbossa.org>

From: Claudio Takahasi <claudio.takahasi@openbossa.org>

This patches replaces the interleaved discovery by LE scanning when LE
re-connection is required.
---
 src/adapter.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index e1c4fe3..0355a4c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2261,7 +2261,7 @@ void btd_adapter_start(struct btd_adapter *adapter)
 	info("Adapter %s has been enabled", adapter->path);
 
 	if (g_slist_length(adapter->connect_list))
-		mgmt_start_discovery(adapter->dev_id);
+		mgmt_start_scanning(adapter->dev_id);
 }
 
 static void reply_pending_requests(struct btd_adapter *adapter)
@@ -2605,14 +2605,22 @@ void adapter_set_discovering(struct btd_adapter *adapter,
 
 	connect_list_size = g_slist_length(adapter->connect_list);
 
-	if (!adapter_has_discov_sessions(adapter) && !connect_list_size)
+	if (adapter_has_discov_sessions(adapter)) {
+		adapter->discov_id = g_idle_add(discovery_cb, adapter);
+
+		DBG("hci%u restarting discovery: disc_sessions %u",
+				adapter->dev_id,
+				g_slist_length(adapter->disc_sessions));
 		return;
+	}
 
-	DBG("hci%u restarting discovery: disc_sessions %u, connect_list size "
-		"%u", adapter->dev_id, g_slist_length(adapter->disc_sessions),
-							connect_list_size);
+	if (connect_list_size) {
+		mgmt_start_scanning(adapter->dev_id);
 
-	adapter->discov_id = g_idle_add(discovery_cb, adapter);
+		DBG("hci%u restarting scanning connect_list size %u",
+				adapter->dev_id, connect_list_size);
+		return;
+	}
 }
 
 static void suspend_discovery(struct btd_adapter *adapter)
@@ -2927,7 +2935,7 @@ static gboolean clean_connecting_state(GIOChannel *io, GIOCondition cond, gpoint
 
 	if (adapter->waiting_to_connect == 0 &&
 					g_slist_length(adapter->connect_list))
-		mgmt_start_discovery(adapter->dev_id);
+		mgmt_start_scanning(adapter->dev_id);
 
 	btd_device_unref(device);
 	return FALSE;
-- 
1.7.11.4


  parent reply	other threads:[~2012-09-04 19:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 19:04 [PATCH BlueZ v5 00/14] LE General Connection Establishment procedure João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 01/14] core: Control connections based on adapter state João Paulo Rechi Vita
2012-09-07  9:59   ` Johan Hedberg
2012-09-11 13:34     ` Joao Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 02/14] mgmt: Print error message when start_discovery fails João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 03/14] core: Add compare function for bdaddr in a struct btd_device João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 04/14] core: Add a list of LE devices to connect João Paulo Rechi Vita
2012-09-07 10:23   ` Johan Hedberg
2012-09-04 19:04 ` [PATCH BlueZ v5 05/14] core: Use adapter connect list for LE connections João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 06/14] core: Mutually exclude concurrent connections João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 07/14] mgmt: Add LE scanning callback João Paulo Rechi Vita
2012-09-04 19:04 ` João Paulo Rechi Vita [this message]
2012-09-04 19:04 ` [PATCH BlueZ v5 09/14] core: Start LE scanning when a device requests João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 10/14] core: Queue discovery if scanning is active João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 11/14] core: Disable unnecessary auto connections João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 12/14] core: Re-connect for ECONNRESET or ECONNABORTED João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 13/14] mgmt: Add address type to bonding debug message João Paulo Rechi Vita
2012-09-04 19:04 ` [PATCH BlueZ v5 14/14] core: Suspend scanning before connect on pairing João Paulo Rechi Vita
2012-09-05  5:00 ` [PATCH BlueZ v5 00/14] LE General Connection Establishment procedure Chen Ganir
2012-09-05 17:15   ` Joao Paulo Rechi Vita

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=1346785482-13359-9-git-send-email-jprvita@openbossa.org \
    --to=jprvita@openbossa.org \
    --cc=claudio.takahasi@openbossa.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.