From c17c33fe78aed206932388bbdb3b1fa18bdc93cd Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 16 Sep 2022 10:22:51 -0500 Subject: [PATCH] drv/bluetooth_stm32_bluenrg: use random address This changes the driver to use a random Bluetooth address when advertising/accepting connections. This will help prevent issues with Bluetooth stacks caching the attribute database of the official LEGO firmware and trying to use it for the Pybricks firmware or vice versa. The Bluetooth chip appears to use the same random address after each reset, so we don't get the full benefit avoiding caching issues when the Pybricks firmware GATT database changes. Issue: https://github.com/pybricks/support/issues/600 --- lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c b/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c index ed8699df1..187626493 100644 --- a/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c +++ b/lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c @@ -269,7 +269,7 @@ static PT_THREAD(set_discoverable(struct pt *pt, pbio_task_t *task)) { hci_le_set_scan_response_data_end(); PT_WAIT_WHILE(pt, write_xfer_size); - aci_gap_set_discoverable_begin(ADV_IND, 0, 0, PUBLIC_ADDR, NO_WHITE_LIST_USE, + aci_gap_set_discoverable_begin(ADV_IND, 0, 0, RANDOM_ADDR, NO_WHITE_LIST_USE, 0, NULL, sizeof(service_uuids), service_uuids, 0, 0); PT_WAIT_UNTIL(pt, hci_command_complete); aci_gap_set_discoverable_end();