Skip to contentSkip to conversation

avrcp: Fix always requesting player settings for category 1

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

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 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
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 1 line

2.25.3

Please let me know if you are able to test the above patch, it should fix the problem with Senheisers headsets if the are not setting the Player Settings bits this would prevent the command to be send so it doesn't crash.

Signature · 1 line
Luiz Augusto von Dentz
#2 lore raw
Quoted 25 lines · Luiz Augusto von Dentz
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 9 lines
Quoted 3 lines
profiles/audio/avrcp.c +0 -1
         if (!(events & (1 << AVRCP_EVENT_STATUS_CHANGED)))
--

2.25.3

Please let me know if you are able to test the above patch, it should fix the problem with Senheisers headsets if the are not setting the Player Settings bits this would prevent the command to be send so it doesn't crash.

I'll try it with Momentum True Wireless 2 tomorrow.

#3 lore raw
Quoted 38 lines · Andrey Semashev
Quoted 27 lines · Luiz Augusto von Dentz
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 +1 -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 9 lines
Quoted 3 lines

         if (!(events & (1 << AVRCP_EVENT_STATUS_CHANGED)))

Signature · 1 line
2.25.3

Please let me know if you are able to test the above patch, it should fix the problem with Senheisers headsets if the are not setting the Player Settings bits this would prevent the command to be send so it doesn't crash.

Quoted 1 line

I'll try it with Momentum True Wireless 2 tomorrow.

The headset still reboots while trying to connect, although now it reboots after receiving AVRCP GetPlayStatus.

I'm attaching packet dumps in btsnoop and pcap formats.

#4 lore raw
In reply to Luiz Augusto von Dentz
Quoted 25 lines · Luiz Augusto von Dentz
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 9 lines
Quoted 3 lines
profiles/audio/avrcp.c +0 -1
         if (!(events & (1 << AVRCP_EVENT_STATUS_CHANGED)))
--

2.25.3

Please let me know if you are able to test the above patch, it should fix the problem with Senheisers headsets if the are not setting the Player Settings bits this would prevent the command to be send so it doesn't crash.

I'll try it with Momentum True Wireless 2 tomorrow.