diff options
-rw-r--r-- | include/net/bluetooth/hci.h | 3 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 6127ca8bd1d1..5b2fed5eebf2 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -804,6 +804,9 @@ struct hci_cp_le_set_scan_param { | |||
804 | __u8 filter_policy; | 804 | __u8 filter_policy; |
805 | } __packed; | 805 | } __packed; |
806 | 806 | ||
807 | #define LE_SCANNING_DISABLED 0x00 | ||
808 | #define LE_SCANNING_ENABLED 0x01 | ||
809 | |||
807 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c | 810 | #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c |
808 | struct hci_cp_le_set_scan_enable { | 811 | struct hci_cp_le_set_scan_enable { |
809 | __u8 enable; | 812 | __u8 enable; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b9d77be92d3b..919e3c0e74aa 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1033,7 +1033,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1033 | if (!cp) | 1033 | if (!cp) |
1034 | return; | 1034 | return; |
1035 | 1035 | ||
1036 | if (cp->enable == 0x01) { | 1036 | switch (cp->enable) { |
1037 | case LE_SCANNING_ENABLED: | ||
1037 | set_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1038 | set_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1038 | 1039 | ||
1039 | cancel_delayed_work_sync(&hdev->adv_work); | 1040 | cancel_delayed_work_sync(&hdev->adv_work); |
@@ -1041,12 +1042,19 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1041 | hci_dev_lock(hdev); | 1042 | hci_dev_lock(hdev); |
1042 | hci_adv_entries_clear(hdev); | 1043 | hci_adv_entries_clear(hdev); |
1043 | hci_dev_unlock(hdev); | 1044 | hci_dev_unlock(hdev); |
1044 | } else if (cp->enable == 0x00) { | 1045 | break; |
1046 | |||
1047 | case LE_SCANNING_DISABLED: | ||
1045 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1048 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1046 | 1049 | ||
1047 | cancel_delayed_work_sync(&hdev->adv_work); | 1050 | cancel_delayed_work_sync(&hdev->adv_work); |
1048 | queue_delayed_work(hdev->workqueue, &hdev->adv_work, | 1051 | queue_delayed_work(hdev->workqueue, &hdev->adv_work, |
1049 | jiffies + ADV_CLEAR_TIMEOUT); | 1052 | jiffies + ADV_CLEAR_TIMEOUT); |
1053 | break; | ||
1054 | |||
1055 | default: | ||
1056 | BT_ERR("Used reserved LE_Scan_Enable param %d", cp->enable); | ||
1057 | break; | ||
1050 | } | 1058 | } |
1051 | } | 1059 | } |
1052 | 1060 | ||