-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathcheck-userspace-cardinfo.sh
More file actions
executable file
·42 lines (34 loc) · 1.12 KB
/
check-userspace-cardinfo.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
##
## Case Name: check-userspace-cardinfo
## Preconditions:
## N/A
## Description:
## Get the card name from pactl info
## check if there is an available card to do the following tests
## Case step:
## 1. run pactl to get the cards info
## 2. check the card name
## Expect result:
## There is at least one available card for test
##
set -e
# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh
func_opt_parse_option "$@"
setup_kernel_check_point
start_test
save_alsa_state
# check pulseaudio runs properly or not
func_lib_check_pa || die "Please check whether pulseaudio runs correctly or not"
: $((available_card=0))
while read -r card; do
# pactl list cards short format should be like:
# 0 alsa_card.pci-0000_00_1f.3-platform-sof_sdw module-alsa-card.c
dlogi "found card: $(echo "$card" | awk '{print $2}')"
echo "$card" | grep -q -i "usb" || : $((available_card++))
done < <(pactl list cards short)
if [ "$available_card" == "0" ]; then
# TODO: do more check to give hint why there is no available card
die "no available card for test"
fi