mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-08-23 01:04:08 +08:00
fix rare sound init failure (#138)
* test * executable * wait for sound card * check that too * update --------- Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Executable
+30
@@ -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")
|
||||
Reference in New Issue
Block a user