public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix duplicate characteristics
@ 2011-01-20 13:27 Bruna Moreira
  2011-01-21  6:46 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Bruna Moreira @ 2011-01-20 13:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bruna Moreira

The Discover() operation (from DBus API) was registering the same
characteristics after running several times. This can be checked using
test-attrib.
---
 attrib/client.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index 767d1c1..44638d3 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -870,6 +870,13 @@ static void char_discovered_cb(GSList *characteristics, guint8 status,
 	for (l = characteristics; l; l = l->next) {
 		struct att_char *current_chr = l->data;
 		struct characteristic *chr;
+		guint handle = current_chr->value_handle;
+		GSList *lchr;
+
+		lchr = g_slist_find_custom(prim->chars,
+			GUINT_TO_POINTER(handle), characteristic_handle_cmp);
+		if (lchr)
+			continue;
 
 		chr = g_new0(struct characteristic, 1);
 		chr->prim = prim;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-21  6:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 13:27 [PATCH] Fix duplicate characteristics Bruna Moreira
2011-01-21  6:46 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox