Bluetooth: Allow combination of BDADDR_PROPERTY and INVALID_BDADDR quirks
When utilizing BDADDR_PROPERTY and INVALID_BDADDR quirks together it results in an unconfigured controller even if the bootloader provides a valid address. Fix this by allowing a bootloader provided address to mark the controller as configured. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Tested-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
1199ab4c9e
commit
7fdf6c6a0d
|
@ -1444,11 +1444,20 @@ static int hci_dev_do_open(struct hci_dev *hdev)
|
||||||
|
|
||||||
if (hci_dev_test_flag(hdev, HCI_SETUP) ||
|
if (hci_dev_test_flag(hdev, HCI_SETUP) ||
|
||||||
test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) {
|
test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) {
|
||||||
|
bool invalid_bdaddr;
|
||||||
|
|
||||||
hci_sock_dev_event(hdev, HCI_DEV_SETUP);
|
hci_sock_dev_event(hdev, HCI_DEV_SETUP);
|
||||||
|
|
||||||
if (hdev->setup)
|
if (hdev->setup)
|
||||||
ret = hdev->setup(hdev);
|
ret = hdev->setup(hdev);
|
||||||
|
|
||||||
|
/* The transport driver can set the quirk to mark the
|
||||||
|
* BD_ADDR invalid before creating the HCI device or in
|
||||||
|
* its setup callback.
|
||||||
|
*/
|
||||||
|
invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR,
|
||||||
|
&hdev->quirks);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
goto setup_failed;
|
goto setup_failed;
|
||||||
|
|
||||||
|
@ -1457,20 +1466,33 @@ static int hci_dev_do_open(struct hci_dev *hdev)
|
||||||
hci_dev_get_bd_addr_from_property(hdev);
|
hci_dev_get_bd_addr_from_property(hdev);
|
||||||
|
|
||||||
if (bacmp(&hdev->public_addr, BDADDR_ANY) &&
|
if (bacmp(&hdev->public_addr, BDADDR_ANY) &&
|
||||||
hdev->set_bdaddr)
|
hdev->set_bdaddr) {
|
||||||
ret = hdev->set_bdaddr(hdev,
|
ret = hdev->set_bdaddr(hdev,
|
||||||
&hdev->public_addr);
|
&hdev->public_addr);
|
||||||
|
|
||||||
|
/* If setting of the BD_ADDR from the device
|
||||||
|
* property succeeds, then treat the address
|
||||||
|
* as valid even if the invalid BD_ADDR
|
||||||
|
* quirk indicates otherwise.
|
||||||
|
*/
|
||||||
|
if (!ret)
|
||||||
|
invalid_bdaddr = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_failed:
|
setup_failed:
|
||||||
/* The transport driver can set these quirks before
|
/* The transport driver can set these quirks before
|
||||||
* creating the HCI device or in its setup callback.
|
* creating the HCI device or in its setup callback.
|
||||||
*
|
*
|
||||||
|
* For the invalid BD_ADDR quirk it is possible that
|
||||||
|
* it becomes a valid address if the bootloader does
|
||||||
|
* provide it (see above).
|
||||||
|
*
|
||||||
* In case any of them is set, the controller has to
|
* In case any of them is set, the controller has to
|
||||||
* start up as unconfigured.
|
* start up as unconfigured.
|
||||||
*/
|
*/
|
||||||
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
|
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
|
||||||
test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks))
|
invalid_bdaddr)
|
||||||
hci_dev_set_flag(hdev, HCI_UNCONFIGURED);
|
hci_dev_set_flag(hdev, HCI_UNCONFIGURED);
|
||||||
|
|
||||||
/* For an unconfigured controller it is required to
|
/* For an unconfigured controller it is required to
|
||||||
|
|
Loading…
Reference in New Issue