linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix service driver selection when WHO header is informed
@ 2010-02-23 10:06 Luiz Augusto von Dentz
  2010-02-23 13:59 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2010-02-23 10:06 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

Drivers which support WHO header should be checked first since they have
priority e.g. pcsuite over ftp.
---
 src/service.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 196a5c1..c6ce101 100644
--- a/src/service.c
+++ b/src/service.c
@@ -49,8 +49,8 @@ struct obex_service_driver
*obex_service_driver_find(GSList *list,
 		struct obex_service_driver *driver = l->data;

 		if (driver->who && who &&
-				driver->who_size == who_size &&
-				memcmp(driver->who, who, who_size) != 0)
+				(driver->who_size != who_size ||
+				memcmp(driver->who, who, who_size) != 0))
 			continue;

 		if (driver->target == NULL && target == NULL)
@@ -97,7 +97,11 @@ int obex_service_driver_register(struct
obex_service_driver *driver)

 	debug("driver %p service %s registered", driver, driver->name);

-	drivers = g_slist_append(drivers, driver);
+	/* Drivers that support who has priority */
+	if (driver->who)
+		drivers = g_slist_prepend(drivers, driver);
+	else
+		drivers = g_slist_append(drivers, driver);

 	return 0;
 }
-- 
1.6.3.3

-- 
Luiz Augusto von Dentz
Computer Engineer

[-- Attachment #2: 0001-Fix-service-driver-selection-when-WHO-header-is-info.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

From cce63393c40e55ddbdbc8241bddaecdb5d7306ef Mon Sep 17 00:00:00 2001
From: Luiz Augusto Von Dentz <luiz.dentz-von@nokia.com>
Date: Mon, 22 Feb 2010 17:26:26 +0200
Subject: [PATCH 1/2] Fix service driver selection when WHO header is informed

Drivers which support WHO header should be checked first since they have
priority e.g. pcsuite over ftp.
---
 src/service.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 196a5c1..c6ce101 100644
--- a/src/service.c
+++ b/src/service.c
@@ -49,8 +49,8 @@ struct obex_service_driver *obex_service_driver_find(GSList *list,
 		struct obex_service_driver *driver = l->data;
 
 		if (driver->who && who &&
-				driver->who_size == who_size &&
-				memcmp(driver->who, who, who_size) != 0)
+				(driver->who_size != who_size ||
+				memcmp(driver->who, who, who_size) != 0))
 			continue;
 
 		if (driver->target == NULL && target == NULL)
@@ -97,7 +97,11 @@ int obex_service_driver_register(struct obex_service_driver *driver)
 
 	debug("driver %p service %s registered", driver, driver->name);
 
-	drivers = g_slist_append(drivers, driver);
+	/* Drivers that support who has priority */
+	if (driver->who)
+		drivers = g_slist_prepend(drivers, driver);
+	else
+		drivers = g_slist_append(drivers, driver);
 
 	return 0;
 }
-- 
1.6.3.3


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

* Re: [PATCH 1/2] Fix service driver selection when WHO header is informed
  2010-02-23 10:06 [PATCH 1/2] Fix service driver selection when WHO header is informed Luiz Augusto von Dentz
@ 2010-02-23 13:59 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-02-23 13:59 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Tue, Feb 23, 2010, Luiz Augusto von Dentz wrote:
> Drivers which support WHO header should be checked first since they have
> priority e.g. pcsuite over ftp.
> ---
>  src/service.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)

The patch is now upstream. Thanks.

Johan

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

end of thread, other threads:[~2010-02-23 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-23 10:06 [PATCH 1/2] Fix service driver selection when WHO header is informed Luiz Augusto von Dentz
2010-02-23 13:59 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).