2024-02-29 17:30:40

by Yao Xiao

[permalink] [raw]
Subject: [PATCH BlueZ 1/1] avrcp: Add strict checks for supported events

From: Xiao Yao <[email protected]>

In some resource-limited embedded systems, if the player is not
registered, but the supported event contains the status/track/
settings events that need player support, it will return some
unreasonable values to the peer, which will cause confusion on
the peer device and cause some unknown problems.

In my test scenario, bluez was the role of the source to connect
the bose speaker. bluez could send absolute volume to the bose
speaker, but it could not adjust the volume of bluez. By checking
the btsnoop, we could see that bluez had registered volume change
notification. When I removed the events above, everything worked
fine. I also tested on iPhone/Android and everything worked fine.
---
profiles/audio/avrcp.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 36ce01a14..34fc23306 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -4152,21 +4152,26 @@ static void target_init(struct avrcp *session)

init_volume = media_player_get_device_volume(session->dev);
media_transport_update_device_volume(session->dev, init_volume);
- }

- session->supported_events |= (1 << AVRCP_EVENT_STATUS_CHANGED) |
- (1 << AVRCP_EVENT_TRACK_CHANGED) |
- (1 << AVRCP_EVENT_TRACK_REACHED_START) |
- (1 << AVRCP_EVENT_TRACK_REACHED_END) |
- (1 << AVRCP_EVENT_SETTINGS_CHANGED);
+ /* These events below requires a player */
+ session->supported_events |= (1 << AVRCP_EVENT_STATUS_CHANGED) |
+ (1 << AVRCP_EVENT_TRACK_CHANGED) |
+ (1 << AVRCP_EVENT_TRACK_REACHED_START) |
+ (1 << AVRCP_EVENT_TRACK_REACHED_END) |
+ (1 << AVRCP_EVENT_SETTINGS_CHANGED);

- if (target->version < 0x0104)
- return;
+ if (target->version < 0x0104)
+ return;

- session->supported_events |=
+ session->supported_events |=
(1 << AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED) |
(1 << AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED) |
(1 << AVRCP_EVENT_VOLUME_CHANGED);
+ } else {
+ if (target->version > 0x0103)
+ session->supported_events =
+ (1 << AVRCP_EVENT_VOLUME_CHANGED);
+ }

/* Only check capabilities if controller is not supported */
if (session->controller == NULL)
--
2.34.1



2024-02-29 18:06:20

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,1/1] avrcp: Add strict checks for supported events

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=831186

---Test result---

Test Summary:
CheckPatch PASS 0.45 seconds
GitLint PASS 0.31 seconds
BuildEll PASS 23.86 seconds
BluezMake PASS 714.52 seconds
MakeCheck PASS 11.47 seconds
MakeDistcheck PASS 162.63 seconds
CheckValgrind PASS 227.31 seconds
CheckSmatch PASS 329.91 seconds
bluezmakeextell PASS 106.94 seconds
IncrementalBuild PASS 671.86 seconds
ScanBuild PASS 945.34 seconds



---
Regards,
Linux Bluetooth