Skip to content

Commit b1d1404

Browse files
committed
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 <marc.herbert@intel.com>
1 parent 1e88c23 commit b1d1404

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

case-lib/lib.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,22 @@ fake_kern_error()
290290

291291
}
292292

293-
# Prints the .ldc file found on stdout, errors on stderr.
293+
get_ldc_subdir()
294+
{
295+
local subdir='intel/sof' # default
296+
if test -e /sys/module/snd_sof_pci/parameters/fw_path; then
297+
local fw_path
298+
fw_path=$(cat /sys/module/snd_sof_pci/parameters/fw_path)
299+
if [ "$fw_path" != '(null)' ]; then
300+
subdir=${fw_path%/} # strip any trailing slash
301+
subdir=${subdir%/community}
302+
subdir=${subdir%/intel-signed}
303+
fi
304+
fi
305+
printf '%s' "$subdir"
306+
}
307+
308+
# Prints the .ldc file found on stdout, logs on stderr.
294309
find_ldc_file()
295310
{
296311
local ldcFile
@@ -306,8 +321,10 @@ find_ldc_file()
306321
return 1
307322
}
308323
ldcFile=/etc/sof/sof-"$platf".ldc
309-
[ -e "$ldcFile" ] ||
310-
ldcFile=/lib/firmware/intel/sof/sof-"$platf".ldc
324+
[ -e "$ldcFile" ] || {
325+
local subdir; subdir=$(get_ldc_subdir)
326+
ldcFile=/lib/firmware/"${subdir}"/sof-"$platf".ldc
327+
}
311328
fi
312329

313330
[[ -e "$ldcFile" ]] || {

0 commit comments

Comments
 (0)