Skip to content

Commit 172d5a1

Browse files
ranj063marc-hb
authored andcommitted
tools: tplgtool2: Fix array size calculation for enum values
Compute the max name length in terms of number of int32's and use that set the values array size for parsing the enum controls properly. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 79a9634 commit 172d5a1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/tplgtool2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ def __init__(self):
316316
self._hw_config_max = 8 # SND_SOC_TPLG_HW_CONFIG_MAX
317317
self._tlv_size = 32 # SND_SOC_TPLG_TLV_SIZE
318318
self._id_name_maxlen = 44 # SNDRV_CTL_ELEM_ID_NAME_MAXLEN
319+
self._id_name_maxint32 = 44 // 4
319320
self._num_texts = 16 # SND_SOC_TPLG_NUM_TEXTS
320321

321322
self._block_header = Struct( # snd_soc_tplg_hdr
@@ -472,7 +473,7 @@ def __init__(self):
472473
"mask" / Int32ul,
473474
"count" / Int32ul,
474475
"texts" / Array(self._num_texts, String(self._id_name_maxlen, "ascii")),
475-
"values" / Array(self._num_texts * self._id_name_maxlen / 4, Int32ul),
476+
"values" / Array(self._num_texts * self._id_name_maxint32, Int32ul),
476477
"priv" / self._private_raw,
477478
)
478479
self._bytes_control_body = Struct( # `snd_soc_tplg_bytes_control` without `hdr`

0 commit comments

Comments
 (0)