diff --git a/userspace/files/agnos-tests.service b/userspace/files/agnos-tests.service index d5c0224..c479333 100644 --- a/userspace/files/agnos-tests.service +++ b/userspace/files/agnos-tests.service @@ -4,8 +4,14 @@ After=weston-ready.service [Service] Type=simple User=comma +#Type=oneshot Restart=no -#ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_weston.py" + +# 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" [Install] WantedBy=multi-user.target diff --git a/userspace/files/weston-ready.service b/userspace/files/weston-ready.service index c52c8b8..d69e692 100644 --- a/userspace/files/weston-ready.service +++ b/userspace/files/weston-ready.service @@ -16,6 +16,10 @@ ExecStart=/bin/sleep 0.5 ExecStart=/bin/echo "fixing permissions" ExecStart=/bin/bash -c "chmod -R 770 $XDG_RUNTIME_DIR" +# these are set by udev rules, but udev is slow +ExecStart=/bin/bash -c "chgrp gpu /dev/ion /dev/kgsl-3d0" +ExecStart=/bin/bash -c "chmod 660 /dev/ion /dev/kgsl-3d0" + ExecStart=/bin/echo "turning on display" ExecStart=/bin/bash -c "echo 500 > /sys/class/backlight/panel0-backlight/brightness" diff --git a/userspace/usr/comma/tests/test_weston.py b/userspace/usr/comma/tests/test_weston.py index 5127a00..0595577 100755 --- a/userspace/usr/comma/tests/test_weston.py +++ b/userspace/usr/comma/tests/test_weston.py @@ -4,6 +4,10 @@ import time import hashlib import subprocess +""" +journalctl -o short-monotonic -u weston -u weston-ready -u agnos-tests +""" + if __name__ == "__main__": socket_exists = os.path.exists("/var/tmp/weston/wayland-0") is_active = subprocess.check_output("systemctl is-active weston", shell=True, encoding='utf8').strip() @@ -15,7 +19,9 @@ if __name__ == "__main__": h = hashlib.sha1(d).hexdigest() # weston should be ready to go at this point - proc = subprocess.Popen('/usr/comma/setup', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + cmd = '/usr/comma/setup' + cmd = 'cd /data/openpilot/selfdrive/ui/ && ./ui' + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for i in range(10): r = proc.poll() if r is not None: @@ -27,7 +33,7 @@ if __name__ == "__main__": out, err = proc.stdout.read(), proc.stderr.read() with open('/data/weston_log', 'a') as f: - f.write(f"{is_active=}, {socket_exists=}, app={rc} / {h}\n") + f.write(f"{is_active=}, {socket_exists=}, {rc=} / {h} / {cmd}\n") if rc is not None: f.write(f" stdout: {out}\n") f.write(f" stderr: {err}\n") @@ -36,5 +42,6 @@ if __name__ == "__main__": os.system("sudo su -c 'tail /data/weston_log > /dev/console'") os.system("sudo su -c 'wc -l /data/weston_log > /dev/console'") - time.sleep(2) - os.system("sudo reboot") + if rc is None: + time.sleep(2) + os.system("sudo reboot")