From 3aa51a5c01e7832605705cb71dc9a14f315c6e79 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Thu, 17 Sep 2026 15:05:35 +0100 Subject: Prefer the dock camera and use the camera portal --- dot_local/bin/executable_rqr | 20 +++++++++++++++++++- etc/systemd/system/integrated-camera-off@.service | 12 ++++++++++++ etc/udev/rules.d/60-camera-priority.rules | 2 ++ firefox/user-overrides.js | 3 +++ run_onchange_after_deploy-flatpak-overrides.sh.tmpl | 6 +++--- 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 etc/systemd/system/integrated-camera-off@.service create mode 100644 etc/udev/rules.d/60-camera-priority.rules diff --git a/dot_local/bin/executable_rqr b/dot_local/bin/executable_rqr index 76ea698..5b768ce 100755 --- a/dot_local/bin/executable_rqr +++ b/dot_local/bin/executable_rqr @@ -1,6 +1,24 @@ #!/usr/bin/env dash -text="$(zbarcam -q -1 --raw)" +set -eu + +camera="" +for candidate in \ + /dev/v4l/by-id/*HP_430_435_FHD_Webcam*-video-index0 \ + /dev/v4l/by-id/*-video-index0 \ + /dev/video*; do + if [ -e "$candidate" ]; then + camera="$candidate" + break + fi +done + +if [ -z "$camera" ]; then + echo "rqr: no camera found" >&2 + exit 1 +fi + +text="$(zbarcam -q -1 --raw "$camera")" printf '%s' "$text" | wl-copy echo "$text" diff --git a/etc/systemd/system/integrated-camera-off@.service b/etc/systemd/system/integrated-camera-off@.service new file mode 100644 index 0000000..6d7eaf8 --- /dev/null +++ b/etc/systemd/system/integrated-camera-off@.service @@ -0,0 +1,12 @@ +[Unit] +Description=Disable the integrated camera while the HP camera is connected +BindsTo=%i.device +After=%i.device + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecCondition=/usr/bin/grep -qx 13d3 /sys/bus/usb/devices/1-8/idVendor +ExecCondition=/usr/bin/grep -qx 56a6 /sys/bus/usb/devices/1-8/idProduct +ExecStart=/usr/bin/sh -c 'printf 0 > /sys/bus/usb/devices/1-8/authorized' +ExecStop=-/usr/bin/sh -c 'printf 1 > /sys/bus/usb/devices/1-8/authorized' diff --git a/etc/udev/rules.d/60-camera-priority.rules b/etc/udev/rules.d/60-camera-priority.rules new file mode 100644 index 0000000..a12d5a6 --- /dev/null +++ b/etc/udev/rules.d/60-camera-priority.rules @@ -0,0 +1,2 @@ +# Disable the integrated camera while the HP external camera is connected. +ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="03f0", ATTR{idProduct}=="794a", TAG+="systemd", ENV{SYSTEMD_WANTS}+="integrated-camera-off@.service" diff --git a/firefox/user-overrides.js b/firefox/user-overrides.js index aa79951..3ea14a8 100644 --- a/firefox/user-overrides.js +++ b/firefox/user-overrides.js @@ -26,6 +26,9 @@ user_pref("media.gmp-provider.enabled", true); user_pref("media.gmp-gmpopenh264.enabled", true); user_pref("media.gmp-manager.url", "https://aus5.mozilla.org/update/3/GMP/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); +/** Camera **/ +user_pref("media.webrtc.camera.allow-pipewire", true); // use the camera portal instead of direct V4L2 + /** Network **/ user_pref("network.dns.disableIPv6", false); // keep IPv6 enabled diff --git a/run_onchange_after_deploy-flatpak-overrides.sh.tmpl b/run_onchange_after_deploy-flatpak-overrides.sh.tmpl index 47f3201..6412bb4 100644 --- a/run_onchange_after_deploy-flatpak-overrides.sh.tmpl +++ b/run_onchange_after_deploy-flatpak-overrides.sh.tmpl @@ -17,9 +17,9 @@ apply() { apply org.pwmt.zathura --filesystem=xdg-config/zathura:ro apply io.mpv.Mpv --filesystem=xdg-config/mpv:ro -# LibreWolf needs raw /dev access for v4l2 webcams. Flatpak has no -# finer-grained device option, so this opens video/dri/snd at once. -apply io.gitlab.librewolf-community --device=all +# LibreWolf uses the camera portal. Revoke its old broad device override while +# retaining direct rendering access from the application manifest. +apply io.gitlab.librewolf-community --nodevice=all --device=dri # Ungoogled Chromium needs /dev/hidraw* for WebHID (e.g. usevia.app # configuring ZSA keyboards). --device=all is the only knob flatpak -- cgit v1.3.1