Bluetooth: mgmt: Fix limited discoverable off timeout
authorFrédéric Danis <frederic.danis@collabora.com>
Mon, 22 Jan 2024 16:59:55 +0000 (17:59 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 28 Feb 2024 14:43:20 +0000 (09:43 -0500)
LIMITED_DISCOVERABLE flag is not reset from Class of Device and
advertisement on limited discoverable timeout. This prevents to pass PTS
test GAP/DISC/LIMM/BV-02-C

Calling set_discoverable_sync as when the limited discovery is set
correctly update the Class of Device and advertisement.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/mgmt.c

index bb72ff6eb22f4b30864aefd2588cce982d37d153..ee3b4aad8bd8d65239efc591cf33a631690a270f 100644 (file)
@@ -1045,6 +1045,8 @@ static void rpa_expired(struct work_struct *work)
        hci_cmd_sync_queue(hdev, rpa_expired_sync, NULL, NULL);
 }
 
+static int set_discoverable_sync(struct hci_dev *hdev, void *data);
+
 static void discov_off(struct work_struct *work)
 {
        struct hci_dev *hdev = container_of(work, struct hci_dev,
@@ -1063,7 +1065,7 @@ static void discov_off(struct work_struct *work)
        hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
        hdev->discov_timeout = 0;
 
-       hci_update_discoverable(hdev);
+       hci_cmd_sync_queue(hdev, set_discoverable_sync, NULL, NULL);
 
        mgmt_new_settings(hdev);