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:17:25 -0700	[thread overview]
Message-ID: <1221272245.10249.18.camel@macbook.infradead.org> (raw)
In-Reply-To: <1221265310.10249.10.camel@macbook.infradead.org>

On Fri, 2008-09-12 at 17:21 -0700, David Woodhouse wrote:
> Using the wizard to pair with my Anycom BTM-100 mouse is broken by
> commit 58d8ea3c (Make discovery service routine to search for driver
> uuids.)
> 
> I think the pairing actually works OK, but it takes so long that the
> wizard times out, and doesn't bother to connect the new input device.
> Looking at the dump at http://david.woodhou.se/btmouse-fail.dump it
> seems to be taking about 30 seconds.

diff --git a/src/device.c b/src/device.c
index b90861b..0e615be 100644
--- a/src/device.c
+++ b/src/device.c
@@ -975,8 +975,9 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
 	bdaddr_t src;
 	uuid_t uuid;
 
-	/* Public browsing successful or Single record requested */
-	if (err < 0 || (!req->search_uuid && recs))
+	/* If we have a valid response and req->search_uuid == 1, then
+	   public browsing was successful -- we don't need any more */
+	if (err < 0 || (req->search_uuid == 1 && recs))
 		goto done;
 
 	update_services(req, recs);
@@ -984,8 +985,8 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
 	adapter_get_address(adapter, &src);
 
 	/* Search for mandatory uuids */
-	if (uuid_list[++req->search_uuid]) {
-		sdp_uuid16_create(&uuid, uuid_list[req->search_uuid]);
+	if (uuid_list[req->search_uuid]) {
+		sdp_uuid16_create(&uuid, uuid_list[req->search_uuid++]);
 		bt_search_service(&src, &device->bdaddr, &uuid, browse_cb, user_data, NULL);
 		return;
 	}
@@ -1057,7 +1061,7 @@ int device_browse(struct btd_device *device, DBusConnection *conn,
 		memcpy(&uuid, search, sizeof(uuid_t));
 		cb = search_cb;
 	} else {
-		sdp_uuid16_create(&uuid, uuid_list[req->search_uuid]);
+		sdp_uuid16_create(&uuid, uuid_list[req->search_uuid++]);
 		init_browse(req);
 		cb = browse_cb;
 	}
@@ -1072,7 +1076,7 @@ int device_browse(struct btd_device *device, DBusConnection *conn,
 						device, NULL);
 
 	return bt_search_service(&src, &device->bdaddr,
-					&uuid, browse_cb, req, NULL);
+					&uuid, cb, req, NULL);
 }
 
 struct btd_adapter *device_get_adapter(struct btd_device *device)


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


  parent reply	other threads:[~2008-09-13  2:17 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 [this message]
2008-09-13  2:38   ` David Woodhouse
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=1221272245.10249.18.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