Skip to content

flood: snapshot the USB bus in the ENODEV hint - #18

Merged
DTTerastar merged 1 commit into
mainfrom
fix/espa-486-usb-snapshot-on-enodev
Nov 6, 2026
Merged

DTTerastar merged 1 commit into
mainfrom
fix/espa-486-usb-snapshot-on-enodev

Conversation

@Terastar-Paperclip

Copy link
Copy Markdown
Contributor

Context

ESPA-486 tracks a regression on top of the ESPA-217 fix (#1/#2/#3/#9/#13): ble-flood now fails instantly on bind with ENODEV ("No such device") instead of the old EBUSY ("Device or resource busy"). Seen on ESPresense/ESPresense#2631's HIL pipeline 1867, on both the original run and a rerun-step retry a few minutes later — not a transient race, hci0 is just gone at the moment the container starts.

open_adapter() already fails ENODEV immediately (it's not in the EBUSY retry set — correct, no amount of waiting grants a missing device), and _bind_hint() already names the two config-level causes (no adapter / wrong netns). That part isn't broken. What's missing is evidence for the host-level cause: is the USB dongle gone from the bus entirely (power/cable/hub — rack work), or still enumerated with only the kernel's btusb binding gone (a driver problem)? Nobody has bench SSH on this task (same limit as ESPA-217), and the CI log is the only artifact anyone can see.

Change

Add _usb_snapshot() — a one-line-per-device read of /sys/bus/usb/devices (vendor:product + label, pure stdlib, no new deps, matching this repo's existing _rfkill_state pattern) — and fold it into the ENODEV branch of _bind_hint(). The next time this fires, the captured ble-flood step log carries the USB topology at failure time instead of requiring someone with bench access to go look.

Selftest covers: empty bus, a populated bus (device vs. interface entries), an unreadable root, and that the snapshot text actually rides along in the ENODEV hint.

$ python3 ble_flood.py --selftest
selftest OK

Not fixed here

The actual host-level cause (why hci0 vanished) still needs whoever has physical/SSH access to the HIL bench — this PR only makes the next occurrence self-diagnosing from the CI log. Tracked on ESPA-486.

ble-flood's ENODEV message already told whoever reads it to check
`ls /sys/class/bluetooth` on the host, but that host console isn't
reachable from where a HIL pipeline's log is captured, and ENODEV
covers two different faults: the dongle fell off the USB bus entirely
(power/cable/hub - rack work) or it is still enumerated and only
btusb's binding is gone (a driver problem). Nothing in the CI log told
those two apart.

Add _usb_snapshot(), a one-line-per-device read of
/sys/bus/usb/devices, and fold it into the ENODEV hint so the next
"No such device" failure carries that evidence in the captured step
log instead of needing bench SSH to tell which fault it is.

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

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ef526f5-061c-4129-a9a7-962368dfd66e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions
github-actions Bot requested a review from DTTerastar November 5, 2026 17:43
@DTTerastar
DTTerastar merged commit 1cc5efe into main Nov 6, 2026
3 checks passed
@DTTerastar
DTTerastar deleted the fix/espa-486-usb-snapshot-on-enodev branch November 6, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants