summaryrefslogtreecommitdiffstats
path: root/bin/4a-status
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-07-20 15:56:23 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2019-04-24 14:18:11 +0200
commit24dd246d1ee3a53434dd1f21aa2afbeb55618ead (patch)
tree9edf3297051cf80b1d5b3f0b00dc12b57f162636 /bin/4a-status
parent15f0344df8bfbd8daf7a383bfccfa0d3cd7d75b9 (diff)
Added a 4a-info script use to test if 4a can work
Test various things to check if 4a can work in this environment. Change-Id: Ica4b739d7e8c6401db05a3b9b4d6ef9048ca1002 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'bin/4a-status')
-rwxr-xr-xbin/4a-status51
1 files changed, 51 insertions, 0 deletions
diff --git a/bin/4a-status b/bin/4a-status
new file mode 100755
index 0000000..519f470
--- /dev/null
+++ b/bin/4a-status
@@ -0,0 +1,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