Loading system/btif/src/bluetooth.cc +12 −0 Original line number Diff line number Diff line Loading @@ -428,6 +428,15 @@ 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; } #else int GetAdapterIndex() { return 0; } // Unsupported outside of FLOSS #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) { Loading Loading @@ -1226,6 +1235,9 @@ 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, Loading system/gd/common/init_flags.h +0 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ public: } init_flags::load(std::move(rusted_flags)); } inline static int GetAdapterIndex() { return init_flags::get_hci_adapter(); } }; } // namespace common Loading system/gd/hal/hci_hal_host.cc +3 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ #include <utility> #include <vector> #include "common/init_flags.h" #include "hal/hci_hal.h" #include "hal/link_clocker.h" #include "hal/mgmt.h" Loading @@ -41,6 +40,8 @@ #include "os/reactor.h" #include "os/thread.h" extern int GetAdapterIndex(); namespace { constexpr int INVALID_FD = -1; Loading Loading @@ -206,7 +207,7 @@ int ConnectToSocket() { } // Determine which hci index we should connect to. int hci_interface = bluetooth::common::InitFlags::GetAdapterIndex(); int hci_interface = GetAdapterIndex(); if (waitHciDev(hci_interface) != 0) { ::close(socket_fd); Loading system/gd/hal/mgmt.cc +3 −2 Original line number Diff line number Diff line Loading @@ -30,9 +30,10 @@ #include <cerrno> #include "common/init_flags.h" #include "os/log.h" extern int GetAdapterIndex(); namespace bluetooth { namespace hal { Loading Loading @@ -82,7 +83,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 = bluetooth::common::InitFlags::GetAdapterIndex(); int hci = GetAdapterIndex(); int fd = btsocket_open_mgmt(hci); uint16_t ret_opcode = HCI_OP_NOP; Loading system/gd/metrics/chromeos/metrics_event.cc +4 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ #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" Loading @@ -33,6 +32,8 @@ #include "include/hardware/bt_hh.h" #include "stack/include/hci_error_code.h" extern int GetAdapterIndex(); namespace bluetooth { namespace metrics { Loading Loading @@ -673,7 +674,7 @@ static int64_t GetChipsetInfoId(const char* path, const char* file) { static std::string GetChipsetInfoModuleName() { std::string module; int adapter_index = bluetooth::common::InitFlags::GetAdapterIndex(); int adapter_index = GetAdapterIndex(); std::string path = base::StringPrintf(kChipsetInfoModaliasPath, adapter_index); if (base::ReadFileToString(base::FilePath(path), &module)) { Loading @@ -686,7 +687,7 @@ static MetricTransportType GetChipsetInfoTransport(void) { MetricTransportType transport = MetricTransportType::TRANSPORT_TYPE_UNKNOWN; base::FilePath module_realpath; std::string module_name; int adapter_index = bluetooth::common::InitFlags::GetAdapterIndex(); int adapter_index = GetAdapterIndex(); std::string path = base::StringPrintf(kChipInfoModuleDirPath, adapter_index); // examples of module_realpath: /sys/module/btusb and /sys/module/hci_uart Loading Loading
system/btif/src/bluetooth.cc +12 −0 Original line number Diff line number Diff line Loading @@ -428,6 +428,15 @@ 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; } #else int GetAdapterIndex() { return 0; } // Unsupported outside of FLOSS #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) { Loading Loading @@ -1226,6 +1235,9 @@ 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, Loading
system/gd/common/init_flags.h +0 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ public: } init_flags::load(std::move(rusted_flags)); } inline static int GetAdapterIndex() { return init_flags::get_hci_adapter(); } }; } // namespace common Loading
system/gd/hal/hci_hal_host.cc +3 −2 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ #include <utility> #include <vector> #include "common/init_flags.h" #include "hal/hci_hal.h" #include "hal/link_clocker.h" #include "hal/mgmt.h" Loading @@ -41,6 +40,8 @@ #include "os/reactor.h" #include "os/thread.h" extern int GetAdapterIndex(); namespace { constexpr int INVALID_FD = -1; Loading Loading @@ -206,7 +207,7 @@ int ConnectToSocket() { } // Determine which hci index we should connect to. int hci_interface = bluetooth::common::InitFlags::GetAdapterIndex(); int hci_interface = GetAdapterIndex(); if (waitHciDev(hci_interface) != 0) { ::close(socket_fd); Loading
system/gd/hal/mgmt.cc +3 −2 Original line number Diff line number Diff line Loading @@ -30,9 +30,10 @@ #include <cerrno> #include "common/init_flags.h" #include "os/log.h" extern int GetAdapterIndex(); namespace bluetooth { namespace hal { Loading Loading @@ -82,7 +83,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 = bluetooth::common::InitFlags::GetAdapterIndex(); int hci = GetAdapterIndex(); int fd = btsocket_open_mgmt(hci); uint16_t ret_opcode = HCI_OP_NOP; Loading
system/gd/metrics/chromeos/metrics_event.cc +4 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ #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" Loading @@ -33,6 +32,8 @@ #include "include/hardware/bt_hh.h" #include "stack/include/hci_error_code.h" extern int GetAdapterIndex(); namespace bluetooth { namespace metrics { Loading Loading @@ -673,7 +674,7 @@ static int64_t GetChipsetInfoId(const char* path, const char* file) { static std::string GetChipsetInfoModuleName() { std::string module; int adapter_index = bluetooth::common::InitFlags::GetAdapterIndex(); int adapter_index = GetAdapterIndex(); std::string path = base::StringPrintf(kChipsetInfoModaliasPath, adapter_index); if (base::ReadFileToString(base::FilePath(path), &module)) { Loading @@ -686,7 +687,7 @@ static MetricTransportType GetChipsetInfoTransport(void) { MetricTransportType transport = MetricTransportType::TRANSPORT_TYPE_UNKNOWN; base::FilePath module_realpath; std::string module_name; int adapter_index = bluetooth::common::InitFlags::GetAdapterIndex(); int adapter_index = GetAdapterIndex(); std::string path = base::StringPrintf(kChipInfoModuleDirPath, adapter_index); // examples of module_realpath: /sys/module/btusb and /sys/module/hci_uart Loading