aboutsummaryrefslogtreecommitdiffstats
path: root/bin/4a-status
blob: c3e361e7f764ce4151342b82b914b41d9956a3bd (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
#!/bin/bash

# load shell lib
. $(dirname $BASH_SOURCE)/lib4a-tools.sh

set -o pipefail

ERR="${color_red}ERROR${color_none}"
WRN="${color_yellow}WARNING${color_none}"
SUC="${color_green}SUCCESS${color_none}"

EXIT_CODE=0

# ------------------- enumerate sound cards ------------------------

log "---- Audio cards detected ----"
LANG="C" aplay -l | grep -oEe "^card\\s+[^\\[]+" | sort -u

# -------------------- snd-aloop ------------------------

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

log ""
log "---- 4a service status ----"
if ps x | grep "service-audio-4a" | grep -v "grep" > /dev/null; then
	log "$SUC: Service is currently running!"
else
	log "$WRN: Service is not currently running!"
	log "It can be started using the following command:"
	log "systemctl restart *agl-service-audio-4a*.service"
fi

exit $EXIT_CODE