ReversePuck 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env bash
  2. # ReversePuck Steam Deck forwarder launcher (uv-based; nothing installed system-wide).
  3. #
  4. # Add as a NON-STEAM GAME:
  5. # Target: /home/deck/…/ReversePuck/ReversePuck
  6. # Start In: /home/deck/…/ReversePuck/ (the directory this script is in)
  7. # Then, in that shortcut's gear -> Properties -> Controller, set "Disable Steam Input" so Steam doesn't
  8. # fight us for the built-in pad while we grab it.
  9. #
  10. # Dependencies are pulled by uv on first run (pyserial + pygame + pyusb -- prebuilt wheels; pyusb uses
  11. # the system libusb-1.0.so). uv also provisions its own Python, so nothing touches the read-only rootfs.
  12. #
  13. # USB-level detach (DeckSource) needs access to the controller's usbfs node, and the CDC link needs
  14. # /dev/ttyACM*. Run `sudo ./setup.sh` once per boot to open both (see README). Without it, fall back to
  15. # `./ReversePuck --evdev` (no USB detach; Steam/QAM won't forward, trackpads are lower fidelity).
  16. set -euo pipefail
  17. cd "$(dirname "$(readlink -f "$0")")"
  18. find_uv() {
  19. local uv
  20. uv="$(command -v uv || true)"
  21. [ -n "$uv" ] || { [ -x "$HOME/.local/bin/uv" ] && uv="$HOME/.local/bin/uv"; }
  22. [ -x "$uv" ] && { printf '%s' "$uv"; return 0; }
  23. return 1
  24. }
  25. UV="$(find_uv || true)"
  26. if [ -z "$UV" ]; then
  27. # Bootstrap uv on first run. SteamOS' rootfs is read-only, but the official installer drops a
  28. # self-contained binary under ~/.local/bin (writable), so nothing touches the system.
  29. echo "uv not found — installing it (one-time) via https://astral.sh/uv …"
  30. if command -v curl >/dev/null 2>&1; then
  31. curl -LsSf https://astral.sh/uv/install.sh | sh
  32. elif command -v wget >/dev/null 2>&1; then
  33. wget -qO- https://astral.sh/uv/install.sh | sh
  34. else
  35. echo "Cannot bootstrap uv: neither curl nor wget is available." >&2
  36. echo "Install uv manually: https://docs.astral.sh/uv/" >&2
  37. exit 1
  38. fi
  39. UV="$(find_uv || true)"
  40. [ -n "$UV" ] || { echo "uv install completed but the binary was not found on PATH or in ~/.local/bin." >&2; exit 1; }
  41. echo "uv installed: $UV"
  42. fi
  43. exec "$UV" run --with pyserial --with pygame --with pyusb python openctrl.py "$@"