Bluetooth: Add timeout field to mgmt_set_discoverable
Based on the revised mgmt API set_discoverable has a timeout parameter to specify how long the adapter will remain discoverable. A value of 0 means "indefinitively". Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
committed by
Gustavo F. Padovan
parent
89352e7d3a
commit
16ab91ab48
@ -350,7 +350,7 @@ failed:
|
||||
static int set_discoverable(struct sock *sk, u16 index, unsigned char *data,
|
||||
u16 len)
|
||||
{
|
||||
struct mgmt_mode *cp;
|
||||
struct mgmt_cp_set_discoverable *cp;
|
||||
struct hci_dev *hdev;
|
||||
struct pending_cmd *cmd;
|
||||
u8 scan;
|
||||
@ -396,11 +396,16 @@ static int set_discoverable(struct sock *sk, u16 index, unsigned char *data,
|
||||
|
||||
if (cp->val)
|
||||
scan |= SCAN_INQUIRY;
|
||||
else
|
||||
cancel_delayed_work_sync(&hdev->discov_off);
|
||||
|
||||
err = hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
|
||||
if (err < 0)
|
||||
mgmt_pending_remove(cmd);
|
||||
|
||||
if (cp->val)
|
||||
hdev->discov_timeout = get_unaligned_le16(&cp->timeout);
|
||||
|
||||
failed:
|
||||
hci_dev_unlock_bh(hdev);
|
||||
hci_dev_put(hdev);
|
||||
|
Reference in New Issue
Block a user