Bluetooth: mgmt: multi-adv for mgmt_reenable_advertising()
authorFlorian Grandel <fgrandel@gmail.com>
Thu, 18 Jun 2015 01:16:51 +0000 (03:16 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 18 Jun 2015 16:11:53 +0000 (18:11 +0200)
During service discovery, advertising will be disabled. This patch
ensures that it is correctly being re-enabled, both for configuration
made via set advertising and add advertising, once the scanning
times out.

Signed-off-by: Florian Grandel <fgrandel@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index f44c6e3be9382f6f4c22e4d46a09f1fd479535b6..b132032f5710dca7eb725dfde7c53fd4a49482f9 100644 (file)
@@ -8610,13 +8610,24 @@ static void adv_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode)
 void mgmt_reenable_advertising(struct hci_dev *hdev)
 {
        struct hci_request req;
+       u8 instance;
 
        if (!hci_dev_test_flag(hdev, HCI_ADVERTISING) &&
            !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE))
                return;
 
+       instance = get_current_adv_instance(hdev);
+
        hci_req_init(&req, hdev);
-       enable_advertising(&req);
+
+       if (instance) {
+               schedule_adv_instance(&req, instance, true);
+       } else {
+               update_adv_data(&req);
+               update_scan_rsp_data(&req);
+               enable_advertising(&req);
+       }
+
        hci_req_run(&req, adv_enable_complete);
 }