Skip to content

fix(camera): select V4L2 for Linux device paths - #4159

Merged
TomCC7 merged 2 commits into
mainfrom
fix/webcam-linux-device-backend
Sep 16, 2026
Merged

TomCC7 merged 2 commits into
mainfrom
fix/webcam-linux-device-backend

Conversation

@TomCC7

@TomCC7 TomCC7 commented Sep 15, 2026

Copy link
Copy Markdown
Member

Contribution path

Problem

  • OpenCV can select FFmpeg for Linux camera device paths, preventing capture properties from being applied.
  • Camera configuration needs to accept stable device paths as well as numeric indices.

Solution

  • Accept numeric indices, numeric CLI strings, and device paths.
  • Select V4L2 for Linux /dev/ paths, including /dev/v4l/by-id/.
  • Keep automatic backend selection for numeric indices, network URLs, and other platforms.
  • No imitation-learning, Blueprint, recorder, or dataset changes.

How to Test

uv run pytest dimos/hardware/sensors/camera/test_webcam_backend.py
  • Seven cases pass, covering Linux device paths, numeric inputs, network URLs, and non-Linux behavior.
  • On a machine with a webcam, the hardware API is Webcam(camera_index="/dev/video0"); call start() to open capture and stop() to release it.
  • Real camera capture was not repeated during this cleanup.

AI assistance

  • OpenAI Codex assisted with extraction, implementation, tests, and this description.
  • Updated by OpenAI Codex (agent).

Checklist

  • I have read and approved the CLA.

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #4159      +/-   ##
==========================================
+ Coverage   78.90%   79.43%   +0.53%     
==========================================
  Files        1469     1472       +3     
  Lines      138999   139548     +549     
  Branches    11941    12329     +388     
==========================================
+ Hits       109672   110845    +1173     
+ Misses      25930    25303     -627     
- Partials     3397     3400       +3     
Components Coverage Δ
Tests 95.60% <100.00%> (+0.83%) ⬆️
Flag Coverage Δ
OS-ubuntu-24.04-arm 75.11% <100.00%> (+0.26%) ⬆️
OS-ubuntu-latest 75.81% <100.00%> (+0.25%) ⬆️
Py-3.10 75.59% <100.00%> (+0.25%) ⬆️
Py-3.11 75.79% <100.00%> (+0.25%) ⬆️
Py-3.12 75.80% <100.00%> (+0.25%) ⬆️
SelfHosted-Large 30.52% <41.93%> (-0.21%) ⬇️
SelfHosted-Linux 36.65% <41.93%> (+0.37%) ⬆️
SelfHosted-macOS 36.94% <41.93%> (+1.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...mos/hardware/sensors/camera/test_webcam_backend.py 100.00% <100.00%> (ø)
dimos/hardware/sensors/camera/webcam.py 58.47% <100.00%> (+20.97%) ⬆️

... and 92 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

Safe to merge, with a non-blocking compatibility concern affecting signed and whitespace-padded numeric camera-index configuration.

Findings

  1. P2 Numeric indices stop parsing

Summary

This change correctly selects the V4L2 backend for Linux camera device paths while retaining automatic backend selection for other sources. One non-blocking compatibility concern remains: signed or whitespace-padded numeric camera indices now reach OpenCV as strings instead of integer device indices.

Reviews (1) · Last reviewed commit: "fix(camera): select V4L2 for Linux devic..."

Comment thread dimos/hardware/sensors/camera/webcam.py Outdated
@github-actions github-actions Bot removed the ready-to-merge Required CI checks have passed on this PR label Sep 16, 2026
@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Sep 16, 2026
@TomCC7
TomCC7 added this pull request to the merge queue Sep 16, 2026
Merged via the queue into main with commit 62649e8 Sep 16, 2026
31 checks passed
@TomCC7
TomCC7 deleted the fix/webcam-linux-device-backend branch September 16, 2026 20:24
@github-actions

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release/0.0.14:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/0.0.14 ready-to-merge Required CI checks have passed on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants