You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(usb): validate port scanning parity on macOS and Linux #1091
Context\n\nfbuild USB/serial scanning and diagnostics have currently been exercised on Windows only. The new failed-USB warning path uses Windows SetupAPI/CfgMgr32 and is intentionally empty on non-Windows, but the broader USB scan, CDC classification, bootloader detection, and port enumeration paths also need explicit cross-platform validation. macOS and Linux may expose different device names, metadata, topology, and failure states.\n\n## Proposal\n\nAudit the USB-related host scanning paths for macOS and Linux, implement platform-specific equivalents where appropriate, and establish parity tests so supported platform USB devices are discovered and classified consistently. Ensure unsupported host diagnostics degrade clearly without breaking normal port scans.\n\n## Acceptance criteria\n\n- Run build port scan on supported macOS and Linux environments with representative RP2040 CDC, RP2040 BOOTSEL/MSC, native CDC, and USB-UART bridge devices.\n- Verify serial port enumeration, VID/PID and serial extraction, CDC/bridge classification, and bootloader re-enumeration behavior on both platforms.\n- Determine how each platform exposes failed USB devices and hub/topology information; implement actionable nonfatal diagnostics where the host APIs provide it.\n- Add platform-appropriate unit/integration tests and fixtures for successful, missing, and failed USB nodes.\n- Document any unavoidable platform differences and ensure unsupported diagnostics never pretend to identify an unknown device.\n- Run the relevant host test suites on macOS and Linux in CI or documented hardware validation environments.\n\n## Related issues\n\n- Parent: #1049\n- Current Windows failed-USB diagnostic: #1087\n- Meta: FastLED/FastLED#3648
Progress: the Linux implementation is merged via #1207 (squash on main).
Delivered: sysfs-based USB health/topology enrichment — platform-neutral parser over a rooted /sys/bus/usb/devices tree (all logic fixture-tested on any OS; 15 fixture tests covering healthy CDC, hub-vs-root topology, unauthorized, unconfigured, driverless CDC interface, malformed/partial entries, unowned ttys). Health mapping is conservative per #1149's invariants: concrete sysfs signals only, documented Linux-only problem codes distinct from Windows CM_PROB_*, everything ambiguous stays Unknown, and the Windows UsbProblemDevice shape is not reused (Linux gets a distinct diagnostics type + present_usb_problem_devices_linux()).
Remaining before this issue can close (host/hardware-gated):
Real-device validation runs on Linux with representative RP2040 CDC / BOOTSEL-MSC / native-CDC / USB-UART bridge devices (the acceptance criteria's enumeration/classification/re-enumeration checks). The agents/docs/serial-testing.md Docker/WSL harness is the likely vehicle.
macOS: IOKit equivalents + validation need a Mac host; scanning there remains explicitly Unknown-health (documented, never fabricated).
Linux cell re-verified on real hardware (2026-11-25T15:4xZ) — and it found a wiring defect, not just an untested path.
Attached on this host: Espressif ESP32-C6 USB-JTAG (303A:1001, sysfs 5-2.2.3.3) + NXP LPC11U3x CMSIS-DAP (1FC9:0132, sysfs 5-4). No RP2040, no USB-UART bridge, no macOS host.
What is correct on Linux today (fbuild port scan, main 8f5979e1 + this branch):
Enumeration, VID/PID, serial and composite interface index: 303A:1001 ser=8C:BF:EA:CF:87:B4 if=MI_00, 1FC9:0132 ser=0B03400A if=MI_01.
CDC classification is honest: the DAP's tty sits on interface class 02/02/00 → cdc=yes; sysfs confirms 5-4:1.0 is HID 03, 5-4:1.1 is CDC-COMM 02 with the tty, 5-4:1.2 is MSC 0a. No device is claimed as CDC without a CDC interface.
Live sysfs health enrichment reports health=healthy for both, and health=unknown (never phantom) for the four non-USB ttyS* ports.
Defect found in AC3's diagnostics half:fbuild_serial::ports::present_usb_problem_devices_linux() (the sysfs collector delivered by #1207) had no callers anywhere in the workspace — its Windows sibling is wired into port scan, port doctor, the daemon deploy path and the rp2040 preflight, the Linux one was dead code. Reproduced on real hardware by unbinding cdc_acm from the ESP32-C6 CDC interface (5-2.2.3.3:1.0):
before: ttyACM vanished from the table and the scan printed no diagnostic at all — exactly the "board is plugged in, nothing shows up" case this issue is about;
after the fix: warning: Linux reports present USB device(s) with an observed fault … - 303A:1001 (USB JTAG/serial debug unit) at 5-2.2.3.3: CDC interface has no bound driver (sysfs code 3) plus the modprobe -r cdc_acm remedy;
after rebinding the driver: 2 USB ports, 0 warnings (no false positive on a healthy bench).
Delivered as #2184 (unmerged): port scan now asks both host surfaces and prints one nonfatal block per surface that reported a fault; Windows wording unchanged. Gates: soldr cargo test -p fbuild-cli --bin fbuild port_scan → 34 passed / 0 failed (11 new, incl. two driving the composed scan_report), clippy -D warnings clean, fmt --check clean.
Still open (hardware/host-gated, none attached here): RP2040 in CDC and in BOOTSEL/MSC (bootloader re-enumeration), a USB-UART bridge, and macOS (IOKit; this issue's own comment notes it is out of scope without a macOS host). No close keyword — #1091 stays open.
Merged. The Linux diagnostics wiring from the comment above landed on main as 9d94ad24 (PR #2184, squash-merged 2026-11-25T17:31:11Z through the merge queue; merge-group ci-minimal run 45661012613 completed success, and the PR's own run was green on all 24 checks including CI summary / linux / Check / Dylint Full / Python facade tests).
Delivered on main now:
crates/fbuild-cli/src/cli/port_scan_usb_problems.rs — both host surfaces asked; format_linux_usb_problem_warning() names the sysfs path, VID:PID, product, fault code and topology plus the one remedy for that code.
port_scan.rs composes both halves inside scan_report(), the single call run_scan makes, so a test fails if the Linux collector is dropped again.
Gates on the branch: soldr cargo test -p fbuild-cli --bin fbuild port_scan → 34 passed / 0 failed (11 new), clippy --all-targets -D warnings clean, fmt --check clean. Real-hardware proof: with cdc_acm unbound on the ESP32-C6, the scan printed the fault node and its remedy where it previously printed nothing; after rebind, 2 USB ports and 0 warnings.
#1091 stays open — remaining cells are unchanged and all hardware-gated: an RP2040 in CDC and BOOTSEL/MSC, a USB-UART bridge device, and a macOS host. None are attached here (ESP32-C6 + LPC11U3x CMSIS-DAP only).
Steward tick 2026-11-27T08:4xZ — recording a hardware block so this stops being nominated as actionable work.
Already delivered (Linux):#2184 (9d94ad24, squash-merged 2026-11-25T17:31:11Z through the merge queue) brought the sysfs-based USB health/topology surface and the diagnostics wiring into fbuild port scan; the Linux cell was re-verified on real hardware on 2026-11-25 against this host's attached devices.
What the remaining acceptance criteria need, and what is attached right now: a macOS host (every macOS cell), an RP2040 in CDC mode, an RP2040 in BOOTSEL/MSC mode, and a USB-UART bridge. Attached on this host at 2026-11-27T08:2xZ: Espressif ESP32-C6 USB-JTAG (303A:1001, /dev/ttyACM1) and NXP LPC11U3x CMSIS-DAP (1FC9:0132, /dev/ttyACM0). No RP2040, no RPI-RP2 volume, no USB-UART bridge, no macOS host — so enumeration/classification/bootloader-re-enumeration parity cannot be exercised for the device classes the issue names.
Blocking as hardware. Re-verify with --unblock-issue 1091 when an RP2040 (CDC + BOOTSEL), a USB-UART bridge, or a macOS runner is available.
Activity
feat(serial): Linux sysfs USB health/topology enrichment (#1091) (#1207)
zackees commentedon Jul 28, 2026
Progress: the Linux implementation is merged via #1207 (
squashon main).Delivered: sysfs-based USB health/topology enrichment — platform-neutral parser over a rooted
/sys/bus/usb/devicestree (all logic fixture-tested on any OS; 15 fixture tests covering healthy CDC, hub-vs-root topology, unauthorized, unconfigured, driverless CDC interface, malformed/partial entries, unowned ttys). Health mapping is conservative per #1149's invariants: concrete sysfs signals only, documented Linux-only problem codes distinct from WindowsCM_PROB_*, everything ambiguous staysUnknown, and the WindowsUsbProblemDeviceshape is not reused (Linux gets a distinct diagnostics type +present_usb_problem_devices_linux()).Remaining before this issue can close (host/hardware-gated):
Unknown-health (documented, never fabricated).zackees commentedon Nov 25, 2026
Linux cell re-verified on real hardware (2026-11-25T15:4xZ) — and it found a wiring defect, not just an untested path.
Attached on this host: Espressif ESP32-C6 USB-JTAG (303A:1001, sysfs
5-2.2.3.3) + NXP LPC11U3x CMSIS-DAP (1FC9:0132, sysfs5-4). No RP2040, no USB-UART bridge, no macOS host.What is correct on Linux today (
fbuild port scan, main8f5979e1+ this branch):303A:1001 ser=8C:BF:EA:CF:87:B4 if=MI_00,1FC9:0132 ser=0B03400A if=MI_01.02/02/00→cdc=yes; sysfs confirms5-4:1.0is HID03,5-4:1.1is CDC-COMM02with the tty,5-4:1.2is MSC0a. No device is claimed as CDC without a CDC interface.health=healthyfor both, andhealth=unknown(neverphantom) for the four non-USBttyS*ports.--offline) names both:Espressif Systems,NXP Semiconductors / NXP LPC-Link2 (CMSIS-DAP debug probe).Defect found in AC3's diagnostics half:
fbuild_serial::ports::present_usb_problem_devices_linux()(the sysfs collector delivered by #1207) had no callers anywhere in the workspace — its Windows sibling is wired intoport scan,port doctor, the daemon deploy path and the rp2040 preflight, the Linux one was dead code. Reproduced on real hardware by unbindingcdc_acmfrom the ESP32-C6 CDC interface (5-2.2.3.3:1.0):ttyACMvanished from the table and the scan printed no diagnostic at all — exactly the "board is plugged in, nothing shows up" case this issue is about;warning: Linux reports present USB device(s) with an observed fault … - 303A:1001 (USB JTAG/serial debug unit) at 5-2.2.3.3: CDC interface has no bound driver (sysfs code 3)plus themodprobe -r cdc_acmremedy;Delivered as #2184 (unmerged):
port scannow asks both host surfaces and prints one nonfatal block per surface that reported a fault; Windows wording unchanged. Gates:soldr cargo test -p fbuild-cli --bin fbuild port_scan→ 34 passed / 0 failed (11 new, incl. two driving the composedscan_report), clippy-D warningsclean,fmt --checkclean.Still open (hardware/host-gated, none attached here): RP2040 in CDC and in BOOTSEL/MSC (bootloader re-enumeration), a USB-UART bridge, and macOS (IOKit; this issue's own comment notes it is out of scope without a macOS host). No close keyword — #1091 stays open.
zackees commentedon Nov 25, 2026
Merged. The Linux diagnostics wiring from the comment above landed on
mainas9d94ad24(PR #2184, squash-merged 2026-11-25T17:31:11Z through the merge queue; merge-groupci-minimalrun 45661012613 completedsuccess, and the PR's own run was green on all 24 checks includingCI summary/linux / Check/Dylint Full/ Python facade tests).Delivered on
mainnow:crates/fbuild-cli/src/cli/port_scan_usb_problems.rs— both host surfaces asked;format_linux_usb_problem_warning()names the sysfs path, VID:PID, product, fault code and topology plus the one remedy for that code.port_scan.rscomposes both halves insidescan_report(), the single callrun_scanmakes, so a test fails if the Linux collector is dropped again.soldr cargo test -p fbuild-cli --bin fbuild port_scan→ 34 passed / 0 failed (11 new),clippy --all-targets -D warningsclean,fmt --checkclean. Real-hardware proof: withcdc_acmunbound on the ESP32-C6, the scan printed the fault node and its remedy where it previously printed nothing; after rebind, 2 USB ports and 0 warnings.#1091 stays open — remaining cells are unchanged and all hardware-gated: an RP2040 in CDC and BOOTSEL/MSC, a USB-UART bridge device, and a macOS host. None are attached here (ESP32-C6 + LPC11U3x CMSIS-DAP only).
zackees commentedon Nov 27, 2026
Steward tick 2026-11-27T08:4xZ — recording a hardware block so this stops being nominated as actionable work.
Already delivered (Linux):
#2184(9d94ad24, squash-merged 2026-11-25T17:31:11Z through the merge queue) brought the sysfs-based USB health/topology surface and the diagnostics wiring intofbuild port scan; the Linux cell was re-verified on real hardware on 2026-11-25 against this host's attached devices.What the remaining acceptance criteria need, and what is attached right now: a macOS host (every macOS cell), an RP2040 in CDC mode, an RP2040 in BOOTSEL/MSC mode, and a USB-UART bridge. Attached on this host at 2026-11-27T08:2xZ: Espressif ESP32-C6 USB-JTAG (
303A:1001,/dev/ttyACM1) and NXP LPC11U3x CMSIS-DAP (1FC9:0132,/dev/ttyACM0). No RP2040, no RPI-RP2 volume, no USB-UART bridge, no macOS host — so enumeration/classification/bootloader-re-enumeration parity cannot be exercised for the device classes the issue names.Blocking as
hardware. Re-verify with--unblock-issue 1091when an RP2040 (CDC + BOOTSEL), a USB-UART bridge, or a macOS runner is available.