}
no_scan_update:
- /* If we're going from non-connectable to connectable or
- * vice-versa when fast connectable is enabled ensure that fast
- * connectable gets disabled. write_fast_connectable won't do
- * anything if the page scan parameters are already what they
- * should be.
- */
- if (cp->val || test_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags))
- write_fast_connectable(&req, false);
-
/* Update the advertising parameters if necessary */
if (test_bit(HCI_ADVERTISING, &hdev->dev_flags))
enable_advertising(&req);
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
MGMT_STATUS_INVALID_PARAMS);
- if (!hdev_is_powered(hdev))
- return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
- MGMT_STATUS_NOT_POWERED);
-
- if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
- return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
- MGMT_STATUS_REJECTED);
-
hci_dev_lock(hdev);
if (mgmt_pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev)) {
goto unlock;
}
+ if (!hdev_is_powered(hdev)) {
+ change_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags);
+ err = send_settings_rsp(sk, MGMT_OP_SET_FAST_CONNECTABLE,
+ hdev);
+ new_settings(hdev, sk);
+ goto unlock;
+ }
+
cmd = mgmt_pending_add(sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev,
data, len);
if (!cmd) {
sizeof(link_sec), &link_sec);
if (lmp_bredr_capable(hdev)) {
- write_fast_connectable(&req, false);
+ if (test_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags))
+ write_fast_connectable(&req, true);
+ else
+ write_fast_connectable(&req, false);
__hci_update_page_scan(&req);
update_class(&req);
update_name(&req);