[PATCH BlueZ 11/16] AVRCP: Fix reading wrong profile when acting as a controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

The role indicate which record should be read so we properly determine
the version and what features are supported.
---
 audio/avrcp.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index 7188039..8abb426 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -58,6 +58,9 @@
 #include "avrcp.h"
 #include "sdpd.h"
 #include "dbus-common.h"
+#include "control.h"
+#include "avdtp.h"
+#include "sink.h"
 
 /* Company IDs for vendor dependent commands */
 #define IEEEID_BTSIG		0x001958
@@ -181,6 +184,7 @@ struct avrcp {
 	struct avctp *conn;
 	struct audio_device *dev;
 	struct avrcp_player *player;
+	gboolean target;
 	uint16_t version;
 	int features;
 
@@ -1368,7 +1372,20 @@ static struct avrcp *session_create(struct avrcp_server *server,
 
 	server->sessions = g_slist_append(server->sessions, session);
 
-	rec = btd_device_get_record(dev->btd_dev, AVRCP_TARGET_UUID);
+	if (dev->sink && !dev->source)
+		session->target = TRUE;
+	else if (dev->source && !dev->sink)
+		session->target = FALSE;
+	else if (dev->sink && sink_is_active(dev))
+		session->target = TRUE;
+	else
+		session->target = FALSE;
+
+	if (session->target)
+		rec = btd_device_get_record(dev->btd_dev, AVRCP_REMOTE_UUID);
+	else
+		rec = btd_device_get_record(dev->btd_dev, AVRCP_TARGET_UUID);
+
 	if (rec == NULL)
 		return session;
 
-- 
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux