|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +# This function will evaluate pipeline parameter related shell code generated by |
| 4 | +# - sof-tplgreader.py (for SOF, pipeline parameters dumped from topology) |
| 5 | +# - sof-dump-status.py (for legacy HDA, pipeline paramters dumped from proc) |
| 6 | +# Args: $1: SOF topology path |
| 7 | +# $2: Pipeline filter in string form |
| 8 | +# Note: for legacy HDA, topology is not present, $1 will be empty. |
3 | 9 | func_pipeline_export() |
4 | 10 | { |
5 | | - # no parameter input the function |
6 | | - if [ $# -lt 1 ]; then |
7 | | - die "Topology file name is not specified, unable to run command: $SCRIPT_NAME" |
| 11 | + |
| 12 | + # function parameter check |
| 13 | + if [ $# -ne 2 ]; then |
| 14 | + die "Not enough parameters, expect two parameters: topology path and pipeline filter" |
8 | 15 | fi |
| 16 | + |
| 17 | + # For legacy HDA platform, there is no topology, we have to export pipeline |
| 18 | + # parameters from proc file system. |
| 19 | + is_sof_used || { |
| 20 | + filter_str="$2" |
| 21 | + dlogi "No SOF sound card found, exporting pipeline parameters from proc file system" |
| 22 | + tmp_pipeline_params=$(mktemp /tmp/pipeline-params.XXXXXXXX) |
| 23 | + sof-dump-status.py -e "$filter_str" > "$tmp_pipeline_params" || |
| 24 | + die "Failed to export pipeline parameters from proc file system" |
| 25 | + # shellcheck disable=SC1090 |
| 26 | + source "$tmp_pipeline_params" || return 1 |
| 27 | + rm "$tmp_pipeline_params" |
| 28 | + return 0 |
| 29 | + } |
| 30 | + |
9 | 31 | # got tplg_file, verify file exist |
10 | 32 | tplg_path=$(func_lib_get_tplg_path "$1") || { |
11 | 33 | die "Topology $1 not found, check the TPLG environment variable or specify topology path with -t" |
|
0 commit comments