Re: Input pairing broken again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx                              Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux