[RFC BlueZ 1/2] avdtp: Fix connecting using streaming mode with signalling channel

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

 



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

Signalling channel shall only use Basic or ERTM modes.
---
 profiles/audio/avdtp.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 16fa20bba..619b94e29 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2429,20 +2429,13 @@ uint16_t avdtp_get_version(struct avdtp *session)
 	return session->version;
 }
 
-static GIOChannel *l2cap_connect(struct avdtp *session)
+static GIOChannel *l2cap_connect(struct avdtp *session, BtIOMode mode)
 {
 	GError *err = NULL;
 	GIOChannel *io;
 	const bdaddr_t *src;
-	BtIOMode mode;
-
 	src = btd_adapter_get_address(device_get_adapter(session->device));
 
-	if (btd_opts.mps == MPS_OFF)
-		mode = BT_IO_MODE_BASIC;
-	else
-		mode = BT_IO_MODE_STREAMING;
-
 	if (session->phy)
 		io = bt_io_connect(avdtp_connect_cb, session,
 					NULL, &err,
@@ -2610,7 +2603,14 @@ static int send_req(struct avdtp *session, gboolean priority,
 	int err, timeout;
 
 	if (session->state == AVDTP_SESSION_STATE_DISCONNECTED) {
-		session->io = l2cap_connect(session);
+		BtIOMode mode;
+
+		if (btd_opts.mps == MPS_OFF)
+			mode = BT_IO_MODE_BASIC;
+		else
+			mode = BT_IO_MODE_ERTM;
+
+		session->io = l2cap_connect(session, mode);
 		if (!session->io) {
 			/* Report disconnection anyways, as the other layers
 			 * are using this state for cleanup.
@@ -2807,8 +2807,14 @@ static gboolean avdtp_open_resp(struct avdtp *session, struct avdtp_stream *stre
 				struct seid_rej *resp, int size)
 {
 	struct avdtp_local_sep *sep = stream->lsep;
+	BtIOMode mode;
+
+	if (btd_opts.mps == MPS_OFF)
+		mode = BT_IO_MODE_BASIC;
+	else
+		mode = BT_IO_MODE_STREAMING;
 
-	stream->io = l2cap_connect(session);
+	stream->io = l2cap_connect(session, mode);
 	if (!stream->io) {
 		avdtp_sep_set_state(session, sep, AVDTP_STATE_IDLE);
 		return FALSE;
-- 
2.26.2




[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