From 88b983baf17c1ad5895cacfab1e6f57b0cf8cf0f Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 12 Jul 2023 18:11:20 -0700 Subject: [PATCH] lib.sh: add get_ldc_subdir() that follows /sys/module/snd_sof_pci/parameters/fw_path We need to follow the /sys/module/snd_sof_pci/parameters/fw_path flexibility to test the firmware as whole /lib/firmware package and to stop copying files into /etc/sof/ Signed-off-by: Marc Herbert --- case-lib/lib.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/case-lib/lib.sh b/case-lib/lib.sh index 6318a53e..ea46c56d 100644 --- a/case-lib/lib.sh +++ b/case-lib/lib.sh @@ -290,7 +290,23 @@ fake_kern_error() } -# Prints the .ldc file found on stdout, errors on stderr. +get_ldc_subdir() +{ + local subdir='intel/sof' # default + if test -e /sys/module/snd_sof_pci/parameters/fw_path; then + local fw_path + fw_path=$(cat /sys/module/snd_sof_pci/parameters/fw_path) + if [ "$fw_path" != '(null)' ]; then + subdir=${fw_path%/} # strip any trailing slash + subdir=${subdir%/community} + subdir=${subdir%/intel-signed} + subdir=${subdir%/dbgkey} + fi + fi + printf '%s' "$subdir" +} + +# Prints the .ldc file found on stdout, logs on stderr. find_ldc_file() { local ldcFile @@ -306,8 +322,10 @@ find_ldc_file() return 1 } ldcFile=/etc/sof/sof-"$platf".ldc - [ -e "$ldcFile" ] || - ldcFile=/lib/firmware/intel/sof/sof-"$platf".ldc + [ -e "$ldcFile" ] || { + local subdir; subdir=$(get_ldc_subdir) + ldcFile=/lib/firmware/"${subdir}"/sof-"$platf".ldc + } fi [[ -e "$ldcFile" ]] || {