From eefdb359dc0e377186b01b17baad434e45c3d8aa Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Mon, 28 May 2012 23:45:48 +0300 Subject: [PATCH] attrib-server: allow SDP records for secondary GATT services It seems this is the correct way to discover such services that work over BR/EDR (according to section 4.4 in the GATT specification). --- src/attrib-server.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/attrib-server.c b/src/attrib-server.c index a6262d096..d2a252099 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -258,8 +258,8 @@ static int attribute_cmp(gconstpointer a1, gconstpointer a2) return attrib1->handle - attrib2->handle; } -static struct attribute *find_primary_range(struct gatt_server *server, - uint16_t start, uint16_t *end) +static struct attribute *find_svc_range(struct gatt_server *server, + uint16_t start, uint16_t *end) { struct attribute *attrib; guint h = start; @@ -275,7 +275,8 @@ static struct attribute *find_primary_range(struct gatt_server *server, attrib = l->data; - if (bt_uuid_cmp(&attrib->uuid, &prim_uuid) != 0) + if (bt_uuid_cmp(&attrib->uuid, &prim_uuid) != 0 && + bt_uuid_cmp(&attrib->uuid, &snd_uuid) != 0) return NULL; *end = start; @@ -302,7 +303,7 @@ static uint32_t attrib_create_sdp_new(struct gatt_server *server, uuid_t svc, gap_uuid; bdaddr_t addr; - a = find_primary_range(server, handle, &end); + a = find_svc_range(server, handle, &end); if (a == NULL) return 0; -- 2.47.3