Skip to content

Commit 1afbe07

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: controller: Fix accept scan en/disable if already en/disabled
Conform to Bluetooth Specification, if the LE_Scan_Enable parameter is set to 0x01 and scanning is already enabled, any change to the Filter_Duplicates setting shall take effect. Disabling scanning when it is disabled has no effect. Fixes #31019. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 30de4b5 commit 1afbe07

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

subsys/bluetooth/controller/Kconfig.ll_sw_split

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ config BT_CTLR_SCAN_SYNC_ISO_SET
201201
help
202202
Maximum supported broadcast isochronous groups (BIGs) sync sets.
203203

204+
config BT_CTLR_SCAN_ENABLE_STRICT
205+
bool "Enforce Strict Scan Enable/Disable"
206+
depends on BT_OBSERVER
207+
help
208+
Enforce returning HCI Error Command Disallowed on enabling/disabling
209+
already enabled/disabled scanning.
210+
204211
config BT_CTLR_ZLI
205212
bool "Use Zero Latency IRQs"
206213
depends on ZERO_LATENCY_IRQS

subsys/bluetooth/controller/hci/hci.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,11 @@ static void le_set_scan_enable(struct net_buf *buf, struct net_buf **evt)
15021502
status = ll_scan_enable(cmd->enable);
15031503
#endif /* !CONFIG_BT_CTLR_ADV_EXT */
15041504

1505+
if (!IS_ENABLED(CONFIG_BT_CTLR_SCAN_ENABLE_STRICT) &&
1506+
(status == BT_HCI_ERR_CMD_DISALLOWED)) {
1507+
status = BT_HCI_ERR_SUCCESS;
1508+
}
1509+
15051510
*evt = cmd_complete_status(status);
15061511
}
15071512

@@ -2973,6 +2978,11 @@ static void le_set_ext_scan_enable(struct net_buf *buf, struct net_buf **evt)
29732978

29742979
status = ll_scan_enable(cmd->enable, cmd->duration, cmd->period);
29752980

2981+
if (!IS_ENABLED(CONFIG_BT_CTLR_SCAN_ENABLE_STRICT) &&
2982+
(status == BT_HCI_ERR_CMD_DISALLOWED)) {
2983+
status = BT_HCI_ERR_SUCCESS;
2984+
}
2985+
29762986
*evt = cmd_complete_status(status);
29772987
}
29782988

0 commit comments

Comments
 (0)