Skip to contentSkip to conversation

AVRCP: Fix not registering to VolumeChanged event again when notified

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages May 28, 2012 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/1 AVRCP: Fix not registering to VolumeChanged event again when notified

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

The spec says:

"A registered notification gets changed on receiving CHANGED event notification. For a new notification additional NOTIFY command is expected to be sent."
---
v2: Fix check to do logical AND not OR

 audio/avrcp.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
audio/avrcp.c +8 -1
index 131490f..a040099 100644
@@ -177,6 +177,8 @@ static uint32_t company_ids[] = {
 	IEEEID_BTSIG,
 };
 
+static void register_volume_notification(struct avrcp_player *player);
+
 static sdp_record_t *avrcp_ct_record(void)
 {
 	sdp_list_t *svclass_id, *pfseq, *apseq, *root;
@@ -1148,13 +1150,18 @@ static gboolean avrcp_handle_volume_changed(struct avctp *session,
 	struct avrcp_header *pdu = (void *) operands;
 	uint8_t volume;
 
-	if (code == AVC_CTYPE_REJECTED || code == AVC_CTYPE_NOT_IMPLEMENTED)
+	if (code != AVC_CTYPE_INTERIM && code != AVC_CTYPE_CHANGED)
 		return FALSE;
 
 	volume = pdu->params[1] & 0x7F;
 
 	player->cb->set_volume(volume, player->dev, player->user_data);
 
+	if (code == AVC_CTYPE_CHANGED) {
+		register_volume_notification(player);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 35 lines · Luiz Augusto von Dentz

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

The spec says:

"A registered notification gets changed on receiving CHANGED event notification. For a new notification additional NOTIFY command is expected to be sent."
---
v2: Fix check to do logical AND not OR

 audio/avrcp.c |    9 ++++++++-

 1 files changed, 8 insertions(+), 1 deletions(-)
audio/avrcp.c +3 -1
index 131490f..a040099 100644
@@ -177,6 +177,8 @@ static uint32_t company_ids[] = {
        IEEEID_BTSIG,
  };
 
+static void register_volume_notification(struct avrcp_player *player);
+
  static sdp_record_t *avrcp_ct_record(void)
  {
        sdp_list_t *svclass_id, *pfseq, *apseq, *root;
@@ -1148,13 +1150,18 @@ static gboolean avrcp_handle_volume_changed(struct avctp *session,
        struct avrcp_header *pdu = (void *) operands;
        uint8_t volume;
 
-       if (code == AVC_CTYPE_REJECTED || code == AVC_CTYPE_NOT_IMPLEMENTED)
+       if (code != AVC_CTYPE_INTERIM && code != AVC_CTYPE_CHANGED)
                return FALSE;
 
        volume = pdu->params[1] & 0x7F;

audio/avrcp.c static gboolean avrcp_handle_volume_changed(struct avctp *session, · line 1166

Quoted 10 lines
audio/avrcp.c +5 -0
 
        player->cb->set_volume(volume, player->dev, player->user_data);
 
+       if (code == AVC_CTYPE_CHANGED) {
+               register_volume_notification(player);
+               return FALSE;
+       }
+
        return TRUE;
  }

Ack.

Lucas De Marchi

#2 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 4 lines · Luiz Augusto von Dentz

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

The spec says:

Quoted 8 lines

"A registered notification gets changed on receiving CHANGED event notification. For a new notification additional NOTIFY command is expected to be sent."
---
v2: Fix check to do logical AND not OR

 audio/avrcp.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan