Skip to content

feat(serial): Linux sysfs USB health/topology enrichment (#1091) - #1207

Merged
zackees merged 1 commit into
mainfrom
feat/1091-linux-sysfs-usb
Jul 28, 2026
Merged

feat(serial): Linux sysfs USB health/topology enrichment (#1091)#1207
zackees merged 1 commit into
mainfrom
feat/1091-linux-sysfs-usb

Conversation

@zackees

@zackees zackees commented Jul 28, 2026

Copy link
Copy Markdown
Member

Implements the Linux slice of #1091: sysfs-based USB health/topology enrichment, designed so every line of parsing logic is fixture-testable on any OS.

  • Platform-neutral core: sysfs_usb parses a rooted directory tree; only live_root() (/sys/bus/usb/devices) is Linux-gated. Interfaces are detected structurally (subdirectory containing bInterfaceClass) instead of by Linux's colon-containing interface names — colons are illegal in NTFS filenames, so this keeps fixtures Windows-legal while matching real sysfs nesting.
  • Conservative health mapping (per meta: Windows USB phantom-device detection and recoverable native-USB deployment #1149's locked invariants — facts preserved, Unknown never fabricated): PresentProblem only on concrete signals (authorized=0, unconfigured, CDC interface with no bound driver) using documented Linux-only problem codes explicitly unrelated to Windows CM_PROB_*; healthy requires a bound tty interface; everything ambiguous stays Unknown. The Windows UsbProblemDevice shape is not abused — Linux gets a distinct diagnostics-only LinuxUsbProblemDevice + present_usb_problem_devices_linux(); existing APIs behave identically on all platforms.
  • behind_external_hub mirrors the Windows ancestry classification via port-path depth (1-1 root-attached vs 1-1.4 behind a hub).
  • macOS: explicitly unchanged/Unknown — IOKit work requires a Mac host (documented in the module).

Validation (local)

  • soldr cargo test -p fbuild-serial → 176 + 7 passed (15 new fixture tests: healthy CDC, hub vs root topology, unauthorized, unconfigured, driverless CDC interface, malformed/partial entries never panic, RP2040-typical synthetic VID/PID fixture, unowned tty stays Unknown); clippy -D warnings clean; dependents (fbuild-daemon, fbuild-cli) check clean; full bash test before merge.

Part of #1091 — remaining: macOS (IOKit) and the real-device validation runs on both platforms.

🤖 Generated with Claude Code

- New platform-neutral sysfs_usb module: pure functions over a rooted
  directory (live root /sys/bus/usb/devices is the only
  cfg(target_os=linux) piece), so all parsing is fixture-tested on any
  OS. Interfaces are identified structurally (subdir with
  bInterfaceClass) rather than by the colon-named Linux dir, keeping
  fixtures Windows-legal while staying faithful to real sysfs layout.
- Health mapping is conservative per #1149's invariants: concrete
  signals only (unauthorized / unconfigured / CDC interface without a
  bound driver -> PresentProblem with documented Linux-only codes;
  healthy requires a bound tty interface); everything ambiguous stays
  Unknown, never fabricated. Windows shapes are not reused: a distinct
  LinuxUsbProblemDevice diagnostics type + sibling
  present_usb_problem_devices_linux(); existing APIs unchanged on all
  platforms. behind_external_hub mirrors the Windows ancestry
  semantics via port-path depth.
- macOS explicitly unchanged (IOKit needs a mac host; documented).

Part of #1091 (Linux implementation + fixtures; macOS and
real-device validation runs remain).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 690b9990-4c46-4aee-b342-cff72cf75787

📥 Commits

Reviewing files that changed from the base of the PR and between c7351bf and be818e0.

📒 Files selected for processing (4)
  • crates/fbuild-serial/README.md
  • crates/fbuild-serial/src/lib.rs
  • crates/fbuild-serial/src/ports.rs
  • crates/fbuild-serial/src/sysfs_usb.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1091-linux-sysfs-usb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees
zackees merged commit d709b18 into main Jul 28, 2026
8 of 14 checks passed
@zackees
zackees deleted the feat/1091-linux-sysfs-usb branch July 28, 2026 06:04
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant