public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Bruna Moreira <bruna.moreira@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Bruna Moreira <bruna.moreira@openbossa.org>
Subject: [PATCH] Fix duplicate characteristics
Date: Thu, 20 Jan 2011 09:27:47 -0400	[thread overview]
Message-ID: <1295530067-6022-1-git-send-email-bruna.moreira@openbossa.org> (raw)

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


             reply	other threads:[~2011-01-20 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-20 13:27 Bruna Moreira [this message]
2011-01-21  6:46 ` [PATCH] Fix duplicate characteristics Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295530067-6022-1-git-send-email-bruna.moreira@openbossa.org \
    --to=bruna.moreira@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox