diff --git a/bumble/device.py b/bumble/device.py index 5dd23bf..075f312 100644 --- a/bumble/device.py +++ b/bumble/device.py @@ -1113,10 +1113,13 @@ class Device(CompositeEventEmitter): if self.le_enabled: # Set the controller address - await self.send_command( - HCI_LE_Set_Random_Address_Command(random_address=self.random_address), - check_result=True, - ) + if self.random_address != Address.ANY_RANDOM: + await self.send_command( + HCI_LE_Set_Random_Address_Command( + random_address=self.random_address + ), + check_result=True, + ) # Load the address resolving list if self.keystore and self.host.supports_command( diff --git a/bumble/hci.py b/bumble/hci.py index 257b303..e23fb17 100644 --- a/bumble/hci.py +++ b/bumble/hci.py @@ -1638,8 +1638,8 @@ class HCI_Object: # Map the value if needed if value_mappers: value_mapper = value_mappers.get(key, value_mapper) - if value_mapper is not None: - value = value_mapper(value) + if value_mapper is not None: + value = value_mapper(value) # Get the string representation of the value value_str = HCI_Object.format_field_value( @@ -1807,6 +1807,7 @@ class Address: # Predefined address values Address.NIL = Address(b"\xff\xff\xff\xff\xff\xff", Address.PUBLIC_DEVICE_ADDRESS) Address.ANY = Address(b"\x00\x00\x00\x00\x00\x00", Address.PUBLIC_DEVICE_ADDRESS) +Address.ANY_RANDOM = Address(b"\x00\x00\x00\x00\x00\x00", Address.RANDOM_DEVICE_ADDRESS) # ----------------------------------------------------------------------------- class OwnAddressType: