2019-11-19 05:18:15

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] bluetooth: bcm: Set HCI_QUIRK_USE_BDADDR_PROPERTY for default addresses

Hi Andre,

> Some devices ship with the controller default address, like the
> Orange Pi 3 (BCM4345C5).
>
> Allow the bootloader to set a valid address through the device tree.
>
> Signed-off-by: Andre Heider <[email protected]>
> ---
> drivers/bluetooth/btbcm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
> index 2d2e6d862068..e1471777486e 100644
> --- a/drivers/bluetooth/btbcm.c
> +++ b/drivers/bluetooth/btbcm.c
> @@ -79,7 +79,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
> !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
> bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
> &bda->bdaddr);
> - set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
> + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
> }

I am not sure the change is this simple. What happens if you run on a boot-loader that doesn’t provide the address and has an invalid address.

When I allowed HCI_QUIRK_USE_BDADDR_PROPERTY to be added, I stated clearly that the intent was that userspace can handle the address setup and this was pretty much just for the existing hardware where we have some magic boot-loader to do this.

Anyhow, I am fine allowing this here as well. However the HCI_QUIRK_USE_BDADDR_PROPERTY needs to be set unconditionally in the hdev->setup routine. And in case there still is an invalid address we need to stick with invalid address. Right now the code in hci_dev_do_open() operates differently.

Regards

Marcel


2019-11-19 05:57:05

by Andre Heider

[permalink] [raw]
Subject: Re: [PATCH] bluetooth: bcm: Set HCI_QUIRK_USE_BDADDR_PROPERTY for default addresses

Hi Marcel,

On 19/11/2019 06:17, Marcel Holtmann wrote:
> Hi Andre,
>
>> Some devices ship with the controller default address, like the
>> Orange Pi 3 (BCM4345C5).
>>
>> Allow the bootloader to set a valid address through the device tree.
>>
>> Signed-off-by: Andre Heider <[email protected]>
>> ---
>> drivers/bluetooth/btbcm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
>> index 2d2e6d862068..e1471777486e 100644
>> --- a/drivers/bluetooth/btbcm.c
>> +++ b/drivers/bluetooth/btbcm.c
>> @@ -79,7 +79,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
>> !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
>> bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
>> &bda->bdaddr);
>> - set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
>> + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
>> }
>
> I am not sure the change is this simple. What happens if you run on a boot-loader that doesn’t provide the address and has an invalid address.
>
> When I allowed HCI_QUIRK_USE_BDADDR_PROPERTY to be added, I stated clearly that the intent was that userspace can handle the address setup and this was pretty much just for the existing hardware where we have some magic boot-loader to do this.
>
> Anyhow, I am fine allowing this here as well. However the HCI_QUIRK_USE_BDADDR_PROPERTY needs to be set unconditionally in the hdev->setup routine. And in case there still is an invalid address we need to stick with invalid address. Right now the code in hci_dev_do_open() operates differently.

Okay, will send a v2 with the quirk set in btbcm_finalize() (like
HCI_QUIRK_STRICT_DUPLICATE_FILTER).

Thanks!
Andre