diff --git a/userspace/files/agnos-tests.service b/userspace/files/agnos-tests.service index c479333..5b26bf4 100644 --- a/userspace/files/agnos-tests.service +++ b/userspace/files/agnos-tests.service @@ -1,17 +1,17 @@ [Unit] -After=weston-ready.service +#After=weston-ready.service [Service] -Type=simple -User=comma -#Type=oneshot +#Type=simple +#User=comma +Type=oneshot Restart=no # exit if connected to 5V ExecStartPre=/bin/bash -c "if [ $(cat /sys/class/hwmon/hwmon1/in1_input) -le 6500 ]; then echo 'Exiting, connected to 5V'; exit 1; fi" -ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_weston.py" -#ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_sounds.py" +#ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_weston.py" +ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_sounds.py" [Install] WantedBy=multi-user.target diff --git a/userspace/usr/comma/sound/sound_init.sh b/userspace/usr/comma/sound/sound_init.sh index 6ac2a1e..4a8abf6 100755 --- a/userspace/usr/comma/sound/sound_init.sh +++ b/userspace/usr/comma/sound/sound_init.sh @@ -5,6 +5,12 @@ insmod /usr/comma/sound/snd-soc-wcd9xxx.ko insmod /usr/comma/sound/snd-soc-sdm845.ko +echo "waiting for sound card to come online" +while [ ! -d /proc/asound/sdm845tavilsndc ] || [ "$(cat /proc/asound/card0/state 2> /dev/null)" != "ONLINE" ] ; do + sleep 0.01 +done +echo "sound card online" + /usr/comma/sound/tinymix set "SEC_MI2S_RX Audio Mixer MultiMedia1" 1 /usr/comma/sound/tinymix set "MultiMedia1 Mixer TERT_MI2S_TX" 1 diff --git a/userspace/usr/comma/tests/test_sounds.py b/userspace/usr/comma/tests/test_sounds.py new file mode 100755 index 0000000..0c87128 --- /dev/null +++ b/userspace/usr/comma/tests/test_sounds.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +import os +import time +import subprocess + +good = """ +Starting Sound... +[INFO] Bringing adsp out of reset +subsys4 +waiting for sound card to come online +sound card online +sound.service: Succeeded. +Finished Sound. +""".strip() + +if __name__ == "__main__": + time.sleep(3) + log = subprocess.check_output("journalctl -o cat -u sound", shell=True, encoding='utf8').strip() + passed = log == good + with open('/data/tmp/sound_log', 'a') as f: + f.write(f"{passed}\n") + + os.system("journalctl -u sound.service -o short-monotonic >> /data/tmp/sound_service_log") + os.system("sudo su -c 'tail /data/tmp/sound_log > /dev/console'") + os.system("sudo su -c 'wc -l /data/tmp/sound_log > /dev/console'") + os.sync() + + if passed: + time.sleep(2) + os.system("sudo reboot")