-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathverify-bootsequence.sh
More file actions
executable file
·60 lines (49 loc) · 1.79 KB
/
verify-bootsequence.sh
File metadata and controls
executable file
·60 lines (49 loc) · 1.79 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
##
## Case Name: verify-bootsequence.sh
## Preconditions:
## UCMv2 is installed in /usr/share/alsa/ucm2 folder
## Description:
## Run alsactl init to test the initialization settings are correct or not
## Case step:
## 1. check the alsa-lib, alsa-utils version
## 2. save the original amixer settings
## 3. run alsactl init
## 4. restore the original amixer settings
## Expect result:
## alsactl init runs successfully
##
set -e
# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh
# shellcheck source=case-lib/user.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/user.sh
# BootSequence is introduced in alsa-utils 1.2.2-16
ALSAUTILS_VER=1.2.2-16
# BootSequence is introduced in alsa-lib 1.2.2-44
ALSALIB_VER=1.2.2-44
# BootSequence is introduced in alsa-ucm-conf 1.2.3-15
ALSAUCM_VER=1.2.3-15
func_opt_parse_option "$@"
setup_kernel_check_point
start_test
save_alsa_state
main()
{
local tmp
dpkg_version_ge "libasound2" "$ALSALIB_VER"
dpkg_version_ge "alsa-utils" "$ALSAUTILS_VER"
dpkg_version_ge "alsa-ucm-conf" "$ALSAUCM_VER" || dlogi "alsa-ucm-conf version is too low"
# alsactl init only applies to SOF card
[[ -n "$SOFCARD" ]] || die "No SOF card"
cardname=$(sof-dump-status.py -s "$SOFCARD") || exit 1
[[ -n "$cardname" ]] || die "Failed to get card $SOFCARD short name"
tmp=$(mktemp -d) || die "Failed to create tmp folder."
cd "$tmp"
dlogi "Indirectly checking the card $cardname UCM2 initial settings (if any) with alsactl init"
alsactl store -f tmp.conf || die "Failed to save the amixer setting"
dlogc "alsactl init $SOFCARD"
alsactl init "$SOFCARD" || die "Failed to run alsactl init"
alsactl restore -f tmp.conf || die "Failed to restore the amixer setting"
}
main "$@"