Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/4] android/arvrcp: Fix not parsing SDP record correctly
Date: Thu,  6 Mar 2014 15:03:22 +0200	[thread overview]
Message-ID: <1394111003-2396-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1394111003-2396-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 android/avrcp.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/android/avrcp.c b/android/avrcp.c
index d5eb31d..ce636c0 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -25,6 +25,7 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <stdbool.h>
 #include <errno.h>
 #include <glib.h>
@@ -68,7 +69,7 @@ struct avrcp_request {
 struct avrcp_device {
 	bdaddr_t	dst;
 	uint16_t	version;
-	uint16_t	features;
+	int		features;
 	struct avrcp	*session;
 	GIOChannel	*io;
 	GQueue		*queue;
@@ -817,15 +818,19 @@ static void search_cb(sdp_list_t *recs, int err, gpointer data)
 
 	for (list = recs; list; list = list->next) {
 		sdp_record_t *rec = list->data;
-		sdp_data_t *data;
+		sdp_list_t *l;
+		sdp_profile_desc_t *desc;
 
-		data = sdp_data_get(rec, SDP_ATTR_VERSION);
-		if (data)
-			dev->version = data->val.uint16;
+		if (sdp_get_profile_descs(rec, &l) < 0)
+			continue;
 
-		data = sdp_data_get(rec, SDP_ATTR_SUPPORTED_FEATURES);
-		if (data)
-			dev->features = data->val.uint16;
+		desc = l->data;
+		dev->version = desc->version;
+
+		sdp_get_int_attr(rec, SDP_ATTR_SUPPORTED_FEATURES,
+							&dev->features);
+		sdp_list_free(l, free);
+		break;
 	}
 
 	if (dev->io) {
-- 
1.8.5.3


  parent reply	other threads:[~2014-03-06 13:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 13:03 [PATCH BlueZ 1/4] android/avrcp: Add remote features notification Luiz Augusto von Dentz
2014-03-06 13:03 ` [PATCH BlueZ 2/4] android/client: Add AVRCP remote_features_cb support Luiz Augusto von Dentz
2014-03-06 13:03 ` Luiz Augusto von Dentz [this message]
2014-03-06 13:03 ` [PATCH BlueZ 4/4] android/avrcp: Fix warnings when freeing avrcp_device struct Luiz Augusto von Dentz

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=1394111003-2396-3-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --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