Re: [PATCH BlueZ] AVCTP: return not-implemented for unknown passthrough

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

 



Hi Ram,

On Tue, Feb 28, 2012 at 12:40 PM, Malovany, Ram <ramm@xxxxxx> wrote:
> Hi Lucas
>
>> -----Original Message-----
>> From: linux-bluetooth-owner@xxxxxxxxxxxxxxx [mailto:linux-bluetooth-
>> owner@xxxxxxxxxxxxxxx] On Behalf Of Lucas De Marchi
>> Sent: Tuesday, February 28, 2012 4:20 PM
>> To: linux-bluetooth@xxxxxxxxxxxxxxx
>> Cc: luiz.dentz@xxxxxxxxx; sunil.a.kumar@xxxxxxxxx; rashmi.g.nair@xxxxxxxxx;
>> prashant.khanzode@xxxxxxxxx; luiz.von.dentz@xxxxxxxxx; Lucas De Marchi
>> Subject: [PATCH BlueZ] AVCTP: return not-implemented for unknown passthrough
>>
>> ---
>>  audio/avctp.c |    5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/audio/avctp.c b/audio/avctp.c
>> index 5bd5db1..1d425eb 100644
>> --- a/audio/avctp.c
>> +++ b/audio/avctp.c
>> @@ -235,9 +235,12 @@ static size_t handle_panel_passthrough(struct avctp
>> *session,
>>               break;
>>       }
>>
>> -     if (key_map[i].name == NULL)
>> +     if (key_map[i].name == NULL) {
>>               DBG("AV/C: unknown button 0x%02X %s",
>>                                               operands[0] & 0x7F, status);
>> +             *code = AVC_CTYPE_NOT_IMPLEMENTED;
>> +             return 0;
>
> This line here is problematic in the current implementation you will reply with the wrong values at the AVRCP respond packet , when returning 0 you will truncated the Operands( State Flag , Operation Id and Operation Data Length) from the AVRCP reply.
> You need to return with the operand_count this way you will include the full response at the AVRCP profile.

I'm truncating on purpose. AFAIR not-implemented responses have no
operands. See session_cb() function:

	packet_size = AVCTP_HEADER_LENGTH + AVC_HEADER_LENGTH;
	avctp->cr = AVCTP_RESPONSE;

	if (avctp->packet_type != AVCTP_PACKET_SINGLE) {
		avc->code = AVC_CTYPE_NOT_IMPLEMENTED;
		goto done;
	}

...

done:
	ret = write(sock, buf, packet_size);
	if (ret != packet_size)
		goto failed;

	return TRUE;


Lucas De Marchi
--
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