@@ -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)
From: Xiao Yao <xiaoyao@rock-chips.com> 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(-)