From ff1a206c60bab2b2013c86189e2cfd7a800c17bc Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Sun, 24 Dec 2023 18:11:37 +0800 Subject: [PATCH] Support non-directed address generation offload --- bumble/device.py | 10 ++++++++++ bumble/smp.py | 6 ++---- setup.cfg | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bumble/device.py b/bumble/device.py index 3d4b59a29..fd2b0b639 100644 --- a/bumble/device.py +++ b/bumble/device.py @@ -1582,6 +1582,16 @@ async def refresh_resolving_list(self) -> None: if self.address_resolution_offload: await self.send_command(HCI_LE_Clear_Resolving_List_Command()) + # Add an empty entry for non-directed address generation. + await self.send_command( + HCI_LE_Add_Device_To_Resolving_List_Command( + peer_identity_address_type=Address.ANY.address_type, + peer_identity_address=Address.ANY, + peer_irk=bytes(16), + local_irk=self.irk, + ) + ) + for irk, address in resolving_keys: await self.send_command( HCI_LE_Add_Device_To_Resolving_List_Command( diff --git a/bumble/smp.py b/bumble/smp.py index b2d980621..73fd439ec 100644 --- a/bumble/smp.py +++ b/bumble/smp.py @@ -1993,10 +1993,8 @@ async def on_pairing( ) -> None: # Store the keys in the key store if self.device.keystore and identity_address is not None: - self.device.abort_on( - 'flush', self.device.update_keys(str(identity_address), keys) - ) - + # Make sure on_pairing emits after key update. + await self.device.update_keys(str(identity_address), keys) # Notify the device self.device.on_pairing(session.connection, identity_address, keys, session.sc) diff --git a/setup.cfg b/setup.cfg index 123d83824..001a20af8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -99,7 +99,7 @@ development = types-protobuf >= 4.21.0 avatar = pandora-avatar == 0.0.5 - rootcanal == 1.4.0 ; python_version>='3.10' + rootcanal == 1.5.0 ; python_version>='3.10' documentation = mkdocs >= 1.4.0 mkdocs-material >= 8.5.6