Skip to content

Commit

Permalink
Bluetooth: mgmt: Fix Removing discoverable timeout in set_connectable
Browse files Browse the repository at this point in the history
When switching connectable mode off any pending discoverable timeout
must also be disabled to avoid duplicate write_scan_enable commands.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Johan Hedberg committed Feb 21, 2012
1 parent 5e5282b commit df2c6c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,14 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)

if (cp->val)
scan = SCAN_PAGE;
else
else {
scan = 0;

if (test_bit(HCI_ISCAN, &hdev->flags) &&
hdev->discov_timeout > 0)
cancel_delayed_work(&hdev->discov_off);
}

err = hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
if (err < 0)
mgmt_pending_remove(cmd);
Expand Down

0 comments on commit df2c6c5

Please sign in to comment.