[alsa-devel] [PATCH] test: fix comment about first two fields of TLV data payload

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue Aug 30 08:33:24 CEST 2016


On Aug 30 2016 14:32, Takashi Iwai wrote:
> On Tue, 30 Aug 2016 02:21:45 +0200,
> Takashi Sakamoto wrote:
>>
>> I misunderstand TLV packet structure (struct snd_ctl_tlv) nests in its
>> payload. But actually, the payload stores different type of data.
>>
>> This commit corrects a comment in a test program of user control element
>> set including my misunderstanding.
>>
>> Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
>> ---
>>  test/user-ctl-element-set.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/test/user-ctl-element-set.c b/test/user-ctl-element-set.c
>> index 9b9dc59..f6f050a 100644
>> --- a/test/user-ctl-element-set.c
>> +++ b/test/user-ctl-element-set.c
>> @@ -418,11 +418,11 @@ static int check_tlv(struct elem_set_trial *trial)
>>  	int err;
>>
>>  	/*
>> -	 * See a layout of 'struct snd_ctl_tlv'. I don't know the reason to
>> -	 * construct this buffer with the same layout. It should be abstracted
>> -	 * inner userspace library...
>> +	 * When transferring threshold level information via TLV feature of
>> +	 * ALSA control interface, the first two fields of packet payload
>> +	 * consist of data type and data length.
>>  	 */
>> -	orig[0] = snd_ctl_elem_id_get_numid(trial->id);
>> +	orig[0] = SNDRV_CTL_TLVT_CONTAINER;
>>  	orig[1] = 6 * sizeof(orig[0]);
>>  	orig[2] = 'a';
>>  	orig[3] = 'b';
>
> The container TLV type expects other TLVs as its content.  So the
> above looks buggy to me...

This is a test program just to serve to myself. So I hope this degree of 
roughness is allowed...

Or could you please construct valid TLV array here? I don't exactly know 
the way to do it, because I've never touched better documentation about 
whole design of TLV payload data.


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list