Repository navigation
fix: report the rfkill state by the kernel's own names, not an inverted guess - #11
Conversation
…ed guess The silent-controller hint labelled `state=1` as "blocked". The kernel ABI (Documentation/ABI/stable/sysfs-class-rfkill) is the other way round: 0 = SOFT_BLOCKED, 1 = UNBLOCKED, 2 = HARD_BLOCKED. So the one message a human reads when the controller goes quiet said the opposite of the truth, and sent a HIL debugging session after an rfkill block that was not there — the bench adapter reads 1, i.e. unblocked, and something else is keeping it silent. Report the value under the names the kernel uses, and pass anything unexpected through verbatim instead of guessing. The selftest pins all three states plus an empty and an out-of-range value, so the mapping cannot flip again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
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 |
There was a problem hiding this comment.
🟢 Approval recommended
The corrected mapping matches the documented kernel ABI and is adequately covered by self-tests.
0 open findings
What changed in this PR
Corrects rfkill diagnostics to report kernel-defined state names instead of an inverted interpretation.
Changes:
- Maps rfkill values
0,1, and2to their kernel names. - Preserves unexpected values and reports unreadable paths.
- Adds self-tests covering valid, invalid, empty, and unreadable states.
| File | Description |
|---|---|
ble_flood.py |
Corrects rfkill diagnostics and adds regression coverage. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Why
_silent_hintlabels the rfkill state1as "blocked". The kernel ABI is the opposite:Documentation/ABI/stable/sysfs-class-rfkilldefinesstateas0 = RFKILL_STATE_SOFT_BLOCKED,1 = RFKILL_STATE_UNBLOCKED,2 = RFKILL_STATE_HARD_BLOCKED.That inversion matters because this is the one message a human reads when the controller goes quiet. It printed:
for a file that read
1, i.e. unblocked. A HIL debugging session (mine) went after an rfkill block that was not there. Note this is a pre-existing bug, not introduced by the heartbeat fix.What changed
Report the value under the names the kernel uses, and pass anything unexpected through verbatim rather than guessing. Hint text now says "soft or hard block" so it covers
2as well.Verification
Selftest pins
0 -> SOFT_BLOCKED,1 -> UNBLOCKED,2 -> HARD_BLOCKED, an empty value, an out-of-range value, and an unreadable path. The old mapping fails all three named states.What this does not do
It does not fix the HIL. The bench adapter genuinely is not rfkill-blocked, so the silent controller has another cause (autosuspend / wedged dongle), which is a host condition. This just stops the diagnosis from lying about which one it is.
🤖 Generated with Claude Code