* [PATCH BlueZ 1/2] doc: Add CONFIG_RFKILL to the tester kernel config
@ 2026-10-21 7:21 Tobias Wilken
2026-10-21 7:21 ` [PATCH BlueZ 2/2] mgmt-tester: Add Set Powered test for rfkill block Tobias Wilken
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tobias Wilken @ 2026-10-21 7:21 UTC (permalink / raw)
To: linux-bluetooth
Needed by mgmt-tester to block a controller through /dev/rfkill.
Assisted-by: Claude:claude-opus-5-5
---
Notes:
As far as I understand, this is needed for the following mgmt-tester
patch: without CONFIG_RFKILL its new test is skipped instead of run.
Please correct me if I'm wrong.
doc/tester.config | 2 ++
1 file changed, 2 insertions(+)
diff --git a/doc/tester.config b/doc/tester.config
index 34f1530..a9d8de2 100644
--- a/doc/tester.config
+++ b/doc/tester.config
@@ -45,6 +45,8 @@ CONFIG_BT_MSFTEXT=y
CONFIG_BT_AOSPEXT=y
CONFIG_BT_FEATURE_DEBUG=y
+CONFIG_RFKILL=y
+
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_CMAC=y
CONFIG_CRYPTO_USER_API=y
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ 2/2] mgmt-tester: Add Set Powered test for rfkill block
2026-10-21 7:21 [PATCH BlueZ 1/2] doc: Add CONFIG_RFKILL to the tester kernel config Tobias Wilken
@ 2026-10-21 7:21 ` Tobias Wilken
2026-10-21 8:29 ` [BlueZ,1/2] doc: Add CONFIG_RFKILL to the tester kernel config bluez.test.bot
2026-10-23 22:20 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Tobias Wilken @ 2026-10-21 7:21 UTC (permalink / raw)
To: linux-bluetooth
Block the controller through /dev/rfkill and check that Set Powered
fails with RFKilled (0x12), the status bluetoothd handles for a
blocked adapter. Without rfkill support in the kernel the test is not
run.
Kernels since Linux commit cf75ad8b41d2 ("Bluetooth: hci_sync: Convert
MGMT_SET_POWERED") return Failed (0x03) instead; the fix is
"Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked
controller".
Assisted-by: Claude:claude-opus-5-5
---
Notes:
The new test passes with the kernel fix "Bluetooth: MGMT: Return
RFKILLED for Set Powered on a blocked controller", sent to
linux-bluetooth:
https://lore.kernel.org/r/20261021065833.120347-1-tooangel@tooangel.de
Results in test-runner with bluetooth-next: without the fix the test
fails ("got Failed (0x03) expected Blocked through rfkill (0x12)"),
with it mgmt-tester passes 515/515, and with a kernel built without
CONFIG_RFKILL the test is not run.
Hopefully this makes the kernel fix easy to verify.
tools/mgmt-tester.c | 82 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 631c906..528d8f7 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -22,6 +22,8 @@
#include <errno.h>
#include <unistd.h>
+#include <linux/rfkill.h>
+
#include <glib.h>
#include "bluetooth/bluetooth.h"
@@ -812,6 +814,13 @@ static const struct generic_data set_powered_on_invalid_index_test = {
.expect_status = MGMT_STATUS_INVALID_INDEX,
};
+static const struct generic_data set_powered_on_rfkill_test = {
+ .send_opcode = MGMT_OP_SET_POWERED,
+ .send_param = set_powered_on_param,
+ .send_len = sizeof(set_powered_on_param),
+ .expect_status = MGMT_STATUS_RFKILLED,
+};
+
static uint16_t settings_powered_advertising_privacy[] = {
MGMT_OP_SET_PRIVACY,
MGMT_OP_SET_ADVERTISING,
@@ -6579,6 +6588,51 @@ static void setup_bthost(void)
bthost_write_scan_enable(bthost, 0x03);
}
+static int rfkill_block(uint16_t index)
+{
+ struct rfkill_event ev;
+ char path[64], name[16], hci[16];
+ ssize_t len;
+ int fd, name_fd, err;
+
+ snprintf(hci, sizeof(hci), "hci%u", index);
+
+ fd = open("/dev/rfkill", O_RDWR | O_NONBLOCK | O_CLOEXEC);
+ if (fd < 0)
+ return -errno;
+
+ /* Reading /dev/rfkill returns an add event for each rfkill device */
+ while (read(fd, &ev, RFKILL_EVENT_SIZE_V1) == RFKILL_EVENT_SIZE_V1) {
+ snprintf(path, sizeof(path), "/sys/class/rfkill/rfkill%u/name",
+ ev.idx);
+
+ name_fd = open(path, O_RDONLY | O_CLOEXEC);
+ if (name_fd < 0)
+ continue;
+
+ len = read(name_fd, name, sizeof(name) - 1);
+ close(name_fd);
+ if (len <= 0)
+ continue;
+
+ name[len] = '\0';
+ name[strcspn(name, "\n")] = '\0';
+ if (strcmp(name, hci))
+ continue;
+
+ ev.op = RFKILL_OP_CHANGE;
+ ev.soft = 1;
+
+ len = write(fd, &ev, RFKILL_EVENT_SIZE_V1);
+ err = len == RFKILL_EVENT_SIZE_V1 ? 0 : -EIO;
+ close(fd);
+ return err;
+ }
+
+ close(fd);
+ return -ENODEV;
+}
+
static void setup_pairing_acceptor(const void *test_data)
{
struct test_data *data = tester_get_data();
@@ -12349,6 +12403,31 @@ static void test_command_generic(const void *test_data)
test_add_condition(data);
}
+static void test_command_rfkill_blocked(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ int err;
+
+ tester_print("Blocking controller through rfkill");
+
+ err = rfkill_block(data->mgmt_index);
+ if (err == -ENOENT) {
+ /* Kernel built without rfkill support */
+ tester_warn("No /dev/rfkill, skipping test");
+ tester_test_abort();
+ return;
+ }
+
+ if (err < 0) {
+ tester_warn("Failed to block hci%u through rfkill: %s",
+ data->mgmt_index, strerror(-err));
+ tester_test_failed();
+ return;
+ }
+
+ test_command_generic(test_data);
+}
+
static void global_adv_disable_hci_callback(uint16_t opcode,
const void *param, uint8_t length,
void *user_data)
@@ -14073,6 +14152,9 @@ int main(int argc, char *argv[])
test_bredrle("Set powered on - Invalid index",
&set_powered_on_invalid_index_test,
NULL, test_command_generic);
+ test_bredrle("Set powered on - Blocked by rfkill",
+ &set_powered_on_rfkill_test,
+ NULL, test_command_rfkill_blocked);
test_le("Set powered on - Privacy and Advertising",
&set_powered_on_privacy_adv_test,
NULL, test_command_generic);
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,1/2] doc: Add CONFIG_RFKILL to the tester kernel config
2026-10-21 7:21 [PATCH BlueZ 1/2] doc: Add CONFIG_RFKILL to the tester kernel config Tobias Wilken
2026-10-21 7:21 ` [PATCH BlueZ 2/2] mgmt-tester: Add Set Powered test for rfkill block Tobias Wilken
@ 2026-10-21 8:29 ` bluez.test.bot
2026-10-23 22:20 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-10-21 8:29 UTC (permalink / raw)
To: linux-bluetooth, tooangel
[-- Attachment #1: Type: text/plain, Size: 2218 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/1190272/
---Test result---
Test Summary:
CheckPatch FAIL 1.03 seconds
GitLint FAIL 0.68 seconds
BuildEll PASS 21.67 seconds
BluezMake PASS 297.51 seconds
MakeCheck PASS 14.61 seconds
MakeDistcheck PASS 144.71 seconds
CheckValgrind PASS 237.01 seconds
CheckSmatch PASS 296.29 seconds
bluezmakeextell PASS 99.64 seconds
TestFunctional PASS 1160.57 seconds
IncrementalBuild PASS 326.55 seconds
ScanBuild PASS 1154.43 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,2/2] mgmt-tester: Add Set Powered test for rfkill block
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id 'cf75ad8b41d2', maybe rebased or not pulled?
#126:
Kernels since Linux commit cf75ad8b41d2 ("Bluetooth: hci_sync: Convert
/home/runner/work/bluez/bluez/src/patch/14904693.patch total: 0 errors, 1 warnings, 112 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluez/bluez/src/patch/14904693.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,2/2] mgmt-tester: Add Set Powered test for rfkill block
20: B2 Line has trailing whitespace: " "
25: B2 Line has trailing whitespace: " "
https://github.com/bluez/bluez/pull/2698
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ 1/2] doc: Add CONFIG_RFKILL to the tester kernel config
2026-10-21 7:21 [PATCH BlueZ 1/2] doc: Add CONFIG_RFKILL to the tester kernel config Tobias Wilken
2026-10-21 7:21 ` [PATCH BlueZ 2/2] mgmt-tester: Add Set Powered test for rfkill block Tobias Wilken
2026-10-21 8:29 ` [BlueZ,1/2] doc: Add CONFIG_RFKILL to the tester kernel config bluez.test.bot
@ 2026-10-23 22:20 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-23 22:20 UTC (permalink / raw)
To: Tobias Wilken; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 21 Oct 2026 09:21:32 +0200 you wrote:
> Needed by mgmt-tester to block a controller through /dev/rfkill.
>
> Assisted-by: Claude:claude-opus-5-5
> ---
>
> Notes:
> As far as I understand, this is needed for the following mgmt-tester
> patch: without CONFIG_RFKILL its new test is skipped instead of run.
> Please correct me if I'm wrong.
>
> [...]
Here is the summary with links:
- [BlueZ,1/2] doc: Add CONFIG_RFKILL to the tester kernel config
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=48bb3b396980
- [BlueZ,2/2] mgmt-tester: Add Set Powered test for rfkill block
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1445a64e6b99
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] 4+ messages in thread
end of thread, other threads:[~2026-10-23 22:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 7:21 [PATCH BlueZ 1/2] doc: Add CONFIG_RFKILL to the tester kernel config Tobias Wilken
2026-10-21 7:21 ` [PATCH BlueZ 2/2] mgmt-tester: Add Set Powered test for rfkill block Tobias Wilken
2026-10-21 8:29 ` [BlueZ,1/2] doc: Add CONFIG_RFKILL to the tester kernel config bluez.test.bot
2026-10-23 22:20 ` [PATCH BlueZ 1/2] " 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