提交 b456f87c 编写于 作者: J Johan Hedberg 提交者: Marcel Holtmann

Bluetooth: Move HCI_LIMITED_DISCOVERABLE changes to a general place

We'll soon be introducing also LE support for the Set Discoverable
management command, so move the HCI_LIMITED_DISCOVERABLE flag clearing
and setting out from the if-branch that is only used for a BR/EDR
specific HCI command.
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 4b580614
...@@ -1220,6 +1220,12 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -1220,6 +1220,12 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
cancel_delayed_work(&hdev->discov_off); cancel_delayed_work(&hdev->discov_off);
hdev->discov_timeout = timeout; hdev->discov_timeout = timeout;
/* Limited discoverable mode */
if (cp->val == 0x02)
set_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
else
clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
hci_req_init(&req, hdev); hci_req_init(&req, hdev);
scan = SCAN_PAGE; scan = SCAN_PAGE;
...@@ -1229,8 +1235,6 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -1229,8 +1235,6 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
if (cp->val == 0x02) { if (cp->val == 0x02) {
/* Limited discoverable mode */ /* Limited discoverable mode */
set_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
hci_cp.num_iac = 2; hci_cp.num_iac = 2;
hci_cp.iac_lap[0] = 0x00; /* LIAC */ hci_cp.iac_lap[0] = 0x00; /* LIAC */
hci_cp.iac_lap[1] = 0x8b; hci_cp.iac_lap[1] = 0x8b;
...@@ -1240,8 +1244,6 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -1240,8 +1244,6 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
hci_cp.iac_lap[5] = 0x9e; hci_cp.iac_lap[5] = 0x9e;
} else { } else {
/* General discoverable mode */ /* General discoverable mode */
clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
hci_cp.num_iac = 1; hci_cp.num_iac = 1;
hci_cp.iac_lap[0] = 0x33; /* GIAC */ hci_cp.iac_lap[0] = 0x33; /* GIAC */
hci_cp.iac_lap[1] = 0x8b; hci_cp.iac_lap[1] = 0x8b;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册