Skip to content

Commit

Permalink
Support non-directed address generation offload
Browse files Browse the repository at this point in the history
  • Loading branch information
zxzxwu committed Jan 26, 2024
1 parent 2920f05 commit 3ebac10
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 10 additions & 0 deletions bumble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 2 additions & 4 deletions bumble/smp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ development =
types-invoke >= 1.7.3
types-protobuf >= 4.21.0
avatar =
pandora-avatar == 0.0.5
rootcanal == 1.4.0 ; python_version>='3.10'
pandora-avatar == 0.0.6
rootcanal == 1.6.0 ; python_version>='3.10'
documentation =
mkdocs >= 1.4.0
mkdocs-material >= 8.5.6
Expand Down

0 comments on commit 3ebac10

Please sign in to comment.