Re: Input pairing broken again
From: "Luiz Augusto von Dentz" <luiz.dentz@gmail.com>
Date: 2008-09-13 02:46:02
Both seems good, but please use debug instead of printf. Btw does your first patch solves the problem? On Fri, Sep 12, 2008 at 11:38 PM, David Woodhouse [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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
-- Luiz Augusto von Dentz Engenheiro de Computação