Repository navigation
fix(port scan): report Linux USB fault nodes instead of dropping them - #2184
Merged
Merged
Conversation
`present_usb_problem_devices_linux()` (sysfs: unauthorized, unconfigured, driverless CDC interface) was delivered by #1207 for #1091 but never called from any user-facing surface, so a present-but-faulty USB device produced no output at all: it exposes no tty, so it is missing from the port table, and `port scan` printed "no serial ports visible" with no explanation. `port scan` now asks both host surfaces and prints one nonfatal diagnostic block per surface that reported a fault. The Windows wording is unchanged (moved verbatim); the Linux block names the sysfs path, VID:PID, product, fault code, and the one remedy for that code. A node whose descriptors the kernel did not expose is reported as unidentified rather than named from a shared VID. Verified on real hardware: unbound cdc_acm from the attached ESP32-C6 CDC interface (303A:1001, sysfs 5-2.2.3.3) -> ttyACM disappeared and the new build printed the driverless-CDC warning naming that path; rebinding the driver returned a clean table with no warning.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
fbuild port scanis the command users run when a board does not show up. On Linux a present-but-faulty USB node exposes no tty, so it is absent from the port table — and until now nothing else spoke either: the scan printedno serial ports visibleand stopped.The sysfs fault collector for this already existed and was correct.
fbuild_serial::ports::present_usb_problem_devices_linux()(delivered by #1207 for #1091) maps unauthorized / unconfigured / driverless-CDC nodes. Its Windows siblingpresent_usb_problem_devices()is wired intoport scan,port doctor, the daemon deploy path and the rp2040 preflight; the Linux one had zero callers anywhere in the workspace, so the diagnostics half of #1091's AC3 was dead code.What changed
crates/fbuild-cli/src/cli/port_scan_usb_problems.rs:UsbProblemSources+collect_usb_problem_sources()ask both host surfaces (each returns an emptyVecoff its own platform).usb_problem_diagnostics()emits one block per surface that reported faults; the Windows text is moved verbatim fromport_scan.rs.format_linux_usb_problem_warning()names the sysfs path, VID:PID, product string, fault code and topology, then the one remedy for that code (authorize / replug /modprobe -r cdc_acm). Unidentified nodes are reported asunidentified USB node— never labelled from a shared VID.port_scan.rscomposes both halves inscan_report(), the single callrun_scanmakes, so a test fails if the Linux collector is ever dropped again. Net −16 lines in that file despite the new behaviour.Diagnostics only: no
PortHealthchange, no port-selection change, an empty list still means "nothing was reported", not "healthy".Verification
Real hardware, attached ESP32-C6 (303A:1001) at sysfs
5-2.2.3.3,cdc_acmunbound from its CDC communication interface:Same command before the change, same device state:
ttyACMgone and no diagnostic at all. After rebinding the driver: 2 USB ports, 0 warnings (no false positive on a healthy bench).Gates:
soldr cargo test -p fbuild-cli --bin fbuild port_scan→ 34 passed; 0 failed (11 of them new: 9 in the new module, 2 drivingscan_reportend to end),soldr cargo clippy -p fbuild-cli --bin fbuild --all-targets -- -D warnings→ clean,soldr cargo fmt --check→ clean.#1091 stays open: remaining cells need an RP2040 in CDC and BOOTSEL/MSC, a USB-UART bridge device, and a macOS host, none of which are attached here.