From 0144612a3d800c5d657cf141634f6b6cd47b4128 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 12 Sep 2008 19:42:06 -0700 Subject: fix init_browse() Change return to continue, so it doesn't just 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... --- src/device.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index ef3a5faa..a1d1575e 100644 --- a/src/device.c +++ b/src/device.c @@ -1023,10 +1023,25 @@ 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; + continue; uuid = g_strdup(driver->uuids[i]); req->uuids = g_slist_append(req->uuids, uuid); -- cgit