Skip to content

feat: add phonecam setup for Linux deps and persistent loopback - #58

Merged
kvm404 merged 2 commits into
mainfrom
feat/phonecam-setup
Sep 3, 2026
Merged

kvm404 merged 2 commits into
mainfrom
feat/phonecam-setup

Conversation

@kvm404

@kvm404 kvm404 commented Sep 3, 2026

Copy link
Copy Markdown
Owner

What changed

Adds sudo phonecam setup as the root helper that actually installs Linux receive-path packages and persists an OBS-aware PhoneCam v4l2loopback node. phonecam install stays print-only.

  • Detects Arch / Fedora / Debian-family via /etc/os-release and installs GStreamer + v4l2loopback (pacman / dnf / apt), plus matching kernel headers for DKMS where needed.
  • Loads /dev/video10 now and persists PhoneCam-owned files at /etc/modprobe.d/phonecam.conf and /etc/modules-load.d/phonecam.conf.
  • --dry-run prints the plan and changes nothing. phonecam start still does not require root; if /dev/video10 is missing it tells the user to run setup.
  • Reloads a default-loaded v4l2loopback (empty/-1 video_nr is a no-op second modprobe) so setup actually creates video10. Re-plans after package auto-load. Treats ufw user.rules as already-allows when status needs root.
  • Docs: README, linux-cli README, and TECHNICAL_DESIGN.

Does not ship distro packages or auto-modprobe from a package postinst. Does not overwrite an OBS-owned /etc/modprobe.d/v4l2loopback.conf. Does not steal /dev/video10 if it exists with a non-PhoneCam label.

Why

phonecam install only printed hints. After reboot the module is often missing, and a second modprobe video_nr=10 is a no-op if OBS already loaded v4l2loopback. Setup applies the receive path and persists a PhoneCam node without fighting OBS.

OBS / exclusive_caps

exclusive_caps is a per-device CSV, not a global boolean. exclusive_caps=1 with devices=2 only enables the first slot (Y,N,…) on current v4l2loopback — OBS on /dev/video0 gets exclusive caps, PhoneCam on /dev/video10 does not.

Setup:

  • Unloaded module: video_nr=10 card_label=PhoneCam exclusive_caps=1
  • PhoneCam already on /dev/video10 with exclusive caps on: leave it
  • OBS (or other loopback) without a PhoneCam node: rmmod only if nothing holds the devices, then reload devices=2 video_nr=0,10 card_label="OBS Virtual Camera,PhoneCam" exclusive_caps=1,1 (or merge extra nodes the same way)
  • Never overwrite /etc/modprobe.d/v4l2loopback.conf

Fedora / RPM Fusion

v4l2loopback and gst-libav are not in stock Fedora. Setup enables RPM Fusion Free (rpmfusion-free-release-$VERSION_ID) when /etc/yum.repos.d/rpmfusion-free.repo is missing. If the version cannot be read or enable/install fails, it returns the doctor-style line:

v4l2loopback and gst-libav are not in stock Fedora; enable RPM Fusion (https://rpmfusion.org/Configuration) then re-run: sudo phonecam setup

How tested

From linux-cli on this branch (feat/phonecam-setup @ 2cbd25c):

cd linux-cli && go test ./... && go test -race ./...

Both passed (Go 1.22.12). Setup/doctor/cli coverage includes Fedora Fusion enable/fail, OBS merge with exclusive_caps=1,1, refusal to steal video10 / overwrite OBS conf, and default-module reload so video10 is created.

Android is out of scope for this slice.

Install GStreamer and v4l2loopback with sudo phonecam setup, load an
OBS-aware /dev/video10, and persist phonecam-owned modprobe files.
Keep phonecam install print-only. --dry-run prints the plan without
changing the system.
A loaded module with empty/-1 video_nr made modprobe a no-op. Always
rmmod before applying PhoneCam options, re-plan after package auto-load,
merge auto-assigned OBS on video0, and treat ufw user.rules as already-allows
when status needs root.
@kvm404
kvm404 merged commit 3be9fc2 into main Sep 3, 2026
1 check passed
@kvm404
kvm404 deleted the feat/phonecam-setup branch September 3, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant