Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f0e88bf authored by Myles Watson's avatar Myles Watson
Browse files

HCI: Prefer the requested hci_interface

Bug: 345058678
Test: mma -j32
      Connect passthrough mode with AAOS
Change-Id: I9fd5e4cba1e14e6260f485f56f473ce506f18437
parent f7986f1a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -161,6 +161,16 @@ int NetBluetoothMgmt::waitHciDev(int hci_interface) {
      struct mgmt_ev_read_index_list* data =
          (struct mgmt_ev_read_index_list*)ev.data;

      // Prefer the exact hci_interface
      for (int i = 0; i < data->num_controllers; i++) {
        if (data->index[i] == hci_interface) {
          ALOGI("hci interface %d found", data->index[i]);
          ret = data->index[i];
          goto end;
        }
      }

      // Accept a larger one if we can't find the exact one
      for (int i = 0; i < data->num_controllers; i++) {
        if (data->index[i] >= hci_interface) {
          ALOGI("hci interface %d found", data->index[i]);