All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] AVRCP: fix loop over number of application settings
@ 2011-10-04  2:56 Lucas De Marchi
  2011-10-04 18:59 ` Lucas De Marchi
  2011-10-05 15:30 ` Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Lucas De Marchi @ 2011-10-04  2:56 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Lucas De Marchi

---

Hi, Luiz,

I applied this patch on top of yours. If you are able to test the "set_player_value"
at UPF, please apply this patch first.


Regards,

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

diff --git a/audio/avrcp.c b/audio/avrcp.c
index cfdb313..6969fac 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -719,6 +719,7 @@ static uint8_t avrcp_handle_set_player_value(struct avrcp_player *player,
 	if (len <= 3)
 		goto err;
 
+	DBG("len %u", len);
 	len = 0;
 
 	/*
@@ -728,13 +729,14 @@ static uint8_t avrcp_handle_set_player_value(struct avrcp_player *player,
 	 * attribute is valid, we respond with no parameters. Otherwise an
 	 * E_INVALID_PARAM is sent.
 	 */
-	for (i = 1; i < pdu->params[0]; i += 2) {
+	for (i = 1; i < (2 * pdu->params[0] + 1U); i += 2) {
 		uint8_t attr = pdu->params[i];
 		uint8_t val = pdu->params[i + 1];
 
 		if (player_set_attribute(player, attr, val) < 0)
 			continue;
 
+		DBG("set attr %u val %u", attr, val);
 		len++;
 	}
 
-- 
1.7.6.4


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

* Re: [PATCH] AVRCP: fix loop over number of application settings
  2011-10-04  2:56 [PATCH] AVRCP: fix loop over number of application settings Lucas De Marchi
@ 2011-10-04 18:59 ` Lucas De Marchi
  2011-10-05 15:30 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2011-10-04 18:59 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, Johan Hedberg; +Cc: linux-bluetooth, Lucas De Marchi

Hi

On Mon, Oct 3, 2011 at 11:56 PM, Lucas De Marchi
<lucas.demarchi@profusion.mobi> wrote:
> ---
>
> Hi, Luiz,
>
> I applied this patch on top of yours. If you are able to test the "set_player_value"
> at UPF, please apply this patch first.
>
>
> Regards,
>
>  audio/avrcp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)


Johan, please do not apply this patch. I'll provide another one later.

regards,
Lucas De Marchi

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

* Re: [PATCH] AVRCP: fix loop over number of application settings
  2011-10-04  2:56 [PATCH] AVRCP: fix loop over number of application settings Lucas De Marchi
  2011-10-04 18:59 ` Lucas De Marchi
@ 2011-10-05 15:30 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2011-10-05 15:30 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Luiz Augusto von Dentz, linux-bluetooth

Hi Lucas,

On Tue, Oct 4, 2011 at 5:56 AM, Lucas De Marchi
<lucas.demarchi@profusion.mobi> wrote:
> ---
>
> Hi, Luiz,
>
> I applied this patch on top of yours. If you are able to test the "set_player_value"
> at UPF, please apply this patch first.
>
>
> Regards,
>
>  audio/avrcp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/audio/avrcp.c b/audio/avrcp.c
> index cfdb313..6969fac 100644
> --- a/audio/avrcp.c
> +++ b/audio/avrcp.c
> @@ -719,6 +719,7 @@ static uint8_t avrcp_handle_set_player_value(struct avrcp_player *player,
>        if (len <= 3)
>                goto err;
>
> +       DBG("len %u", len);
>        len = 0;
>
>        /*
> @@ -728,13 +729,14 @@ static uint8_t avrcp_handle_set_player_value(struct avrcp_player *player,
>         * attribute is valid, we respond with no parameters. Otherwise an
>         * E_INVALID_PARAM is sent.
>         */
> -       for (i = 1; i < pdu->params[0]; i += 2) {
> +       for (i = 1; i < (2 * pdu->params[0] + 1U); i += 2) {
>                uint8_t attr = pdu->params[i];
>                uint8_t val = pdu->params[i + 1];
>
>                if (player_set_attribute(player, attr, val) < 0)
>                        continue;
>
> +               DBG("set attr %u val %u", attr, val);
>                len++;
>        }

Maybe we can have an auxiliary pointer to the current params, e.g.
uint8_t *param = &pdu->params[1] and then we increment the actual
pointer without messing around with i which is the number of
attributes.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2011-10-05 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-04  2:56 [PATCH] AVRCP: fix loop over number of application settings Lucas De Marchi
2011-10-04 18:59 ` Lucas De Marchi
2011-10-05 15:30 ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.