From b397a950c5d26cec38e8fa9496e2a2ea6066712e Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 9 Jun 2022 16:52:44 +0530 Subject: [PATCH] Bluetooth: Controller: Fix missing reset of coded PHY scanning When switching from Extended Scanning by Extended Advertising HCI commands back to Legacy Scanning after a HCI reset it is required that the coded PHY scanning context is reset. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/hci/hci.c | 5 +++-- subsys/bluetooth/controller/ll_sw/ull_scan.c | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 075f04bfc24..46e80939171 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -4009,8 +4009,9 @@ static void le_ext_create_connection(struct net_buf *buf, struct net_buf **evt) uint8_t type; type = (phy << 1); - /* NOTE: Pass invalid interval value to not start - * scanning using this scan instance. + /* NOTE: Pass invalid interval value to reset the PHY + * value in the scan instance so not to start + * scanning on the unselected PHY. */ status = ll_scan_params_set(type, 0, 0, 0, 0); } diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan.c b/subsys/bluetooth/controller/ll_sw/ull_scan.c index cc15e88c161..de5093d442d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan.c @@ -325,6 +325,14 @@ int ull_scan_reset(void) for (handle = 0U; handle < BT_CTLR_SCAN_SET; handle++) { (void)disable(handle); + +#if defined(CONFIG_BT_CTLR_ADV_EXT) + /* Initialize PHY value to 0 to not start scanning on the scan + * instance if an explicit ll_scan_params_set() has not been + * invoked from HCI to enable scanning on that PHY. + */ + ll_scan[handle].lll.phy = 0U; +#endif /* CONFIG_BT_CTLR_ADV_EXT */ } if (IS_ENABLED(CONFIG_BT_CTLR_ADV_EXT)) {