diff --git a/userspace/usr/comma/comma.sh b/userspace/usr/comma/comma.sh index 79f8a81..33abc00 100755 --- a/userspace/usr/comma/comma.sh +++ b/userspace/usr/comma/comma.sh @@ -10,13 +10,13 @@ RESET_TRIGGER="/data/__system_reset__" echo "waiting for magic" for i in {1..200}; do - if systemctl is-active --quiet magic; then + if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then break fi sleep 0.1 done -if systemctl is-active --quiet magic; then +if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then echo "magic ready after ${SECONDS}s" else echo "timed out waiting for magic, ${SECONDS}s" diff --git a/userspace/usr/comma/magic.py b/userspace/usr/comma/magic.py index 26996c3..af09c45 100755 --- a/userspace/usr/comma/magic.py +++ b/userspace/usr/comma/magic.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -import os, socket, struct, subprocess, threading +import os, socket, struct, subprocess, threading, time from array import array import pyray as rl @@ -84,7 +84,14 @@ def handle_client(client, drm_master): def main(): threading.Thread(target=updater_weston, daemon=True).start() - drm_master = os.open(DRM_DEVICE, os.O_RDWR | os.O_CLOEXEC) + while True: + try: + drm_master = os.open(DRM_DEVICE, os.O_RDWR | os.O_CLOEXEC) + break + except Exception as e: + print(e) + time.sleep(0.1) + os.environ['DRM_FD'] = str(drm_master) rl.init_window(0, 0, "not weston") img = rl.load_image(BACKGROUND) diff --git a/userspace/uv/pyproject.toml b/userspace/uv/pyproject.toml index 4f8f0c5..8cd5620 100644 --- a/userspace/uv/pyproject.toml +++ b/userspace/uv/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "flaky", # GUIs - "raylib @ https://github.com/commaai/raylib-python-cffi/releases/download/4/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl", + "raylib @ https://github.com/commaai/raylib-python-cffi/releases/download/5/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl", ] [tool.uv.sources] diff --git a/userspace/uv/uv.lock b/userspace/uv/uv.lock index 8e7c4af..49fe29e 100644 --- a/userspace/uv/uv.lock +++ b/userspace/uv/uv.lock @@ -56,7 +56,7 @@ requires-dist = [ { name = "py-spy" }, { name = "pyopencl", specifier = "==2024.1" }, { name = "pyusb" }, - { name = "raylib", url = "https://github.com/commaai/raylib-python-cffi/releases/download/4/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl" }, + { name = "raylib", url = "https://github.com/commaai/raylib-python-cffi/releases/download/5/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl" }, { name = "smbus2" }, { name = "spidev2" }, ] @@ -5653,12 +5653,12 @@ wheels = [ [[package]] name = "raylib" version = "5.5.0.2" -source = { url = "https://github.com/commaai/raylib-python-cffi/releases/download/4/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl" } +source = { url = "https://github.com/commaai/raylib-python-cffi/releases/download/5/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl" } dependencies = [ { name = "cffi" }, ] wheels = [ - { url = "https://github.com/commaai/raylib-python-cffi/releases/download/4/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl", hash = "sha256:d32619e003cc55b0ca4df5dde421e654e691600d4071dd12458d374ca5d2070b" }, + { url = "https://github.com/commaai/raylib-python-cffi/releases/download/5/raylib-5.5.0.2-cp312-cp312-linux_aarch64.whl", hash = "sha256:cc38da3f0938d54ff498fe6dc7c597fbc7d3dff68b0198d495ef269a19a9c872" }, ] [package.metadata]