linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] AVRCP: Fix not registering to VolumeChanged event again when notified
@ 2012-05-28 11:16 Luiz Augusto von Dentz
  2012-05-28 15:16 ` Lucas De Marchi
  2012-05-28 15:29 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2012-05-28 11:16 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index 131490f..a040099 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -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;
 }
 
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2] AVRCP: Fix not registering to VolumeChanged event again when notified
  2012-05-28 11:16 [PATCH BlueZ v2] AVRCP: Fix not registering to VolumeChanged event again when notified Luiz Augusto von Dentz
@ 2012-05-28 15:16 ` Lucas De Marchi
  2012-05-28 15:29 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2012-05-28 15:16 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

On Mon, May 28, 2012 at 8:16 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> 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(-)
>
> diff --git a/audio/avrcp.c b/audio/avrcp.c
> index 131490f..a040099 100644
> --- a/audio/avrcp.c
> +++ b/audio/avrcp.c
> @@ -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;
>  }

Ack.


Lucas De Marchi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2] AVRCP: Fix not registering to VolumeChanged event again when notified
  2012-05-28 11:16 [PATCH BlueZ v2] AVRCP: Fix not registering to VolumeChanged event again when notified Luiz Augusto von Dentz
  2012-05-28 15:16 ` Lucas De Marchi
@ 2012-05-28 15:29 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-05-28 15:29 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Mon, May 28, 2012, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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(-)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-28 15:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-28 11:16 [PATCH BlueZ v2] AVRCP: Fix not registering to VolumeChanged event again when notified Luiz Augusto von Dentz
2012-05-28 15:16 ` Lucas De Marchi
2012-05-28 15:29 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).