feat(serial): Linux sysfs USB health/topology enrichment (#1091) - #1207
Conversation
- 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>
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
sysfs_usbparses a rooted directory tree; onlylive_root()(/sys/bus/usb/devices) is Linux-gated. Interfaces are detected structurally (subdirectory containingbInterfaceClass) 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.Unknownnever fabricated):PresentProblemonly on concrete signals (authorized=0, unconfigured, CDC interface with no bound driver) using documented Linux-only problem codes explicitly unrelated to WindowsCM_PROB_*; healthy requires a bound tty interface; everything ambiguous staysUnknown. The WindowsUsbProblemDeviceshape is not abused — Linux gets a distinct diagnostics-onlyLinuxUsbProblemDevice+present_usb_problem_devices_linux(); existing APIs behave identically on all platforms.behind_external_hubmirrors the Windows ancestry classification via port-path depth (1-1root-attached vs1-1.4behind a hub).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 warningsclean; dependents (fbuild-daemon,fbuild-cli) check clean; fullbash testbefore merge.Part of #1091 — remaining: macOS (IOKit) and the real-device validation runs on both platforms.
🤖 Generated with Claude Code