2013-01-18 19:25:20

by Joao Paulo Rechi Vita

[permalink] [raw]
Subject: [PATCH BlueZ] avrcp: Ignore MSB of Absolute Volume parameter

According to the Section 6.13.1 of the AVRCP 1.5 specification document,
the most significant bit of the Absolute Volume parameter is reserved
for future additions, so it should be ignored when parsing parameters of
the SetAbsoluteVolume command. This is also necessary to pass PTS test
TC_TG_VLH_BI_02_C.
---
profiles/audio/avrcp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 636d3e4..237f176 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1398,11 +1398,13 @@ static uint8_t avrcp_handle_set_absolute_volume(struct avrcp *session,
{
struct avrcp_player *player = session->player;
uint16_t len = ntohs(pdu->params_len);
+ uint8_t volume;

if (len != 1)
goto err;

- if (pdu->params[0] > 127)
+ volume = pdu->params[0] & 0x7F;
+ if (volume > 127)
goto err;

if (!player)
--
1.7.11.7



2013-01-22 16:03:52

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ] avrcp: Ignore MSB of Absolute Volume parameter

Hi Joao,

On Fri, Jan 18, 2013 at 9:25 PM, Jo?o Paulo Rechi Vita
<[email protected]> wrote:
> According to the Section 6.13.1 of the AVRCP 1.5 specification document,
> the most significant bit of the Absolute Volume parameter is reserved
> for future additions, so it should be ignored when parsing parameters of
> the SetAbsoluteVolume command. This is also necessary to pass PTS test
> TC_TG_VLH_BI_02_C.
> ---
> profiles/audio/avrcp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
> index 636d3e4..237f176 100644
> --- a/profiles/audio/avrcp.c
> +++ b/profiles/audio/avrcp.c
> @@ -1398,11 +1398,13 @@ static uint8_t avrcp_handle_set_absolute_volume(struct avrcp *session,
> {
> struct avrcp_player *player = session->player;
> uint16_t len = ntohs(pdu->params_len);
> + uint8_t volume;
>
> if (len != 1)
> goto err;
>
> - if (pdu->params[0] > 127)
> + volume = pdu->params[0] & 0x7F;
> + if (volume > 127)
> goto err;
>
> if (!player)
> --
> 1.7.11.7


Patch applied, thanks.


--
Luiz Augusto von Dentz