don't set a random address when it is 00:00:00:00:00:00

This commit is contained in:
Gilles Boccon-Gibod
2023-01-13 13:22:27 -08:00
parent 16e926a216
commit 422b05ad51
2 changed files with 10 additions and 6 deletions

View File

@@ -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(

View File

@@ -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: