diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2008-09-12 19:42:06 -0700 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-09-12 19:49:27 -0700 |
commit | 0144612a3d800c5d657cf141634f6b6cd47b4128 (patch) | |
tree | 040d2b6b5213d820062c1db3a8528a016620c975 | |
parent | 7d3301934f1b30d90646c97f40464ed198be91d3 (diff) |
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...
-rw-r--r-- | src/device.c | 19 |
1 files 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); |