OSDN Git Service

avrcp: Ignore MSB of Absolute Volume parameter
authorJoão Paulo Rechi Vita <jprvita@openbossa.org>
Fri, 18 Jan 2013 19:25:20 +0000 (16:25 -0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 22 Jan 2013 15:59:27 +0000 (17:59 +0200)
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

index 32062db..4965b0c 100644 (file)
@@ -1399,11 +1399,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)