On Wed, Mar 23, 2016 at 5:21 PM, Takashi Iwai tiwai@suse.de wrote:
On Wed, 23 Mar 2016 10:15:21 +0100, Hsin-yu Chao wrote:
On Tue, Mar 22, 2016 at 7:48 PM, Takashi Iwai tiwai@suse.de 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='<kcontrol-name>' <path-to-file>" 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 hychao@chromium.org
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.
How about using 16MB as upper limit? DSP file larger than that would take 1 second or more to load through USB 2.0.
Hsin-yu
thanks,
Takashi