Skip to content

fix: report the rfkill state by the kernel's own names, not an inverted guess - #11

Merged
DTTerastar merged 1 commit into
mainfrom
fix/rfkill-state-label
Oct 11, 2026
Merged

DTTerastar merged 1 commit into
mainfrom
fix/rfkill-state-label

Conversation

@DTTerastar

Copy link
Copy Markdown
Contributor

Why

_silent_hint labels the rfkill state 1 as "blocked". The kernel ABI is the opposite: Documentation/ABI/stable/sysfs-class-rfkill defines state as 0 = 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:

rfkill: /sys/class/bluetooth/hci0/rfkill0/state=blocked

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 2 as 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

…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>
Copilot AI balanced review requested due to automatic review settings October 11, 2026 05:57
@coderabbitai

coderabbitai Bot commented Oct 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e121557-c21c-4fd5-8486-93c5cf6e32a8

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce02b2 and a008ab5.


📒 Files selected for processing (1)
  • ble_flood.py

  • 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

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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, and 2 to 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.

@DTTerastar
DTTerastar merged commit 0f0802f into main Oct 11, 2026
3 checks passed
@DTTerastar
DTTerastar deleted the fix/rfkill-state-label branch October 11, 2026 14:05
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