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

Commit 75083ae2 authored by Ren-Pei Zeng's avatar Ren-Pei Zeng Committed by Gerrit Code Review
Browse files

Revert "InitFlags: Remove hci_adapter"

This reverts commit a591f467.

Reason for revert: broke ab/main-al-dev builds - b/361208303

Change-Id: I51197ccd709661f83dc4fad60861ad0b31ae813e
parent a591f467
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -427,13 +427,6 @@ static bool is_profile(const char* p1, const char* p2) {
 *
 ****************************************************************************/

#ifdef TARGET_FLOSS
static int global_hci_adapter = 0;

static int set_adapter_index(int adapter) { global_hci_adapter = adapter; }
int GetAdapterIndex() { return global_hci_adapter; }
#endif

static int init(bt_callbacks_t* callbacks, bool start_restricted, bool is_common_criteria_mode,
                int config_compare_result, const char** init_flags, bool is_atv,
                const char* user_data_directory) {
@@ -1231,9 +1224,6 @@ static void interop_database_add_remove_name(bool do_add, const char* feature_na

EXPORT_SYMBOL bt_interface_t bluetoothInterface = {
        sizeof(bluetoothInterface),
#ifdef TARGET_FLOSS
        .set_adapter_index = set_adapter_index,
#endif
        .init = init,
        .enable = enable,
        .disable = disable,
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ public:
    }
    init_flags::load(std::move(rusted_flags));
  }

  inline static int GetAdapterIndex() { return init_flags::get_hci_adapter(); }
};

}  // namespace common
+2 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <utility>
#include <vector>

#include "common/init_flags.h"
#include "hal/hci_hal.h"
#include "hal/link_clocker.h"
#include "hal/mgmt.h"
@@ -40,8 +41,6 @@
#include "os/reactor.h"
#include "os/thread.h"

extern int GetAdapterIndex();

namespace {
constexpr int INVALID_FD = -1;

@@ -207,7 +206,7 @@ int ConnectToSocket() {
  }

  // Determine which hci index we should connect to.
  int hci_interface = GetAdapterIndex();
  int hci_interface = bluetooth::common::InitFlags::GetAdapterIndex();

  if (waitHciDev(hci_interface) != 0) {
    ::close(socket_fd);
+2 −3
Original line number Diff line number Diff line
@@ -30,10 +30,9 @@

#include <cerrno>

#include "common/init_flags.h"
#include "os/log.h"

extern int GetAdapterIndex();

namespace bluetooth {
namespace hal {

@@ -83,7 +82,7 @@ static int btsocket_open_mgmt(uint16_t hci) {
 * be HCI_OP_NOP (0x0000).
 */
uint16_t Mgmt::get_vs_opcode(uint16_t vendor_specification) {
  int hci = GetAdapterIndex();
  int hci = bluetooth::common::InitFlags::GetAdapterIndex();
  int fd = btsocket_open_mgmt(hci);
  uint16_t ret_opcode = HCI_OP_NOP;

+3 −4
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <map>
#include <utility>

#include "common/init_flags.h"
#include "hci/hci_packets.h"
#include "include/hardware/bluetooth.h"
#include "include/hardware/bt_av.h"
@@ -32,8 +33,6 @@
#include "include/hardware/bt_hh.h"
#include "stack/include/hci_error_code.h"

extern int GetAdapterIndex();

namespace bluetooth {
namespace metrics {

@@ -674,7 +673,7 @@ static int64_t GetChipsetInfoId(const char* path, const char* file) {

static std::string GetChipsetInfoModuleName() {
  std::string module;
  int adapter_index = GetAdapterIndex();
  int adapter_index = bluetooth::common::InitFlags::GetAdapterIndex();
  std::string path = base::StringPrintf(kChipsetInfoModaliasPath, adapter_index);

  if (base::ReadFileToString(base::FilePath(path), &module)) {
@@ -687,7 +686,7 @@ static MetricTransportType GetChipsetInfoTransport(void) {
  MetricTransportType transport = MetricTransportType::TRANSPORT_TYPE_UNKNOWN;
  base::FilePath module_realpath;
  std::string module_name;
  int adapter_index = GetAdapterIndex();
  int adapter_index = bluetooth::common::InitFlags::GetAdapterIndex();
  std::string path = base::StringPrintf(kChipInfoModuleDirPath, adapter_index);

  // examples of module_realpath: /sys/module/btusb and /sys/module/hci_uart
Loading