public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Keep found LE device list to use when creating a device
@ 2010-12-29 21:25 Claudio Takahasi
  2010-12-29 22:02 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2010-12-29 21:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Found devices list should be used to identify device types when
CreateDevice or CreatePairedDevice are called. During the device
creation the selected device will be classified as LE device if
it belongs to the device found list and if the Flags AD type
matches the GAP requirements. BR/EDR devices don't need to be
tracked since the default remote device type is Basic Rate.
---
 src/adapter.c |   39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index eef8a06..b96a89e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -638,16 +638,31 @@ static uint8_t get_needed_mode(struct btd_adapter *adapter, uint8_t mode)
 	return mode;
 }
 
+static GSList *remove_bredr(GSList *all)
+{
+	GSList *l, *le;
+
+	for (l = all, le = NULL; l; l = l->next) {
+		struct remote_dev_info *dev = l->data;
+		if (dev->le == FALSE) {
+			dev_info_free(dev);
+			continue;
+		}
+
+		le = g_slist_append(le, dev);
+	}
+
+	g_slist_free(all);
+
+	return le;
+}
+
 static void stop_discovery(struct btd_adapter *adapter, gboolean suspend)
 {
 	pending_remote_name_cancel(adapter);
 
-	if (suspend == FALSE) {
-		g_slist_foreach(adapter->found_devices,
-				(GFunc) dev_info_free, NULL);
-		g_slist_free(adapter->found_devices);
-		adapter->found_devices = NULL;
-	}
+	if (suspend == FALSE)
+		adapter->found_devices = remove_bredr(adapter->found_devices);
 
 	if (adapter->oor_devices) {
 		g_slist_free(adapter->oor_devices);
@@ -1141,6 +1156,13 @@ static DBusMessage *adapter_start_discovery(DBusConnection *conn,
 	if (adapter->disc_sessions)
 		goto done;
 
+	g_slist_foreach(adapter->found_devices, (GFunc) dev_info_free, NULL);
+	g_slist_free(adapter->found_devices);
+	adapter->found_devices = NULL;
+
+	g_slist_free(adapter->oor_devices);
+	adapter->oor_devices = NULL;
+
 	err = start_discovery(adapter);
 	if (err < 0)
 		return btd_error_failed(msg, strerror(-err));
@@ -2475,6 +2497,11 @@ static void adapter_free(gpointer user_data)
 
 	sdp_list_free(adapter->services, NULL);
 
+	g_slist_foreach(adapter->found_devices, (GFunc) dev_info_free, NULL);
+	g_slist_free(adapter->found_devices);
+
+	g_slist_free(adapter->oor_devices);
+
 	g_free(adapter->path);
 	g_free(adapter);
 }
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Keep found LE device list to use when creating a device
  2010-12-29 21:25 [PATCH] Keep found LE device list to use when creating a device Claudio Takahasi
@ 2010-12-29 22:02 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-12-29 22:02 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Wed, Dec 29, 2010, Claudio Takahasi wrote:
> Found devices list should be used to identify device types when
> CreateDevice or CreatePairedDevice are called. During the device
> creation the selected device will be classified as LE device if
> it belongs to the device found list and if the Flags AD type
> matches the GAP requirements. BR/EDR devices don't need to be
> tracked since the default remote device type is Basic Rate.
> ---
>  src/adapter.c |   39 +++++++++++++++++++++++++++++++++------
>  1 files changed, 33 insertions(+), 6 deletions(-)

This patch has also been pushed upstream. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-29 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-29 21:25 [PATCH] Keep found LE device list to use when creating a device Claudio Takahasi
2010-12-29 22:02 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox