#!/usr/bin/env bash
# scripts/daemon/lesavka-uvc.sh - launch UVC control helper as a standalone service
set -euo pipefail

# Optional env file for runtime overrides (debug, width/fps, etc.)
if [[ -r /etc/lesavka/uvc.env ]]; then
    # shellcheck disable=SC1091
    source /etc/lesavka/uvc.env
fi

DEV=${LESAVKA_UVC_DEV:-/dev/v4l/by-path/platform-1000480000.usb-video-index0}
if [[ ! -e "$DEV" ]]; then
    DEV=/dev/video0
fi

exec /usr/local/bin/lesavka-uvc --device "$DEV"
