pipewire/spa
Hans de Goede c5da2e30dc spa: v4l2: Use systemd-logind to listen for access changes
There is a race between logind applying ACLs to allow the active session
of a locally present user access to devices with a udev uaccess tag
(like /dev/video# nodes) getting applied vs wireplumber/pipewire starting.

Wireplumber/pipewire are part of the (user) default.target, which gets
started as soon as a user logs in and systemd --user is started for that
user, where as logind only starts applying the ACLs after the gnome-shell
associated logind session has been created.

This race may cause pipewire to not see v4l2 video sources at login,
this can be reproduced with these steps:

1. sudo setfacl --remove-all /dev/video*
2. systemctl --user restart pipewire
3. Now wp-ctl status will not show any video devices
   (like if pipewire was started before the udev uaccess ACLs got applied)
4. Do a switch to another (test) user without logging out, e.g. in GNOME
   go to the top right system menu press the power on/off icon and select
   "Switch User..."
5. Switch back to your normal user. Run getfacl /dev/video0 this will show
   your user has access now.
6. wp-ctl status should show the camera now, but it does not.

Fix pipewire not seeing v4l2 sources in this case by making v4l2-udev
monitor systemd-logind session changes and redoing the access() checks
on /dev/video# nodes when the session changes.

Closes: #3539
Closes: #3960
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 2a6ba61264)
2024-10-12 15:19:49 +02:00
..
examples treewide: fix some format string issues 2024-04-29 16:19:15 +02:00
include spa: avoid C23 empty initializers in the headers 2024-09-27 15:06:56 +02:00
plugins spa: v4l2: Use systemd-logind to listen for access changes 2024-10-12 15:19:49 +02:00
tests Add GNU/Hurd support 2023-09-24 15:11:52 +00:00
tools treewide: use SPDX tags to specify copyright information 2023-02-16 10:54:48 +00:00
meson.build meson: fix build with missing libudev-devel 2024-10-12 15:19:49 +02:00