Skip to content

A camera grant passes over a node that offers no colour picture - #669

Draft
DevomB wants to merge 1 commit into
mainfrom
camera-colour-first
Draft

DevomB wants to merge 1 commit into
mainfrom
camera-colour-first

Conversation

@DevomB

@DevomB DevomB commented Oct 29, 2026

Copy link
Copy Markdown
Owner

A laptop's infrared face-login camera is usually a second function of the same USB camera. That makes it a video4linux device of its own, so its capture node is index 0 like the colour camera's, and only the node numbering kept it from being granted. It takes two stale holders to renumber the colour node above it, or a module that lists the infrared function first. A zone given the infrared node gets grey frames, which Firefox's capture cannot show.

  • camera_in takes the lowest numbered index 0 node that offers a format Firefox reads (MJPEG, YUYV, UYVY, NV12, I420, YV12). When none does, it takes the lowest numbered, as before.
  • The formats come from VIDIOC_ENUM_FMT on the host's node. In 6.18 uvcvideo answers from the descriptors it parsed at probe, and neither open() nor the ioctl powers the camera. The request is cast as _ for musl's c_int.
  • The design doc and the user guide say which camera a grant gives, and what is still not covered: an infrared camera that offers a colour format too.

Checks:

  • A unit test lays out a colour and an infrared camera in one USB device, with the infrared one numbered lowest. It also checks that a camera with no colour node falls back to the lowest numbered, and that a metadata node is never picked.
  • camera-colour-first in the camera suite loads two vivid stand-ins, the lower numbered one multi-planar. The kernel refuses a single-planar VIDIOC_ENUM_FMT on that one (v4l_enum_fmt's cap-mask check), and the case checks the grant takes the other. That runs the real ioctl, which the fallback would otherwise hide.

Testing on physical hardware is planned for October 2026.

An infrared face-login camera is usually a second function of the same
USB camera: a video4linux device of its own, so its capture node is
index 0 like the colour camera's, and only the numbering kept it from
being granted. camera_in now takes the lowest numbered index-0 node that
offers a format Firefox reads (MJPEG, YUYV, NV12 and the like), asked of
the driver with VIDIOC_ENUM_FMT, which answers from what uvcvideo parsed
at probe without powering the camera; when none does, the lowest
numbered, as before.

The unit test lays out a colour and an infrared camera in one USB device
with the infrared one numbered lowest. The camera suite's new case loads
two vivid stand-ins, the lower one multi-planar, and checks the grant
takes the other.

This branch has not been deployed

No deployments
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