diff options
author | Arman Uguray <armansito@chromium.org> | 2015-03-28 15:38:59 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-03-28 16:31:57 -0400 |
commit | c7d4883b0684a732af779f88768c57ab006ce3a1 (patch) | |
tree | 8b23e7aaaa3a75fb3675135635f9cf1714457b22 /net | |
parent | faccb950f7170c37c9c2e1f82a6e33cd7a23a5c9 (diff) |
Bluetooth: Use ADV_SCAN_IND for adv. instances
With this patch, ADV_SCAN_IND will be used for advertising instances
that have non-zero scan response data while the global "connectable"
setting is "off".
Signed-off-by: Arman Uguray <armansito@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/mgmt.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d998ec360598..2d84fc16e108 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -994,6 +994,18 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance) | |||
994 | return flags; | 994 | return flags; |
995 | } | 995 | } |
996 | 996 | ||
997 | static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) | ||
998 | { | ||
999 | /* Ignore instance 0 and other unsupported instances */ | ||
1000 | if (instance != 0x01) | ||
1001 | return 0; | ||
1002 | |||
1003 | /* TODO: Take into account the "appearance" and "local-name" flags here. | ||
1004 | * These are currently being ignored as they are not supported. | ||
1005 | */ | ||
1006 | return hdev->adv_instance.scan_rsp_len; | ||
1007 | } | ||
1008 | |||
997 | static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) | 1009 | static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) |
998 | { | 1010 | { |
999 | u8 ad_len = 0, flags = 0; | 1011 | u8 ad_len = 0, flags = 0; |
@@ -1260,7 +1272,14 @@ static void enable_advertising(struct hci_request *req) | |||
1260 | memset(&cp, 0, sizeof(cp)); | 1272 | memset(&cp, 0, sizeof(cp)); |
1261 | cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval); | 1273 | cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval); |
1262 | cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval); | 1274 | cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval); |
1263 | cp.type = connectable ? LE_ADV_IND : LE_ADV_NONCONN_IND; | 1275 | |
1276 | if (connectable) | ||
1277 | cp.type = LE_ADV_IND; | ||
1278 | else if (get_adv_instance_scan_rsp_len(hdev, instance)) | ||
1279 | cp.type = LE_ADV_SCAN_IND; | ||
1280 | else | ||
1281 | cp.type = LE_ADV_NONCONN_IND; | ||
1282 | |||
1264 | cp.own_address_type = own_addr_type; | 1283 | cp.own_address_type = own_addr_type; |
1265 | cp.channel_map = hdev->le_adv_channel_map; | 1284 | cp.channel_map = hdev->le_adv_channel_map; |
1266 | 1285 | ||