weston: fix no GL context early in boot (#137)

* weston: fix no GL context early in boot

* update test

---------

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Adeeb Shihadeh
2023-05-11 15:02:44 -07:00
committed by GitHub
parent 35a6ae47ce
commit 061419762d
3 changed files with 22 additions and 5 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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")