Skip to content

Commit 8c9f686

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'bugfix/cod_chg_by_scan_ena_v5.5' into 'release/v5.5'
fix(bt/bluedroid): update the COD before enabling inquiry scan (v5.5) See merge request espressif/esp-idf!43237
2 parents ad9b680 + 79ae28f commit 8c9f686

File tree

1 file changed

+7
-7
lines changed
  • components/bt/host/bluedroid/stack/btm

1 file changed

+7
-7
lines changed

components/bt/host/bluedroid/stack/btm/btm_inq.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,6 @@ tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 inter
240240
scan_mode |= HCI_PAGE_SCAN_ENABLED;
241241
}
242242

243-
if (btsnd_hcic_write_scan_enable (scan_mode)) {
244-
btm_cb.btm_inq_vars.discoverable_mode &= (~BTM_DISCOVERABLE_MASK);
245-
btm_cb.btm_inq_vars.discoverable_mode |= inq_mode;
246-
} else {
247-
return (BTM_NO_RESOURCES);
248-
}
249-
250243
/* Change the service class bit if mode has changed */
251244
p_cod = BTM_ReadDeviceClass();
252245
BTM_COD_SERVICE_CLASS(service_class, p_cod);
@@ -266,6 +259,13 @@ tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 inter
266259
(void) BTM_SetDeviceClass (cod);
267260
}
268261

262+
if (btsnd_hcic_write_scan_enable (scan_mode)) {
263+
btm_cb.btm_inq_vars.discoverable_mode &= (~BTM_DISCOVERABLE_MASK);
264+
btm_cb.btm_inq_vars.discoverable_mode |= inq_mode;
265+
} else {
266+
return (BTM_NO_RESOURCES);
267+
}
268+
269269
return (BTM_SUCCESS);
270270
}
271271

0 commit comments

Comments
 (0)