diff options
author | Florian Grandel <fgrandel@gmail.com> | 2015-06-17 21:16:44 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-06-18 12:11:52 -0400 |
commit | f63ba24b97ac795c516315c2b1b8a8463a6acd46 (patch) | |
tree | a6ccc509c7a6e4644002346262beaf8af686211d /net/bluetooth/mgmt.c | |
parent | ca21fbe97c444c42fee7211dd625f2f4d373fad8 (diff) |
Bluetooth: mgmt: multi adv for create_instance_adv_data()
The create_instance_adv_data() function could not deal with
multiple advertising instances previously. This is being fixed by
retrieving advertising instances from the newly introduced dynamic
advertising instance list.
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.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index fc807dcc2533..04efc56d1641 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1014,8 +1014,18 @@ static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev) | |||
1014 | 1014 | ||
1015 | static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) | 1015 | static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) |
1016 | { | 1016 | { |
1017 | struct adv_info *adv_instance = NULL; | ||
1017 | u8 ad_len = 0, flags = 0; | 1018 | u8 ad_len = 0, flags = 0; |
1018 | u32 instance_flags = get_adv_instance_flags(hdev, instance); | 1019 | u32 instance_flags; |
1020 | |||
1021 | /* Return 0 when the current instance identifier is invalid. */ | ||
1022 | if (instance) { | ||
1023 | adv_instance = hci_find_adv_instance(hdev, instance); | ||
1024 | if (!adv_instance) | ||
1025 | return 0; | ||
1026 | } | ||
1027 | |||
1028 | instance_flags = get_adv_instance_flags(hdev, instance); | ||
1019 | 1029 | ||
1020 | /* The Add Advertising command allows userspace to set both the general | 1030 | /* The Add Advertising command allows userspace to set both the general |
1021 | * and limited discoverable flags. | 1031 | * and limited discoverable flags. |
@@ -1049,12 +1059,11 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) | |||
1049 | } | 1059 | } |
1050 | } | 1060 | } |
1051 | 1061 | ||
1052 | if (instance) { | 1062 | if (adv_instance) { |
1053 | memcpy(ptr, hdev->adv_instance.adv_data, | 1063 | memcpy(ptr, adv_instance->adv_data, |
1054 | hdev->adv_instance.adv_data_len); | 1064 | adv_instance->adv_data_len); |
1055 | 1065 | ad_len += adv_instance->adv_data_len; | |
1056 | ad_len += hdev->adv_instance.adv_data_len; | 1066 | ptr += adv_instance->adv_data_len; |
1057 | ptr += hdev->adv_instance.adv_data_len; | ||
1058 | } | 1067 | } |
1059 | 1068 | ||
1060 | /* Provide Tx Power only if we can provide a valid value for it */ | 1069 | /* Provide Tx Power only if we can provide a valid value for it */ |