Re: [PATCH BlueZ 2/6] AVRCP: Fix not registering to VolumeChanged event again when notified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lucas,

On Fri, May 25, 2012 at 7:17 PM, Lucas De Marchi
<lucas.demarchi@xxxxxxxxxxxxxx> wrote:
> On Fri, May 25, 2012 at 12:02 PM, Luiz Augusto von Dentz
> <luiz.dentz@xxxxxxxxx> wrote:
>> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>>
>> 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."
>> ---
>>  audio/avrcp.c |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/audio/avrcp.c b/audio/avrcp.c
>> index 2f96f27..30d696a 100644
>> --- a/audio/avrcp.c
>> +++ b/audio/avrcp.c
>> @@ -176,6 +176,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;
>> @@ -1154,6 +1156,11 @@ static gboolean avrcp_handle_volume_changed(struct avctp *session,
>>
>>        player->cb->set_volume(volume, player->dev, player->user_data);
>>
>> +       if (code == AVC_CTYPE_CHANGED) {
>
> if code != AVC_CTYPE_CHANGED you shouldn't even set the volume
> above... you need to return early if code is not what it's expecting
> because you can't trust the other side.

I suppose we can do the other way round, just return early if the
response type is not changed or interim. Btw, the purpose of the check
above was for not trigger registration on interim response since that
is already a registration response and we should keep the handler
around in that case for changed response.

-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux