Skip to content

Commit

Permalink
Bluetooth: Fix handling of discoverable setting with timeout
Browse files Browse the repository at this point in the history
The current handling of the discoverable timeout was missing the proper
handling of the timeout when the mode was already set. Now the command
can be used to expire or retrigger the timeout.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Feb 23, 2012
1 parent 24c54a9 commit 955638e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,17 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
}

if (!!cp->val == test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) {
if (hdev->discov_timeout > 0) {
cancel_delayed_work(&hdev->discov_off);
hdev->discov_timeout = 0;
}

if (cp->val && timeout > 0) {
hdev->discov_timeout = timeout;
queue_delayed_work(hdev->workqueue, &hdev->discov_off,
msecs_to_jiffies(hdev->discov_timeout * 1000));
}

err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
goto failed;
}
Expand Down

0 comments on commit 955638e

Please sign in to comment.