Package: release.debian.org
Severity: normal
Tags: bullseye
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: debconf-vi...@lists.debian.org

[ Reason ]
Linux started to have multiple /dev/video device nodes in
linux-image-4.19.0-5-amd64 (#1011938).

This broke hdmi2usb-udev because we wouldn't know which /dev/video
device to capture video from.

The DebConf Video team has known about this problem since buster, but
has only recently figured out the (fairly straightforward) solution.
Blame COVID-19 for us not meeting in person again, and dealing with it.

[ Impact ]
hdmi2usb-udev doesn't give you an unambiguous device to capture video
from, for your hdmi2usb hardware.

There is very little of this hardware in the wild, so the DebConf video
team are almost the only affected people.

[ Tests ]
Manually tested at the Hamburg Debian Reunion 2022.

[ Risks ]
Pretty trivial changes. Extremely low popcon :)
Rare, out of production hardware.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
1. Add a suffix to the device node, from information provided by
   60-persistent-v4l.rules
2. Sort the udev rule *after* 60-persistent-v4l.rules.
diff -Nru hdmi2usb-mode-switch-0.0.1/debian/changelog 
hdmi2usb-mode-switch-0.0.1/debian/changelog
--- hdmi2usb-mode-switch-0.0.1/debian/changelog 2018-01-19 09:28:58.000000000 
+0200
+++ hdmi2usb-mode-switch-0.0.1/debian/changelog 2022-05-27 12:22:19.000000000 
+0200
@@ -1,3 +1,11 @@
+hdmi2usb-mode-switch (0.0.1-2+deb11u1) bullseye; urgency=low
+
+  * Patch: Udev: Add a suffix to /dev/video device nodes to disambiguate them.
+    (Closes: #1011938)
+  * Move udev rules to priority 70, to come after 60-persistent-v4l.rules.
+
+ -- Stefano Rivera <stefa...@debian.org>  Fri, 27 May 2022 12:22:19 +0200
+
 hdmi2usb-mode-switch (0.0.1-2) unstable; urgency=medium
 
   * Update symlinks for ixo-usb-jtag 0.0.1.
diff -Nru 
hdmi2usb-mode-switch-0.0.1/debian/patches/disambiguate-video-device-nodes 
hdmi2usb-mode-switch-0.0.1/debian/patches/disambiguate-video-device-nodes
--- hdmi2usb-mode-switch-0.0.1/debian/patches/disambiguate-video-device-nodes   
1970-01-01 02:00:00.000000000 +0200
+++ hdmi2usb-mode-switch-0.0.1/debian/patches/disambiguate-video-device-nodes   
2022-05-27 12:22:19.000000000 +0200
@@ -0,0 +1,52 @@
+From: Nicolas Dandrimont <nico...@dandrimont.eu>
+Date: Thu, 26 May 2022 22:17:33 +0200
+Subject: Add a suffix to the video device name when no capture capability is
+ detected
+
+Recent versions of the linux kernel generate multiple device nodes for
+each uvcvideo capture card. The HDMI2USB-generated video symlinks end up
+stomping on one another until the last one wins.
+
+Recent versions of udev's id_v4l script add a ID_V4L_CAPABILITIES
+variable that we can use to distinguish both devices. We give the
+metadata device a `-metadata` suffix to distinguish it from the capture
+node.
+
+Origin: https://github.com/litex-hub/litex-buildenv-udev/pull/9
+Bug-Debian: https://bugs.debian.org/1011938
+---
+ udev/99-hdmi2usb-aliases.rules | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/udev/99-hdmi2usb-aliases.rules b/udev/99-hdmi2usb-aliases.rules
+index 8ae7f48..e0863ca 100644
+--- a/udev/99-hdmi2usb-aliases.rules
++++ b/udev/99-hdmi2usb-aliases.rules
+@@ -119,17 +119,22 @@ SUBSYSTEM=="tty", ENV{ID_HDMI2USB}=="1", 
ENV{NUM_HDMI2USB_TTY}!="", ENV{NUM_HDMI
+       
SYMLINK+="hdmi2usb/by-num/$env{ID_HDMI2USB_BOARD}$env{NUM_HDMI2USB_BOARD}/tty$env{NUM_HDMI2USB_TTY}"
+ 
+ # Video capture device
++SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", 
ENV{ID_V4L_CAPABILITIES}=="*:capture:*" \
++    ENV{HDMI2USB_VIDEO_SUFFIX}:=""
++SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", 
ENV{ID_V4L_CAPABILITIES}!="*:capture:*" \
++    ENV{HDMI2USB_VIDEO_SUFFIX}:="-metadata"
++
+ SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", ENV{ID_SERIAL_SHORT}!="" \
+-      SYMLINK+="hdmi2usb/by-serial/$env{ID_SERIAL_SHORT}/video"
++      
SYMLINK+="hdmi2usb/by-serial/$env{ID_SERIAL_SHORT}/video$env{HDMI2USB_VIDEO_SUFFIX}"
+ 
+ SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", ENV{ID_PATH}!="" \
+-      SYMLINK+="hdmi2usb/by-path/$env{ID_PATH}/video"
++      
SYMLINK+="hdmi2usb/by-path/$env{ID_PATH}/video$env{HDMI2USB_VIDEO_SUFFIX}"
+ 
+ SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", ENV{ID_PATH_HUMAN}!="" \
+-      SYMLINK+="hdmi2usb/by-path/$env{ID_PATH_HUMAN}/video"
++      
SYMLINK+="hdmi2usb/by-path/$env{ID_PATH_HUMAN}/video$env{HDMI2USB_VIDEO_SUFFIX}"
+ 
+ SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", ENV{NUM_HDMI2USB}!="" \
+-      SYMLINK+="hdmi2usb/by-num/all$env{NUM_HDMI2USB}/video"
++      
SYMLINK+="hdmi2usb/by-num/all$env{NUM_HDMI2USB}/video$env{HDMI2USB_VIDEO_SUFFIX}"
+ 
+ SUBSYSTEM=="video4linux", ENV{ID_HDMI2USB}=="1", ENV{ID_HDMI2USB_BOARD}!="", 
ENV{NUM_HDMI2USB_BOARD}!="" \
+-      
SYMLINK+="hdmi2usb/by-num/$env{ID_HDMI2USB_BOARD}$env{NUM_HDMI2USB_BOARD}/video"
++      
SYMLINK+="hdmi2usb/by-num/$env{ID_HDMI2USB_BOARD}$env{NUM_HDMI2USB_BOARD}/video$env{HDMI2USB_VIDEO_SUFFIX}"
diff -Nru hdmi2usb-mode-switch-0.0.1/debian/patches/series 
hdmi2usb-mode-switch-0.0.1/debian/patches/series
--- hdmi2usb-mode-switch-0.0.1/debian/patches/series    2018-01-19 
09:28:58.000000000 +0200
+++ hdmi2usb-mode-switch-0.0.1/debian/patches/series    2022-05-27 
12:22:19.000000000 +0200
@@ -1,2 +1,3 @@
 no-unbind-helper
 flashproxy-source
+disambiguate-video-device-nodes
diff -Nru hdmi2usb-mode-switch-0.0.1/debian/rules 
hdmi2usb-mode-switch-0.0.1/debian/rules
--- hdmi2usb-mode-switch-0.0.1/debian/rules     2018-01-19 09:28:58.000000000 
+0200
+++ hdmi2usb-mode-switch-0.0.1/debian/rules     2022-05-27 12:22:19.000000000 
+0200
@@ -15,3 +15,7 @@
 
 override_dh_auto_test:
        # Only one test, and it isn't really appliccable to an autobuilder 
environment
+
+override_dh_installudev:
+       # Sort after 60-persistent-v4l.rules
+       dh_installudev --priority=70

Reply via email to