Skip to contentSkip to conversation

avrcp: Fix always requesting player settings for category 1

PATCH Applied Luiz Augusto von Dentz 2 participants 5 messages May 28, 2020 – May 29, 2020 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v3 1/2 avrcp: Fix always requesting player settings for category 1

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

Player Application settings is not mandatory for category 1 so instead of always listing the settings the code now checks if AVRCP_FEATURE_PLAYER_SETTINGS is enabled.

---
 profiles/audio/avrcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
profiles/audio/avrcp.c +2 -1
index 773ccdb60..75811bf98 100644
@@ -3814,7 +3814,8 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,
 	if (!session->controller || !session->controller->player)
 		return FALSE;
 
-	if (!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
+	if ((session->controller->features & AVRCP_FEATURE_PLAYER_SETTINGS) &&
+			!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
 		avrcp_list_player_attributes(session);
 
 	if (!(events & (1 << AVRCP_EVENT_STATUS_CHANGED)))
Signature · 1 line
2.25.3
author maintainer
#1 lore raw

PATCH v3 2/2 avrcp: Don't attempt to load settings if on volume changed is supported

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

If only volume changed is supported that means the player cannot really indicate track/metadata changes so don't attempt to read them.

---
 profiles/audio/avrcp.c | 4 ++++
 1 file changed, 4 insertions(+)
profiles/audio/avrcp.c +4 -0
index 75811bf98..8b3debe46 100644
@@ -3814,6 +3814,10 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,
 	if (!session->controller || !session->controller->player)
 		return FALSE;
 
+	/* Skip if player status/metadata if only volume changes is supported */
+	if (events == (1 << AVRCP_EVENT_VOLUME_CHANGED))
+		return FALSE;
+
 	if ((session->controller->features & AVRCP_FEATURE_PLAYER_SETTINGS) &&
 			!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
 		avrcp_list_player_attributes(session);
Signature · 1 line
2.25.3
#2 lore raw

Re: [PATCH v3 2/2] avrcp: Don't attempt to load settings if on volume changed is supported

Quoted 14 lines · Luiz Augusto von Dentz

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

If only volume changed is supported that means the player cannot really indicate track/metadata changes so don't attempt to read them.

---
  profiles/audio/avrcp.c | 4 ++++
  1 file changed, 4 insertions(+)
profiles/audio/avrcp.c +0 -0
index 75811bf98..8b3debe46 100644

profiles/audio/avrcp.c static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code, · line 3823

Quoted 10 lines
profiles/audio/avrcp.c +4 -0
@@ -3814,6 +3814,10 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,
  	if (!session->controller || !session->controller->player)
  		return FALSE;
 
+	/* Skip if player status/metadata if only volume changes is supported */
+	if (events == (1 << AVRCP_EVENT_VOLUME_CHANGED))
+		return FALSE;
+
  	if ((session->controller->features & AVRCP_FEATURE_PLAYER_SETTINGS) &&
  			!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
  		avrcp_list_player_attributes(session);

This patchset works, MTW2 is able to connect and play audio. Many thanks!

author maintainer Applied
#3 lore raw
In reply to Luiz Augusto von Dentz

Hi,

Quoted 25 lines · Luiz Augusto von Dentz

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

Player Application settings is not mandatory for category 1 so instead of always listing the settings the code now checks if AVRCP_FEATURE_PLAYER_SETTINGS is enabled.

---
 profiles/audio/avrcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
profiles/audio/avrcp.c +2 -2
index 773ccdb60..75811bf98 100644
@@ -3814,7 +3814,8 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,
        if (!session->controller || !session->controller->player)
                return FALSE;
 
-       if (!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
+       if ((session->controller->features & AVRCP_FEATURE_PLAYER_SETTINGS) &&
+                       !(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
                avrcp_list_player_attributes(session);
 
        if (!(events & (1 << AVRCP_EVENT_STATUS_CHANGED)))
--
Quoted 2 lines

2.25.3

Applied.

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw
Quoted 27 lines · Luiz Augusto von Dentz

Hi,

Quoted 23 lines · Luiz Augusto von Dentz

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

Player Application settings is not mandatory for category 1 so instead of always listing the settings the code now checks if AVRCP_FEATURE_PLAYER_SETTINGS is enabled.

---
  profiles/audio/avrcp.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
profiles/audio/avrcp.c +2 -1
index 773ccdb60..75811bf98 100644
@@ -3814,7 +3814,8 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, uint8_t code,
         if (!session->controller || !session->controller->player)
                 return FALSE;
 
-       if (!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
+       if ((session->controller->features & AVRCP_FEATURE_PLAYER_SETTINGS) &&
+                       !(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
                 avrcp_list_player_attributes(session);
 
Quoted 7 lines
Quoted 4 lines
profiles/audio/avrcp.c +0 -1
         if (!(events & (1 << AVRCP_EVENT_STATUS_CHANGED)))
--

2.25.3

Applied.

Thanks. You may want to close https://bugzilla.kernel.org/show_bug.cgi?id=207625.