public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: linux-bluetooth@vger.kernel.org
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Subject: Re: Input pairing broken again
Date: Fri, 12 Sep 2008 19:38:27 -0700	[thread overview]
Message-ID: <1221273507.10249.20.camel@macbook.infradead.org> (raw)
In-Reply-To: <1221272245.10249.18.camel@macbook.infradead.org>

While we're at it, let's fix init_browse() not to abort completely when
it finds one driver asking for a UUID that another driver already
wanted, and to eliminate duplicates of the UUIDs in uuid_list[] too...

diff --git a/src/device.c b/src/device.c
index b90861b..cae29f8 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1022,11 +1023,29 @@ static void init_browse(struct browse_req *req)
 
 		for (i = 0; driver->uuids[i]; i++) {
 			char *uuid;
-
+			int j;
+
+			/* Eliminate duplicates of UUIDs in uuid_list[]... */
+			if (strlen(driver->uuids[i]) == 36 && 
+			    !strncmp(driver->uuids[i], "0000", 4) &&
+			    !strcasecmp(driver->uuids[i] + 8, 
+					"-0000-1000-8000-00805F9B34FB")) {
+				uint16_t uuid16 = strtol(driver->uuids[i],
+							 NULL, 16);
+				for (j = 0; uuid_list[j]; j++) {
+					if (uuid16 == uuid_list[j])
+						continue;
+				}
+					
+			}
+			/* ... and of UUIDs another driver already asked for */
 			if (g_slist_find_custom(req->uuids, driver->uuids[i],
-					(GCompareFunc) strcasecmp))
-				return;
-
+						(GCompareFunc) strcasecmp)) {
+				printf("match on %s: return\n", driver->uuids[i]);
+				continue;
+			}
+			printf("Add uuid %s for driver %s\n",
+			       driver->uuids[i], driver->name);
 			uuid = g_strdup(driver->uuids[i]);
 			req->uuids = g_slist_append(req->uuids, uuid);
 		}

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


  reply	other threads:[~2008-09-13  2:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-13  0:21 Input pairing broken again David Woodhouse
2008-09-13  2:15 ` Luiz Augusto von Dentz
2008-09-13  2:17 ` David Woodhouse
2008-09-13  2:38   ` David Woodhouse [this message]
2008-09-13  2:46     ` Luiz Augusto von Dentz
2008-09-13  2:52       ` David Woodhouse
2008-09-13  2:57         ` Luiz Augusto von Dentz

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=1221273507.10249.20.camel@macbook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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