From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ucm: add cset-tlv command Date: Wed, 23 Mar 2016 10:21:22 +0100 Message-ID: References: <1458637834-15947-1-git-send-email-hychao@chromium.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id CECBB2657E5 for ; Wed, 23 Mar 2016 10:21:22 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Hsin-yu Chao Cc: "Koul, Vinod" , alsa-devel@alsa-project.org, Dylan Reid List-Id: alsa-devel@alsa-project.org On Wed, 23 Mar 2016 10:15:21 +0100, Hsin-yu Chao wrote: > > On Tue, Mar 22, 2016 at 7:48 PM, Takashi Iwai wrote: > > On Tue, 22 Mar 2016 10:10:34 +0100, > > Hsin-Yu Chao wrote: > >> > >> This patch enables UCM to set a file in TLV format to kcontrol by: > >> cset-tlv "name='' " > >> This new 'cset-tlv' command will be used to write audio DSP to > >> specific alsa control, where the driver expectes a file in TLV > >> format. > >> > >> Signed-off-by: Hsin-Yu Chao > > > > One problem in this approach is that the provided TLV data file isn't > > portable. Since we deal TLV as int arrays, it's endian-sensitive. > > At least, some endian check would be needed. > Thanks for the review. I think by extracting the length attribute (i.e > tlv[1]) and compare it with the file size is sufficient here, since > there is no way to figure out the endianness of the binary file passed > in. Yeah, that should be good enough. > Also I agree that additional check for crazy large or small file is > necessary. According to the dsp files I test with, I'll set the tlv > file size limit to between 8 bytes and 1MB. I guess the size will grow quickly in near future, so it'd be safer to take a bit bigger. thanks, Takashi