summaryrefslogtreecommitdiffstats
path: root/bin/4a-status
blob: 519f470ef73e523ec45bb10b1235fdd3e9535bb5 (plain)
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
#!/bin/bash

set -o pipefail

ERR="\\e[31mERROR\\e[0m"
WRN="\\e[33mWARNING\\e[0m"
SUC="\\e[32mSUCCESS\\e[0m"

function cout {
	echo -e "$*"
}

EXIT_CODE=0

SOUND_CARDS=$( LANG="C" aplay -l | grep -oEe "^card\\s+[^\\[]+" | cut -d':' -f2 | uniq )

cout " -- Is snd-aloop is available?"
if zcat /proc/config.gz | grep "CONFIG_SND_ALOOP=y" > /dev/null; then
	cout "     -- $SUC: Built into the kernel"
else
	cout "     -- $WRN: Not built into the kernel, devices order can randomly change!"
	if zcat /proc/config.gz | grep "CONFIG_SND_ALOOP=m" > /dev/null; then
		cout "     -- $SUC: snd-aloop is provided!"
		if lsmod | grep "snd_aloop" > /dev/null; then
			cout "     -- $SUC: snd-aloop is loaded!"
		else
			cout "     -- $ERR: snd-aloop is not loaded! 4a-softmixer can't work, please load it using: modprobe snd-aloop"
		fi
	else
		cout "     -- $ERR: snd-aloop is not provided at all, 4a-softmixer can't work!"
		EXIT_CODE=1
	fi
fi

cout " -- Is 4a running?"
if ps x | grep "service-audio-4a" | grep -v "grep" > /dev/null; then
	cout "     -- $SUC: Service is currently running!"
else
	cout "     -- $WRN: Service is not currently running!"
fi


#SERVICE_FILE=$( basename "$( ls "/var/local/lib/systemd/system/afm-service-agl-service-audio-4a--"* )" )

cout
cout "Found audio cards:"
for card in $SOUND_CARDS; do
	cout "    - $card"
done

exit $EXIT_CODE