diff options
-rw-r--r-- | include/net/bluetooth/hci_core.h | 10 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 24 |
2 files changed, 16 insertions, 18 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index ff4e8a5c9ceb..61939a0e6cec 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1115,6 +1115,16 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); | |||
1115 | BIT(BDADDR_LE_PUBLIC) | \ | 1115 | BIT(BDADDR_LE_PUBLIC) | \ |
1116 | BIT(BDADDR_LE_RANDOM)) | 1116 | BIT(BDADDR_LE_RANDOM)) |
1117 | 1117 | ||
1118 | /* These LE scan and inquiry parameters were chosen according to LE General | ||
1119 | * Discovery Procedure specification. | ||
1120 | */ | ||
1121 | #define DISCOV_LE_SCAN_WIN 0x12 | ||
1122 | #define DISCOV_LE_SCAN_INT 0x12 | ||
1123 | #define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) | ||
1124 | #define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) | ||
1125 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 | ||
1126 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 | ||
1127 | |||
1118 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 1128 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
1119 | int mgmt_index_added(struct hci_dev *hdev); | 1129 | int mgmt_index_added(struct hci_dev *hdev); |
1120 | int mgmt_index_removed(struct hci_dev *hdev); | 1130 | int mgmt_index_removed(struct hci_dev *hdev); |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index a9bd271a736e..6b31e93af761 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -102,18 +102,6 @@ static const u16 mgmt_events[] = { | |||
102 | MGMT_EV_PASSKEY_NOTIFY, | 102 | MGMT_EV_PASSKEY_NOTIFY, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | /* | ||
106 | * These LE scan and inquiry parameters were chosen according to LE General | ||
107 | * Discovery Procedure specification. | ||
108 | */ | ||
109 | #define LE_SCAN_WIN 0x12 | ||
110 | #define LE_SCAN_INT 0x12 | ||
111 | #define LE_SCAN_TIMEOUT_LE_ONLY msecs_to_jiffies(10240) | ||
112 | #define LE_SCAN_TIMEOUT_BREDR_LE msecs_to_jiffies(5120) | ||
113 | |||
114 | #define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */ | ||
115 | #define INQUIRY_LEN_BREDR_LE 0x04 /* TGAP(100)/2 */ | ||
116 | |||
117 | #define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000) | 105 | #define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000) |
118 | 106 | ||
119 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ | 107 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ |
@@ -2641,7 +2629,7 @@ int mgmt_interleaved_discovery(struct hci_dev *hdev) | |||
2641 | 2629 | ||
2642 | hci_dev_lock(hdev); | 2630 | hci_dev_lock(hdev); |
2643 | 2631 | ||
2644 | err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR_LE); | 2632 | err = hci_do_inquiry(hdev, DISCOV_INTERLEAVED_INQUIRY_LEN); |
2645 | if (err < 0) | 2633 | if (err < 0) |
2646 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | 2634 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); |
2647 | 2635 | ||
@@ -2689,12 +2677,12 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) | |||
2689 | switch (hdev->discovery.type) { | 2677 | switch (hdev->discovery.type) { |
2690 | case DISCOV_TYPE_LE: | 2678 | case DISCOV_TYPE_LE: |
2691 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | 2679 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, |
2692 | LE_SCAN_TIMEOUT_LE_ONLY); | 2680 | DISCOV_LE_TIMEOUT); |
2693 | break; | 2681 | break; |
2694 | 2682 | ||
2695 | case DISCOV_TYPE_INTERLEAVED: | 2683 | case DISCOV_TYPE_INTERLEAVED: |
2696 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | 2684 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, |
2697 | LE_SCAN_TIMEOUT_BREDR_LE); | 2685 | DISCOV_INTERLEAVED_TIMEOUT); |
2698 | break; | 2686 | break; |
2699 | 2687 | ||
2700 | case DISCOV_TYPE_BREDR: | 2688 | case DISCOV_TYPE_BREDR: |
@@ -2770,7 +2758,7 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev, | |||
2770 | 2758 | ||
2771 | memset(&inq_cp, 0, sizeof(inq_cp)); | 2759 | memset(&inq_cp, 0, sizeof(inq_cp)); |
2772 | memcpy(&inq_cp.lap, lap, sizeof(inq_cp.lap)); | 2760 | memcpy(&inq_cp.lap, lap, sizeof(inq_cp.lap)); |
2773 | inq_cp.length = INQUIRY_LEN_BREDR; | 2761 | inq_cp.length = DISCOV_BREDR_INQUIRY_LEN; |
2774 | hci_req_add(&req, HCI_OP_INQUIRY, sizeof(inq_cp), &inq_cp); | 2762 | hci_req_add(&req, HCI_OP_INQUIRY, sizeof(inq_cp), &inq_cp); |
2775 | break; | 2763 | break; |
2776 | 2764 | ||
@@ -2807,8 +2795,8 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev, | |||
2807 | 2795 | ||
2808 | memset(¶m_cp, 0, sizeof(param_cp)); | 2796 | memset(¶m_cp, 0, sizeof(param_cp)); |
2809 | param_cp.type = LE_SCAN_ACTIVE; | 2797 | param_cp.type = LE_SCAN_ACTIVE; |
2810 | param_cp.interval = cpu_to_le16(LE_SCAN_INT); | 2798 | param_cp.interval = cpu_to_le16(DISCOV_LE_SCAN_INT); |
2811 | param_cp.window = cpu_to_le16(LE_SCAN_WIN); | 2799 | param_cp.window = cpu_to_le16(DISCOV_LE_SCAN_WIN); |
2812 | hci_req_add(&req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp), | 2800 | hci_req_add(&req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp), |
2813 | ¶m_cp); | 2801 | ¶m_cp); |
2814 | 2802 | ||