Skip to content

Groundwork: split device.rs into transport and enumeration - #160

Merged
nofuturekid merged 5 commits into
rebuildfrom
fix/148-groundwork-transport
Nov 13, 2026
Merged

nofuturekid merged 5 commits into
rebuildfrom
fix/148-groundwork-transport

Conversation

@nofuturekid

Copy link
Copy Markdown
Collaborator

Fixes #148

Stacked on #157 (branch fix/146-groundwork-workspace); the diff against that branch is the single commit on top. Base is rebuild.

What changed

Pure move, no behaviour change. device.rs is split as the groundwork plan (Task 4) describes:

  • crates/obsbot-device/src/device.rs is renamed (git mv) to crates/obsbot-device/src/transport/uvc.rs; it keeps the extension-unit queries, the V4L2 controls, the lock and the Device type with its tests.
  • crates/obsbot-device/src/enumeration.rs takes the camera detection (V4L2_CAP_META_CAPTURE, V4l2Capability, vidioc_querycap, Detected, card_name, detect, first_by_id) and the by-id test.
  • crates/obsbot-device/src/transport/mod.rs is new (pub mod uvc;).
  • crates/obsbot-device/src/lib.rs: only the device/registry group changes. enumeration, registry, transport and an inline pub mod device re-export (Detected, detect, CtrlRange, Device) keep the 0.13 path valid.
  • scripts/groundwork/split-device.py is the committed split script: it copies contiguous line ranges of the 0.13 file unchanged. Run after git mv, then rustfmt --edition 2024 on the two files.

No byte sent to the camera, no ioctl, no timing and no CLI output changes. No CHANGELOG line (not user-visible).

How it was verified

  • Gate: cargo fmt --check clean; cargo clippy --workspace --all-targets --locked -j 3 -- -D warnings clean; cargo test --workspace --locked -j 3 passes (118, 1, 25, 2, 0 tests); shellcheck scripts/groundwork/*.sh scripts/package-contents.sh and actionlint clean.
  • Test names: scripts/groundwork/test-names.sh for base and head both list 146 tests; comm -3 prints nothing.
  • Byte guard and CLI surface: both tests pass; byte-guard.txt and cli-surface.txt are not in the diff.
  • Move check: scripts/groundwork/move-check.sh <base> HEAD prints exactly the 12 lines the plan lists (#[cfg(test)], the EUPL note, two SPDX lines, the transport and enumeration module docs (3 lines), the device re-export doc comment, mod tests {, pub mod device { and two closing braces).
  • Ioctls and layouts: the tree has 11 ioctl_read! / ioctl_readwrite! / layout-struct matches; enumeration.rs holds V4l2Capability and vidioc_querycap (b'V', 0), transport/uvc.rs holds UvcXuControlQuery, V4l2Control, V4l2QueryCtrl and uvcioc_ctrl_query (b'u', 0x21), vidioc_g_ctrl (27), vidioc_s_ctrl (28), vidioc_queryctrl (36), each exactly once with its 0.13 numbers.
  • Scripted split (G6b): on the base commit, git mv, the script from this commit, rustfmt --edition 2024; diff of transport/uvc.rs and enumeration.rs against this head prints nothing.
  • git diff -M --stat shows device.rs => transport/uvc.rs as a rename.
  • The MSRV job and the release dry run (scripts/ changed) run in CI on this pull request.
  • No camera was used and no device was opened; the binary was not run.

🤖 Generated with Claude Code

nofuturekid and others added 4 commits November 13, 2026 11:52
A byte guard records every frame and short command the builders emit for a fixed list of
calls, a CLI guard records the help text of every subcommand, and the release dry run lists
the files of every package. The workspace move must leave all three unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Taken from the package-contents artifact of the release dry run of this pull request: the
files of the deb, rpm, Arch and tarball packages for both architectures.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The library modules move to crates/obsbot-device, models.rs as registry.rs, and the 0.13 CLI
and daemon to crates/obsbot4linux, which keeps the package name, the binary and the package
metadata. Version, rust-version and licence come from [workspace.package]. No behaviour change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
frame.rs and streaming.rs move unchanged; lib.rs keeps their old paths as re-exports until
the final path change of the groundwork stage.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nofuturekid nofuturekid added the enhancement New feature or request label Nov 13, 2026
The device, its ioctls and the extension-unit access move to transport/uvc.rs; finding the
camera (by-id links, card name) moves to enumeration.rs with its test. Every block is copied
unchanged. lib.rs keeps the old device path as a re-export until the final path change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nofuturekid
nofuturekid force-pushed the fix/148-groundwork-transport branch from 46ebb3e to 7d5e683 Compare November 13, 2026 11:48
@nofuturekid
nofuturekid merged commit 7d5e683 into rebuild Nov 13, 2026
20 checks passed
@nofuturekid
nofuturekid deleted the fix/148-groundwork-transport branch November 13, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant