Skip to contentSkip to conversation

avctp: Fix not handling when kernel has ERTM disabled

PATCH In review Luiz Augusto von Dentz 2 participants 4 messages Sep 24, 2021 – Sep 27, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 avctp: Fix not handling when kernel has ERTM disabled

From: Luiz Augusto von Dentz <[email protected]>

If kernel module is loaded with disable_ertm ERTM won't be available thus browsing channel won't be able to be created, but it shall be possible to still use AVRCP without it.

---
 profiles/audio/avctp.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
profiles/audio/avctp.c +5 -12
index 702ded136..81320de1b 100644
@@ -1651,15 +1651,6 @@ int avctp_register(struct btd_adapter *adapter, gboolean central)
 	}
 	server->browsing_io = avctp_server_socket(src, central, BT_IO_MODE_ERTM,
 							AVCTP_BROWSING_PSM);
-	if (!server->browsing_io) {
-		if (server->control_io) {
-			g_io_channel_shutdown(server->control_io, TRUE, NULL);
-			g_io_channel_unref(server->control_io);
-			server->control_io = NULL;
-		}
-		g_free(server);
-		return -1;
-	}
 
 	server->adapter = btd_adapter_ref(adapter);
 
@@ -1681,9 +1672,11 @@ void avctp_unregister(struct btd_adapter *adapter)
 
 	servers = g_slist_remove(servers, server);
 
-	g_io_channel_shutdown(server->browsing_io, TRUE, NULL);
-	g_io_channel_unref(server->browsing_io);
-	server->browsing_io = NULL;
+	if (server->browsing_io) {
+		g_io_channel_shutdown(server->browsing_io, TRUE, NULL);
+		g_io_channel_unref(server->browsing_io);
+		server->browsing_io = NULL;
+	}
 
 	g_io_channel_shutdown(server->control_io, TRUE, NULL);
 	g_io_channel_unref(server->control_io);
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 2/2 avrcp: Fix browsing support in SDP record

From: Luiz Augusto von Dentz <[email protected]>

Browsing features shall only be marked as supported when ERTM is also available.

---
 profiles/audio/avctp.c |   5 +-
 profiles/audio/avctp.h |   2 +-
 profiles/audio/avrcp.c | 101 +++++++++++++++++++++--------------------
 3 files changed, 57 insertions(+), 51 deletions(-)
profiles/audio/avctp.c +4 -1
index 81320de1b..72509edec 100644
@@ -1636,7 +1636,7 @@ static GIOChannel *avctp_server_socket(const bdaddr_t *src, gboolean central,
 	return io;
 }
 
-int avctp_register(struct btd_adapter *adapter, gboolean central)
+int avctp_register(struct btd_adapter *adapter, bool central, bool *browsing)
 {
 	struct avctp_server *server;
 	const bdaddr_t *src = btd_adapter_get_address(adapter);
@@ -1649,8 +1649,11 @@ int avctp_register(struct btd_adapter *adapter, gboolean central)
 		g_free(server);
 		return -1;
 	}
+
 	server->browsing_io = avctp_server_socket(src, central, BT_IO_MODE_ERTM,
 							AVCTP_BROWSING_PSM);
+	if (browsing)
+		*browsing = server->browsing_io ? true : false;
 
 	server->adapter = btd_adapter_ref(adapter);
 
profiles/audio/avctp.h +1 -1
index ca5ff9126..02712bf0e 100644
@@ -145,7 +145,7 @@ unsigned int avctp_add_state_cb(struct btd_device *dev, avctp_state_cb cb,
 							void *user_data);
 gboolean avctp_remove_state_cb(unsigned int id);
 
-int avctp_register(struct btd_adapter *adapter, gboolean central);
+int avctp_register(struct btd_adapter *adapter, bool central, bool *browsing);
 void avctp_unregister(struct btd_adapter *adapter);
 
 struct avctp *avctp_connect(struct btd_device *device);
profiles/audio/avrcp.c +52 -49

191 lines not on this page · raw message

Signature · 1 line
2.31.1
#2 lore raw
In reply to Luiz Augusto von Dentz

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=552627

---Test result---

Test Summary:

CheckPatch                    PASS      3.15 seconds
GitLint                       PASS      4.05 seconds
Prep - Setup ELL              PASS      53.45 seconds
Build - Prep                  PASS      0.52 seconds
Build - Configure             PASS      9.81 seconds
Build - Make                  PASS      238.59 seconds
Make Check                    PASS      9.85 seconds
Make Distcheck                PASS      286.99 seconds
Build w/ext ELL - Configure   PASS      10.04 seconds
Build w/ext ELL - Make        PASS      227.25 seconds

---
Regards,
Linux Bluetooth

author maintainer
#3 lore raw

Hi,

Quoted 25 lines · On Fri, Sep 24, 2021 at 2:35 PM <[email protected]> wrote:

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=552627

---Test result---

Test Summary:

CheckPatch                    PASS      3.15 seconds
GitLint                       PASS      4.05 seconds
Prep - Setup ELL              PASS      53.45 seconds
Build - Prep                  PASS      0.52 seconds
Build - Configure             PASS      9.81 seconds
Build - Make                  PASS      238.59 seconds
Make Check                    PASS      9.85 seconds
Make Distcheck                PASS      286.99 seconds
Build w/ext ELL - Configure   PASS      10.04 seconds
Build w/ext ELL - Make        PASS      227.25 seconds
Quoted 3 lines

---
Regards,
Linux Bluetooth

Pushed.

Signature · 1 line
Luiz Augusto von Dentz