* [PATCH] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
@ 2026-10-21 6:58 Tobias Wilken
2026-10-21 12:57 ` bluez.test.bot
2026-10-23 22:10 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Tobias Wilken @ 2026-10-21 6:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Marcel Holtmann, linux-kernel
Since MGMT_OP_SET_POWERED runs through hci_cmd_sync, powering on a
controller that is blocked by rfkill fails with -ERFKILL from
hci_dev_open_sync(), and mgmt_set_powered_complete() reports it with
mgmt_status(err). mgmt_errno_status() has no case for -ERFKILL, so
userspace gets MGMT_STATUS_FAILED instead of MGMT_STATUS_RFKILLED.
Before that conversion, power on went through hci_power_on(), whose
error path mgmt_set_powered_failed() still maps -ERFKILL to
MGMT_STATUS_RFKILLED. bluetoothd relies on that status: for
RFKILLED it sets the adapter PowerState to "off-blocked" and returns
org.bluez.Error.Blocked for the Powered property, for any other status
it returns org.bluez.Error.Failed.
With the controller soft blocked, "bluetoothctl power on" printed
"Failed to set power on: org.bluez.Error.Failed" and btmon showed
"Set Powered (0x0005) Status: Failed (0x03)". With this change it
prints org.bluez.Error.Blocked and btmon shows "Status: RFKilled
(0x12)".
Map -ERFKILL to MGMT_STATUS_RFKILLED in mgmt_errno_status().
Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED")
Assisted-by: LLM
Signed-off-by: Tobias Wilken <tooangel@tooangel.de>
---
Notes:
Tested on Debian's 7.2.9 kernel with a soft blocked MediaTek MT7922
(btusb) and on bluetooth-next in test-runner. mgmt-tester passes
515/515 with this patch; the new test "Set powered on - Blocked by
rfkill" fails without it (Failed (0x03) instead of RFKilled (0x12)).
The test is sent to BlueZ separately as "mgmt-tester: Add Set Powered
test for rfkill block".
Not tested with a hard (hardware) rfkill block.
This is my first kernel patch, so I'm happy about any feedback, also
on whether it fits the conventions here.
net/bluetooth/mgmt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3b9c82bd2f0..0f93e9e2728 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -304,6 +304,8 @@ static u8 mgmt_errno_status(int err)
return MGMT_STATUS_DISCONNECTED;
case -ECANCELED:
return MGMT_STATUS_CANCELLED;
+ case -ERFKILL:
+ return MGMT_STATUS_RFKILLED;
}
return MGMT_STATUS_FAILED;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
2026-10-21 6:58 [PATCH] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Tobias Wilken
@ 2026-10-21 12:57 ` bluez.test.bot
2026-10-23 22:10 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-10-21 12:57 UTC (permalink / raw)
To: linux-bluetooth, tooangel
[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1190246/
---Test result---
Test Summary:
CheckPatch PASS 0.63 seconds
VerifyFixes PASS 0.26 seconds
VerifySignedoff PASS 0.14 seconds
GitLint FAIL 0.27 seconds
SubjectPrefix PASS 0.10 seconds
BuildKernel PASS 18.15 seconds
CheckAllWarning PASS 20.75 seconds
CheckSparse PASS 23.78 seconds
BuildKernel32 PASS 19.03 seconds
CheckKernelLLVM PASS 20.97 seconds
TestRunnerSetup PASS 404.56 seconds
TestRunner_mgmt-tester PASS 80.42 seconds
TestRunner_mesh-tester PASS 4.98 seconds
IncrementalBuild PASS 17.38 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
35: B2 Line has trailing whitespace: " "
37: B2 Line has trailing whitespace: " "
https://github.com/bluez/bluetooth-next/pull/970
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
2026-10-21 6:58 [PATCH] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Tobias Wilken
2026-10-21 12:57 ` bluez.test.bot
@ 2026-10-23 22:10 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-23 22:10 UTC (permalink / raw)
To: Tobias Wilken; +Cc: linux-bluetooth, luiz.dentz, marcel, linux-kernel
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 21 Oct 2026 08:58:33 +0200 you wrote:
> Since MGMT_OP_SET_POWERED runs through hci_cmd_sync, powering on a
> controller that is blocked by rfkill fails with -ERFKILL from
> hci_dev_open_sync(), and mgmt_set_powered_complete() reports it with
> mgmt_status(err). mgmt_errno_status() has no case for -ERFKILL, so
> userspace gets MGMT_STATUS_FAILED instead of MGMT_STATUS_RFKILLED.
>
> Before that conversion, power on went through hci_power_on(), whose
> error path mgmt_set_powered_failed() still maps -ERFKILL to
> MGMT_STATUS_RFKILLED. bluetoothd relies on that status: for
> RFKILLED it sets the adapter PowerState to "off-blocked" and returns
> org.bluez.Error.Blocked for the Powered property, for any other status
> it returns org.bluez.Error.Failed.
>
> [...]
Here is the summary with links:
- Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
https://git.kernel.org/bluetooth/bluetooth-next/c/65683fbed5c8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-23 22:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 6:58 [PATCH] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Tobias Wilken
2026-10-21 12:57 ` bluez.test.bot
2026-10-23 22:10 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox