aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/client.c
diff options
context:
space:
mode:
authorBruna Moreira <bruna.moreira@openbossa.org>2011-01-20 09:27:47 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2011-01-21 12:15:17 +0530
commit4ca8ed4d504acffa292263eb355e0597f77b1536 (patch)
tree346a8e900d0cf6b9bfab4c2709f1c91a4b0c1ee5 /attrib/client.c
parent48908574c4853023dfe402a120b58a7a7d1f56de (diff)
downloadbluez-4ca8ed4d504acffa292263eb355e0597f77b1536.tar.gz
bluez-4ca8ed4d504acffa292263eb355e0597f77b1536.tar.xz
bluez-4ca8ed4d504acffa292263eb355e0597f77b1536.zip
Fix duplicate characteristics
The Discover() operation (from DBus API) was registering the same characteristics after running several times. This can be checked using test-attrib.
Diffstat (limited to 'attrib/client.c')
-rw-r--r--attrib/client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/attrib/client.c b/attrib/client.c
index 767d1c11..44638d3e 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;