fix: getting public address from controller only if no address is set#902
fix: getting public address from controller only if no address is set#902yannpoupon wants to merge 1 commit intogoogle:mainfrom
Conversation
|
This may be somewhat dangerous or misleading. Because if the controller has no public address, some operations won't work as expected, when the controller is told, for example, to use its public address for an operation (the field "own_address_type" is used for that in some HCI commands, it can be set to "PUBLIC"). There's no standard HCI command to set the public address (some controllers have private vendor-specific commands for that). |
|
What I am currently trying to do is to set the public address to a specific value and enabling the LE privacy so it uses an RPA and when the connection is done it will resolve the address to the public address I have set I set the following values before the address = Address(bytes(addr_bytes), Address.PUBLIC_DEVICE_ADDRESS)
self.public_address = address
# Enable LE privacy so an RPA is generated and rotated periodically.
self.le_privacy_enabled = True
self.le_rpa_timeout = 300 * 60 # 300 minutesAnd then I call the And in the following code it will then check if the public address is different than any since I didn't set the pairing_config : And it will then use the static_address and not the public address that I want. |
|
I get what you want to do here. It probably works in SMP, but violates specs, and many controller features will not work or lead to undefined behavior in this way. |
|
BTW, your requirement should be available by setting |
|
Yes you are right if I set the static address to the address that I want : address = Address(bytes(addr_bytes), Address.PUBLIC_DEVICE_ADDRESS)
self.static_address = address
# Enable LE privacy so an RPA is generated and rotated periodically.
self.le_privacy_enabled = True
self.le_rpa_timeout = 300 * 60 # 300 minutesThen the connection works and the address is correctly resolved by the component to the address I set and seen as a public address. But it just seems weird to set the |
|
I’m leaning against merging this. As we discussed, it’s not a common usage but a bit misleading, and still you can use the workaround for public identity address exchange. |
You could just set |
This PR will just try to set the public address from the controller if the user didn't specify any while creating the device
This will allow custom public address to be used in the
power_onelse it will always be overwritten by this read :