discover a camera when none is configured
validate / validate (push) Successful in 59m14s

CAPTURE_PATH defaulted to index 0, which is a coin flip on a machine with one
camera. A UVC camera exposes a second device node for its metadata stream --
/dev/video1 beside /dev/video0 -- and that node opens happily and never yields
an image, so the lowest device number is wrong about as often as it is right.

With neither CAMERA_ID nor CAPTURE_PATH set, the node now opens each
/dev/video* in numeric order and keeps the first that actually delivers a
frame. Reading one is the test, because opening is not evidence.

Discovery finding nothing falls back to index 0 rather than raising, which
keeps the failure in one place: the first read, where CI publishes a
placeholder and a normal run raises with a message naming the device.

CAMERA_ID is still worth preferring on a robot. Neither an index nor discovery
order is stable across reboots or across which port a camera is in; a by-id
name is.
This commit is contained in:
2026-09-15 06:16:14 -03:00
parent dc700106c5
commit 7628a8515b
5 changed files with 117 additions and 12 deletions
+5 -2
View File
@@ -42,8 +42,11 @@ env:
which USB port the camera is in, unlike an index, so it takes precedence
over CAPTURE_PATH. Linux only.
CAPTURE_PATH:
default: "0"
description: Device path such as /dev/video1, or an index. A numeric string is read as an index.
description: >-
Device path such as /dev/video1, or an index. A numeric string is read as
an index. When unset, the first /dev/video* that actually delivers a frame
is used -- a UVC camera also exposes a metadata node that opens and never
captures, so the lowest device number is not a safe default.
IMAGE_WIDTH:
type: int
description: Requested capture width; frames are also resized to it. Defaults to the camera's native width.