aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorFlorian Grandel <fgrandel@gmail.com>2015-06-17 21:16:42 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-06-18 12:11:52 -0400
commit7b683b744ef9492e91dd849e0a7451f55661c9d7 (patch)
tree905527f5bb135cdfce3a957dafdb5cb0a91db109 /net/bluetooth/mgmt.c
parentbea28e65994de7fda06eb5f76aef3d25bd9c135f (diff)
Bluetooth: mgmt: multi adv for enable_advertising()
Previously enable_advertising() would rely on get_adv_instance_scan_rsp_len() which checked for a hard coded instance identifier. This is being changed to check for the current advertising instance's scan response length instead. The function is renamed accordingly. Signed-off-by: Florian Grandel <fgrandel@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 47fa16bffbe2..76aee8a3acf0 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -986,16 +986,23 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance)
986 return adv_instance->flags; 986 return adv_instance->flags;
987} 987}
988 988
989static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) 989static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev)
990{ 990{
991 /* Ignore instance 0 and other unsupported instances */ 991 u8 instance = get_current_adv_instance(hdev);
992 if (instance != 0x01) 992 struct adv_info *adv_instance;
993
994 /* Ignore instance 0 */
995 if (instance == 0x00)
996 return 0;
997
998 adv_instance = hci_find_adv_instance(hdev, instance);
999 if (!adv_instance)
993 return 0; 1000 return 0;
994 1001
995 /* TODO: Take into account the "appearance" and "local-name" flags here. 1002 /* TODO: Take into account the "appearance" and "local-name" flags here.
996 * These are currently being ignored as they are not supported. 1003 * These are currently being ignored as they are not supported.
997 */ 1004 */
998 return hdev->adv_instance.scan_rsp_len; 1005 return adv_instance->scan_rsp_len;
999} 1006}
1000 1007
1001static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) 1008static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
@@ -1266,7 +1273,7 @@ static void enable_advertising(struct hci_request *req)
1266 1273
1267 if (connectable) 1274 if (connectable)
1268 cp.type = LE_ADV_IND; 1275 cp.type = LE_ADV_IND;
1269 else if (get_adv_instance_scan_rsp_len(hdev, instance)) 1276 else if (get_cur_adv_instance_scan_rsp_len(hdev))
1270 cp.type = LE_ADV_SCAN_IND; 1277 cp.type = LE_ADV_SCAN_IND;
1271 else 1278 else
1272 cp.type = LE_ADV_NONCONN_IND; 1279 cp.type = LE_ADV_NONCONN_IND;