Skip to content

Commit

Permalink
lib.sh: add get_ldc_subdir() that follows /sys/module/snd_sof_pci/par…
Browse files Browse the repository at this point in the history
…ameters/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 <[email protected]>
  • Loading branch information
marc-hb committed Aug 22, 2023
1 parent 7cdf67c commit 88b983b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" ]] || {
Expand Down

0 comments on commit 88b983b

Please sign in to comment.