diff options
author | Florian Grandel <fgrandel@gmail.com> | 2015-06-17 21:16:43 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-06-18 12:11:52 -0400 |
commit | ca21fbe97c444c42fee7211dd625f2f4d373fad8 (patch) | |
tree | fde48f50c72398b4706f90609c423dddda77ae72 /net/bluetooth/mgmt.c | |
parent | 7b683b744ef9492e91dd849e0a7451f55661c9d7 (diff) |
Bluetooth: mgmt: multi adv for create_instance_scan_rsp_data()
The create_instance_scan_rsp_data() function could not deal with
multiple advertising instances previously. This is being fixed by adding
an additional instance parameter.
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 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 76aee8a3acf0..fc807dcc2533 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -872,15 +872,22 @@ static u8 create_default_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) | |||
872 | return ad_len; | 872 | return ad_len; |
873 | } | 873 | } |
874 | 874 | ||
875 | static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) | 875 | static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 instance, |
876 | u8 *ptr) | ||
876 | { | 877 | { |
878 | struct adv_info *adv_instance; | ||
879 | |||
880 | adv_instance = hci_find_adv_instance(hdev, instance); | ||
881 | if (!adv_instance) | ||
882 | return 0; | ||
883 | |||
877 | /* TODO: Set the appropriate entries based on advertising instance flags | 884 | /* TODO: Set the appropriate entries based on advertising instance flags |
878 | * here once flags other than 0 are supported. | 885 | * here once flags other than 0 are supported. |
879 | */ | 886 | */ |
880 | memcpy(ptr, hdev->adv_instance.scan_rsp_data, | 887 | memcpy(ptr, adv_instance->scan_rsp_data, |
881 | hdev->adv_instance.scan_rsp_len); | 888 | adv_instance->scan_rsp_len); |
882 | 889 | ||
883 | return hdev->adv_instance.scan_rsp_len; | 890 | return adv_instance->scan_rsp_len; |
884 | } | 891 | } |
885 | 892 | ||
886 | static void update_inst_scan_rsp_data(struct hci_request *req, u8 instance) | 893 | static void update_inst_scan_rsp_data(struct hci_request *req, u8 instance) |
@@ -895,7 +902,7 @@ static void update_inst_scan_rsp_data(struct hci_request *req, u8 instance) | |||
895 | memset(&cp, 0, sizeof(cp)); | 902 | memset(&cp, 0, sizeof(cp)); |
896 | 903 | ||
897 | if (instance) | 904 | if (instance) |
898 | len = create_instance_scan_rsp_data(hdev, cp.data); | 905 | len = create_instance_scan_rsp_data(hdev, instance, cp.data); |
899 | else | 906 | else |
900 | len = create_default_scan_rsp_data(hdev, cp.data); | 907 | len = create_default_scan_rsp_data(hdev, cp.data); |
901 | 908 | ||