Loading system/device/src/device_iot_config.cc +10 −7 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ * limitations under the License. * ******************************************************************************/ #include "internal_include/bt_target.h" #define LOG_TAG "device_iot_config" #include "device/include/device_iot_config.h" #include <base/logging.h> #include <bluetooth/log.h> #include <ctype.h> #include <stdio.h> #include <string.h> Loading @@ -30,9 +32,9 @@ #include <string> #include "common/init_flags.h" #include "device/include/device_iot_config.h" #include "device_iot_config_int.h" #include "include/check.h" #include "internal_include/bt_target.h" #include "os/log.h" #include "osi/include/alarm.h" #include "osi/include/allocator.h" Loading @@ -49,6 +51,7 @@ std::unique_ptr<config_t> config; alarm_t* config_timer; using bluetooth::common::InitFlags; using namespace bluetooth; bool device_iot_config_has_section(const std::string& section) { if (!InitFlags::IsDeviceIotConfigLoggingEnabled()) return false; Loading Loading @@ -275,12 +278,12 @@ bool device_iot_config_set_bin(const std::string& section, CHECK(config != NULL); LOG_VERBOSE("Key = %s", key.c_str()); log::verbose("Key = {}", key); if (length > 0) CHECK(value != NULL); char* str = (char*)osi_calloc(length * 2 + 1); if (str == NULL) { LOG_ERROR("Unable to allocate a str."); log::error("Unable to allocate a str."); return false; } Loading Loading @@ -320,7 +323,7 @@ void device_iot_config_flush(void) { int event = alarm_is_scheduled(config_timer) ? IOT_CONFIG_SAVE_TIMER_FIRED_EVT : IOT_CONFIG_FLUSH_EVT; LOG_VERBOSE("evt=%d", event); log::verbose("evt={}", event); alarm_cancel(config_timer); device_iot_config_write(event, NULL); } Loading @@ -331,7 +334,7 @@ bool device_iot_config_clear(void) { CHECK(config != NULL); CHECK(config_timer != NULL); LOG_INFO(""); log::info(""); alarm_cancel(config_timer); std::unique_lock<std::mutex> lock(config_lock); Loading system/device/src/device_iot_config_int.cc +20 −18 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "device_iot_config_int.h" #include <base/logging.h> #include <bluetooth/log.h> #include <stdio.h> #include <string.h> #include <time.h> Loading Loading @@ -52,6 +53,7 @@ extern std::unique_ptr<config_t> config; extern alarm_t* config_timer; using bluetooth::common::InitFlags; using namespace bluetooth; static void cleanup() { alarm_free(config_timer); Loading @@ -63,7 +65,7 @@ static void cleanup() { // Module lifecycle functions future_t* device_iot_config_module_init(void) { LOG_INFO(""); log::info(""); std::unique_lock<std::mutex> lock(config_lock); Loading @@ -77,20 +79,20 @@ future_t* device_iot_config_module_init(void) { config = config_new(IOT_CONFIG_FILE_PATH); device_iot_config_source = ORIGINAL; if (!config) { LOG_WARN("Unable to load config file: %s; using backup.", log::warn("Unable to load config file: {}; using backup.", IOT_CONFIG_FILE_PATH); config = config_new(IOT_CONFIG_BACKUP_PATH); device_iot_config_source = BACKUP; } if (!config) { LOG_ERROR("Unable to load bak file; creating empty config."); log::error("Unable to load bak file; creating empty config."); config = config_new_empty(); device_iot_config_source = NEW_FILE; } if (!config) { LOG_ERROR("Unable to allocate a config object."); log::error("Unable to allocate a config object."); cleanup(); return future_new_immediate(FUTURE_FAIL); } Loading @@ -108,14 +110,14 @@ future_t* device_iot_config_module_init(void) { } if (version != DEVICE_IOT_INFO_CURRENT_VERSION) { LOG_INFO("Version in file is %d, CURRENT_VERSION is %d ", version, log::info("Version in file is {}, CURRENT_VERSION is {}", version, DEVICE_IOT_INFO_CURRENT_VERSION); remove(IOT_CONFIG_FILE_PATH); remove(IOT_CONFIG_BACKUP_PATH); config.reset(); config = config_new_empty(); if (!config) { LOG_ERROR("Unable to allocate a config object."); log::error("Unable to allocate a config object."); cleanup(); return future_new_immediate(FUTURE_FAIL); } Loading @@ -125,7 +127,7 @@ future_t* device_iot_config_module_init(void) { } device_iot_config_devices_loaded = device_iot_config_get_device_num(*config); LOG_INFO("Devices loaded %d", device_iot_config_devices_loaded); log::info("Devices loaded {}", device_iot_config_devices_loaded); // Read or set config file creation timestamp const std::string* time_str = Loading @@ -150,7 +152,7 @@ future_t* device_iot_config_module_init(void) { // write back to disk. config_timer = alarm_new("btif.iot.config"); if (!config_timer) { LOG_ERROR("Unable to create alarm."); log::error("Unable to create alarm."); cleanup(); return future_new_immediate(FUTURE_FAIL); } Loading @@ -159,18 +161,18 @@ future_t* device_iot_config_module_init(void) { } future_t* device_iot_config_module_start_up(void) { LOG_INFO(""); log::info(""); return future_new_immediate(FUTURE_SUCCESS); } future_t* device_iot_config_module_shut_down(void) { LOG_INFO(""); log::info(""); device_iot_config_flush(); return future_new_immediate(FUTURE_SUCCESS); } future_t* device_iot_config_module_clean_up(void) { LOG_INFO(""); log::info(""); if (config_timer != NULL && alarm_is_scheduled(config_timer)) device_iot_config_flush(); Loading @@ -196,7 +198,7 @@ void device_iot_config_write(uint16_t event, UNUSED_ATTR char* p_param) { CHECK(config != NULL); CHECK(config_timer != NULL); LOG_INFO("evt=%d", event); log::info("evt={}", event); std::unique_lock<std::mutex> lock(config_lock); if (event == IOT_CONFIG_SAVE_TIMER_FIRED_EVT) { device_iot_config_set_modified_time(); Loading Loading @@ -235,7 +237,7 @@ void device_iot_config_save_async(void) { CHECK(config != NULL); CHECK(config_timer != NULL); LOG_VERBOSE(""); log::verbose(""); alarm_set(config_timer, CONFIG_SETTLE_PERIOD_MS, device_iot_config_timer_save_cb, NULL); } Loading Loading @@ -264,7 +266,7 @@ void device_iot_config_restrict_device_num(config_t& config) { need_remove_devices_num = curr_num - DEVICES_MAX_NUM_IN_IOT_INFO_FILE + DEVICES_NUM_MARGIN; LOG_INFO("curr_num=%d, need_remove_num=%d", curr_num, log::info("curr_num={}, need_remove_num={}", curr_num, need_remove_devices_num); std::list<section_t>::iterator i = config.sections.begin(); Loading Loading @@ -299,7 +301,7 @@ void device_iot_config_timer_save_cb(UNUSED_ATTR void* data) { // Moving file I/O to btif context instead of timer callback because // it usually takes a lot of time to be completed, introducing // delays during A2DP playback causing blips or choppiness. LOG_VERBOSE(""); log::verbose(""); btif_transfer_context(device_iot_config_write, IOT_CONFIG_SAVE_TIMER_FIRED_EVT, NULL, 0, NULL); } Loading system/device/src/esco_parameters.cc +5 −3 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ #include "device/include/esco_parameters.h" #include <android_bluetooth_flags.h> #include <bluetooth/log.h> #include "base/logging.h" #include "check.h" #include "hci/controller_interface.h" #include "main/shim/entry.h" using namespace bluetooth; static const enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = { // CVSD D1 { Loading Loading @@ -334,13 +336,13 @@ enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec, bool offload) { if (IS_FLAG_ENABLED(use_dsp_codec_when_controller_does_not_support)) { auto controller = bluetooth::shim::GetController(); if (controller == nullptr) { LOG_WARN("controller is null"); log::warn("controller is null"); } else { codecIds = controller->GetLocalSupportedBrEdrCodecIds(); if (std::find(codecIds.begin(), codecIds.end(), ESCO_CODING_FORMAT_LC3) == codecIds.end()) { if (codec == ESCO_CODEC_LC3_T1 || codec == ESCO_CODEC_LC3_T2) { LOG_INFO("BT controller does not support LC3 codec, use DSP codec"); log::info("BT controller does not support LC3 codec, use DSP codec"); enh_esco_params_t param = default_esco_parameters[codec]; param.input_coding_format.coding_format = ESCO_CODING_FORMAT_LC3; param.output_coding_format.coding_format = ESCO_CODING_FORMAT_LC3; Loading system/device/src/interop.cc +91 −74 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <assert.h> #include <base/logging.h> #include <bluetooth/log.h> #include <ctype.h> #include <fcntl.h> #include <hardware/bluetooth.h> Loading Loading @@ -50,6 +51,8 @@ #include "osi/include/osi.h" #include "types/raw_address.h" using namespace bluetooth; #ifdef __ANDROID__ static const char* INTEROP_DYNAMIC_FILE_PATH = "/data/misc/bluedroid/interop_database_dynamic.conf"; Loading Loading @@ -186,6 +189,11 @@ typedef struct { } interop_db_entry_t; namespace fmt { template <> struct formatter<interop_bl_type> : enum_formatter<interop_bl_type> {}; } // namespace fmt static const char* interop_feature_string_(const interop_feature_t feature); static void interop_free_entry_(void* data); static void interop_lazy_init_(void); Loading Loading @@ -266,8 +274,8 @@ void interop_database_add(const uint16_t feature, const RawAddress* addr, } void interop_database_clear() { LOG_DEBUG("interop_is_initialized: %d interop_list: %p", interop_is_initialized, interop_list); log::debug("interop_is_initialized: {} interop_list: {}", interop_is_initialized, fmt::ptr(interop_list)); if (interop_is_initialized && interop_list) { for (int feature = BEGINNING_OF_INTEROP_LIST; Loading @@ -278,7 +286,7 @@ void interop_database_clear() { } static void interop_init_feature_name_id_map() { LOG_DEBUG(""); log::debug(""); feature_name_id_map.clear(); Loading Loading @@ -422,7 +430,7 @@ static int interop_config_init(void) { if (!stat(INTEROP_STATIC_FILE_PATH, &sts) && sts.st_size) { if (!(config_static = config_new(INTEROP_STATIC_FILE_PATH))) { LOG_WARN("unable to load static config file for : %s", log::warn("unable to load static config file for : {}", INTEROP_STATIC_FILE_PATH); } } Loading @@ -432,7 +440,7 @@ static int interop_config_init(void) { if (!stat(INTEROP_DYNAMIC_FILE_PATH, &sts) && sts.st_size) { if (!(config_dynamic = config_new(INTEROP_DYNAMIC_FILE_PATH))) { LOG_WARN("unable to load dynamic config file for : %s", log::warn("unable to load dynamic config file for : {}", INTEROP_DYNAMIC_FILE_PATH); } } Loading Loading @@ -497,7 +505,7 @@ int interop_feature_name_to_feature_id(const char* feature_name) { auto it = feature_name_id_map.find(std::string(feature_name)); if (it == feature_name_id_map.end()) { LOG_WARN("feature does not exist: %s", feature_name); log::warn("feature does not exist: {}", feature_name); return -1; } Loading Loading @@ -601,7 +609,7 @@ static bool interop_config_add_or_remove(interop_db_entry_t* db_entry, break; } default: LOG_ERROR("bl_type: %d not handled", db_entry->bl_type); log::error("bl_type: {} not handled", db_entry->bl_type); status = false; break; } Loading @@ -627,7 +635,7 @@ static void interop_database_add_(interop_db_entry_t* db_entry, bool persist) { if (match_found) { // return as the entry is already present LOG_DEBUG("Entry is already present in the list"); log::debug("Entry is already present in the list"); return; } Loading Loading @@ -766,7 +774,7 @@ static bool interop_database_match(interop_db_entry_t* entry, break; } default: LOG_ERROR("bl_type: %d not handled", db_entry->bl_type); log::error("bl_type: {} not handled", db_entry->bl_type); break; } Loading @@ -786,7 +794,7 @@ static bool interop_database_remove_(interop_db_entry_t* entry) { if (!interop_database_match( entry, &ret_entry, (interop_entry_type)(INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_ERROR("Entry not found in the list"); log::error("Entry not found in the list"); return false; } Loading Loading @@ -916,7 +924,7 @@ static bool load_to_database(int feature, const char* key, const char* value, len = (strlen(key) + 1) / 3; if (len < 3 || len > 4) { LOG_WARN("Ignoring as invalid entry for Address %s", key); log::warn("Ignoring as invalid entry for Address {}", key); return false; } Loading @@ -925,8 +933,8 @@ static bool load_to_database(int feature, const char* key, const char* value, for (int i = 6; i > len; i--) bdstr.append(append_str); if (!RawAddress::FromString(bdstr, addr)) { LOG_WARN( "key %s or Bluetooth Address %s is invalid, not added to interop " log::warn( "key {} or Bluetooth Address {} is invalid, not added to interop " "list", key, ADDRESS_TO_LOGGABLE_CSTR(addr)); return false; Loading @@ -943,7 +951,7 @@ static bool load_to_database(int feature, const char* key, const char* value, } else if (!strncasecmp(value, NAME_BASED, strlen(NAME_BASED))) { if (strlen(key) > KEY_MAX_LENGTH - 1) { LOG_WARN("ignoring %s due to invalid length", key); log::warn("ignoring {} due to invalid length", key); return false; } interop_db_entry_t* entry = Loading @@ -960,7 +968,7 @@ static bool load_to_database(int feature, const char* key, const char* value, uint16_t manufacturer; if (strlen(key) != VALID_MNFR_STR_LEN) { LOG_WARN("ignoring %s due to invalid Manufacturer id in config file", log::warn("ignoring {} due to invalid Manufacturer id in config file", key); return false; } Loading @@ -981,14 +989,14 @@ static bool load_to_database(int feature, const char* key, const char* value, char tmp_key[VALID_VNDR_PRDT_LEN + 1] = {'\0'}; if (strlen(key) != VALID_VNDR_PRDT_LEN) { LOG_WARN("ignoring %s due to invalid vendor/product id in config file", log::warn("ignoring {} due to invalid vendor/product id in config file", key); return false; } strlcpy(tmp_key, key, VALID_VNDR_PRDT_LEN + 1); if (!get_vendor_product_id(tmp_key, &vendor_id, &product_id)) { LOG_WARN("Error in parsing vendor/product id %s", key); log::warn("Error in parsing vendor/product id {}", key); return false; } Loading @@ -1007,14 +1015,14 @@ static bool load_to_database(int feature, const char* key, const char* value, char bdaddr_str[KEY_MAX_LENGTH] = {'\0'}; if (strlen(key) != VALID_SSR_LAT_LEN) { LOG_WARN("ignoring %s due to invalid key for ssr max lat in config file", log::warn("ignoring {} due to invalid key for ssr max lat in config file", key); return false; } strlcpy(tmp_key, key, KEY_MAX_LENGTH); if (!get_addr_maxlat(tmp_key, bdaddr_str, &max_lat)) { LOG_WARN("Error in parsing address and max_lat %s", key); log::warn("Error in parsing address and max_lat {}", key); return false; } Loading @@ -1022,7 +1030,7 @@ static bool load_to_database(int feature, const char* key, const char* value, len = (strlen(bdaddr_str) + 1) / 3; if (len != 3) { LOG_WARN("Ignoring as invalid entry for Address %s", bdaddr_str); log::warn("Ignoring as invalid entry for Address {}", bdaddr_str); return false; } Loading @@ -1033,8 +1041,8 @@ static bool load_to_database(int feature, const char* key, const char* value, bdstr.append(append_str); if (!RawAddress::FromString(bdstr, addr)) { LOG_WARN( "key %s or Bluetooth Address %s is invalid, not added to interop " log::warn( "key {} or Bluetooth Address {} is invalid, not added to interop " "list", key, ADDRESS_TO_LOGGABLE_CSTR(addr)); return false; Loading @@ -1052,7 +1060,7 @@ static bool load_to_database(int feature, const char* key, const char* value, uint16_t version; if (strlen(key) != VALID_VERSION_LEN) { LOG_WARN("ignoring %s due to invalid version in config file", key); log::warn("ignoring {} due to invalid version in config file", key); return false; } Loading @@ -1073,14 +1081,14 @@ static bool load_to_database(int feature, const char* key, const char* value, char bdaddr_str[KEY_MAX_LENGTH] = {'\0'}; if (strlen(key) != VALID_LMP_VERSION_LEN) { LOG_WARN("ignoring %s due to invalid key for lmp ver in config file", log::warn("ignoring {} due to invalid key for lmp ver in config file", key); return false; } strlcpy(tmp_key, key, KEY_MAX_LENGTH); if (!get_addr_lmp_ver(tmp_key, bdaddr_str, &lmp_ver, &lmp_sub_ver)) { LOG_WARN("Error in parsing address and lmp_ver %s", key); log::warn("Error in parsing address and lmp_ver {}", key); return false; } Loading @@ -1088,7 +1096,7 @@ static bool load_to_database(int feature, const char* key, const char* value, len = (strlen(bdaddr_str) + 1) / 3; if (len != 3) { LOG_WARN("Ignoring as invalid entry for Address %s", bdaddr_str); log::warn("Ignoring as invalid entry for Address {}", bdaddr_str); return false; } Loading @@ -1099,8 +1107,8 @@ static bool load_to_database(int feature, const char* key, const char* value, bdstr.append(append_str); if (!RawAddress::FromString(bdstr, addr)) { LOG_WARN( "key %s or Bluetooth Address %s is invalid, not added to interop " log::warn( "key {} or Bluetooth Address {} is invalid, not added to interop " "list", key, ADDRESS_TO_LOGGABLE_CSTR(addr)); return false; Loading @@ -1121,14 +1129,15 @@ static bool load_to_database(int feature, const char* key, const char* value, char tmp_key[KEY_MAX_LENGTH] = {'\0'}; if (strlen(key) != VALID_ADDR_RANGE_LEN) { LOG_WARN("Ignoring as invalid entry for Address range %s", key); log::warn("Ignoring as invalid entry for Address range {}", key); return false; } strlcpy(tmp_key, key, VALID_ADDR_RANGE_LEN + 1); if (!get_addr_range(tmp_key, &addr_start, &addr_end)) { LOG_WARN("key: %s addr_start %s or addr end %s is added to interop list", key, ADDRESS_TO_LOGGABLE_CSTR(addr_start), log::warn( "key: {} addr_start {} or addr end {} is added to interop list", key, ADDRESS_TO_LOGGABLE_CSTR(addr_start), ADDRESS_TO_LOGGABLE_CSTR(addr_end)); return false; Loading @@ -1144,7 +1153,7 @@ static bool load_to_database(int feature, const char* key, const char* value, interop_database_add_(entry, false); } LOG_VERBOSE("feature:: %d, key :: %s, value :: %s", feature, key, value); log::verbose("feature:: {}, key :: {}, value :: {}", feature, key, value); return true; } Loading @@ -1152,7 +1161,7 @@ static void load_config() { int init_status = interop_config_init(); if (init_status == -1) { LOG_ERROR("Error in initializing interop static config file"); log::error("Error in initializing interop static config file"); return; } Loading Loading @@ -1304,8 +1313,8 @@ bool interop_database_match_manufacturer(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN( "Device with manufacturer id: %d is a match for interop workaround %s", log::warn( "Device with manufacturer id: {} is a match for interop workaround {}", manufacturer, interop_feature_string_(feature)); return true; } Loading @@ -1330,7 +1339,7 @@ bool interop_database_match_name(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device with name: %s is a match for interop workaround %s", name, log::warn("Device with name: {} is a match for interop workaround {}", name, interop_feature_string_(feature)); return true; } Loading @@ -1353,8 +1362,9 @@ bool interop_database_match_addr(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } Loading @@ -1365,8 +1375,9 @@ bool interop_database_match_addr(const interop_feature_t feature, if (interop_database_match(&entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } Loading @@ -1386,9 +1397,9 @@ bool interop_database_match_vndr_prdt(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN( "Device with vendor_id: %d product_id: %d is a match for interop " "workaround %s", log::warn( "Device with vendor_id: {} product_id: {} is a match for interop " "workaround {}", vendor_id, product_id, interop_feature_string_(feature)); return true; } Loading @@ -1411,8 +1422,9 @@ bool interop_database_match_addr_get_max_lat(const interop_feature_t feature, &entry, &ret_entry, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); *max_lat = ret_entry->entry_type.ssr_max_lat_entry.max_lat; return true; } Loading @@ -1432,7 +1444,8 @@ bool interop_database_match_version(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device with version: 0x%04x is a match for interop workaround %s", log::warn( "Device with version: 0x{:04x} is a match for interop workaround {}", version, interop_feature_string_(feature)); return true; } Loading @@ -1456,8 +1469,9 @@ bool interop_database_match_addr_get_lmp_ver(const interop_feature_t feature, &entry, &ret_entry, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); *lmp_ver = ret_entry->entry_type.lmp_version_entry.lmp_ver; *lmp_sub_ver = ret_entry->entry_type.lmp_version_entry.lmp_sub_ver; return true; Loading @@ -1478,8 +1492,8 @@ bool interop_database_remove_name(const interop_feature_t feature, entry.entry_type.name_entry.feature = (interop_feature_t)feature; entry.entry_type.name_entry.length = strlen(entry.entry_type.name_entry.name); if (interop_database_remove_(&entry)) { LOG_WARN("Device with name: %s is removed from interop workaround %s", name, interop_feature_string_(feature)); log::warn("Device with name: {} is removed from interop workaround {}", name, interop_feature_string_(feature)); return true; } Loading @@ -1495,8 +1509,8 @@ bool interop_database_remove_manufacturer(const interop_feature_t feature, entry.entry_type.mnfr_entry.feature = feature; entry.entry_type.mnfr_entry.manufacturer = manufacturer; if (interop_database_remove_(&entry)) { LOG_WARN( "Device with manufacturer id: %d is removed from interop workaround %s", log::warn( "Device with manufacturer id: {} is removed from interop workaround {}", manufacturer, interop_feature_string_(feature)); return true; } Loading @@ -1516,8 +1530,9 @@ bool interop_database_remove_addr(const interop_feature_t feature, entry.entry_type.addr_entry.feature = (interop_feature_t)feature; entry.entry_type.addr_entry.length = sizeof(RawAddress); if (interop_database_remove_(&entry)) { LOG_WARN("Device %s is a removed from interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a removed from interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } Loading Loading @@ -1587,7 +1602,7 @@ bool interop_database_remove_feature(const interop_feature_t feature) { for (const section_t& sec : config_dynamic.get()->sections) { if (feature == interop_feature_name_to_feature_id(sec.name.c_str())) { LOG_WARN("found feature - %s", interop_feature_string_(feature)); log::warn("found feature - {}", interop_feature_string_(feature)); interop_config_remove_section(sec.name); return true; } Loading @@ -1609,9 +1624,9 @@ bool interop_database_remove_vndr_prdt(const interop_feature_t feature, entry.entry_type.vnr_pdt_entry.product_id = product_id; if (interop_database_remove_(&entry)) { LOG_WARN( "Device with vendor_id: %d product_id: %d is removed from interop " "workaround %s", log::warn( "Device with vendor_id: {} product_id: {} is removed from interop " "workaround {}", vendor_id, product_id, interop_feature_string_(feature)); return true; } Loading @@ -1631,8 +1646,9 @@ bool interop_database_remove_addr_max_lat(const interop_feature_t feature, entry.entry_type.ssr_max_lat_entry.max_lat = max_lat; if (interop_database_remove_(&entry)) { LOG_WARN("Device %s is a removed from interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a removed from interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } return false; Loading @@ -1649,8 +1665,8 @@ bool interop_database_remove_version(const interop_feature_t feature, entry.entry_type.version_entry.version = version; if (interop_database_remove_(&entry)) { LOG_WARN( "Device with version: 0x%04x is removed from interop workaround %s", log::warn( "Device with version: 0x{:04x} is removed from interop workaround {}", version, interop_feature_string_(feature)); return true; } Loading @@ -1672,8 +1688,9 @@ bool interop_database_remove_addr_lmp_version(const interop_feature_t feature, entry.entry_type.lmp_version_entry.lmp_sub_ver = lmp_sub_ver; if (interop_database_remove_(&entry)) { LOG_WARN("Device %s is a removed from interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a removed from interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } return false; Loading @@ -1690,7 +1707,7 @@ static void interop_database_save_allowlisted_media_players_list( for (const section_t& sec : config->sections) { if (INTEROP_BROWSE_PLAYER_ALLOW_LIST == interop_feature_name_to_feature_id(sec.name.c_str())) { LOG_WARN("found feature - %s", sec.name.c_str()); log::warn("found feature - {}", sec.name); for (const entry_t& entry : sec.entries) { list_append(media_player_list, (void*)(new std::string(entry.key))); } Loading Loading
system/device/src/device_iot_config.cc +10 −7 Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ * limitations under the License. * ******************************************************************************/ #include "internal_include/bt_target.h" #define LOG_TAG "device_iot_config" #include "device/include/device_iot_config.h" #include <base/logging.h> #include <bluetooth/log.h> #include <ctype.h> #include <stdio.h> #include <string.h> Loading @@ -30,9 +32,9 @@ #include <string> #include "common/init_flags.h" #include "device/include/device_iot_config.h" #include "device_iot_config_int.h" #include "include/check.h" #include "internal_include/bt_target.h" #include "os/log.h" #include "osi/include/alarm.h" #include "osi/include/allocator.h" Loading @@ -49,6 +51,7 @@ std::unique_ptr<config_t> config; alarm_t* config_timer; using bluetooth::common::InitFlags; using namespace bluetooth; bool device_iot_config_has_section(const std::string& section) { if (!InitFlags::IsDeviceIotConfigLoggingEnabled()) return false; Loading Loading @@ -275,12 +278,12 @@ bool device_iot_config_set_bin(const std::string& section, CHECK(config != NULL); LOG_VERBOSE("Key = %s", key.c_str()); log::verbose("Key = {}", key); if (length > 0) CHECK(value != NULL); char* str = (char*)osi_calloc(length * 2 + 1); if (str == NULL) { LOG_ERROR("Unable to allocate a str."); log::error("Unable to allocate a str."); return false; } Loading Loading @@ -320,7 +323,7 @@ void device_iot_config_flush(void) { int event = alarm_is_scheduled(config_timer) ? IOT_CONFIG_SAVE_TIMER_FIRED_EVT : IOT_CONFIG_FLUSH_EVT; LOG_VERBOSE("evt=%d", event); log::verbose("evt={}", event); alarm_cancel(config_timer); device_iot_config_write(event, NULL); } Loading @@ -331,7 +334,7 @@ bool device_iot_config_clear(void) { CHECK(config != NULL); CHECK(config_timer != NULL); LOG_INFO(""); log::info(""); alarm_cancel(config_timer); std::unique_lock<std::mutex> lock(config_lock); Loading
system/device/src/device_iot_config_int.cc +20 −18 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "device_iot_config_int.h" #include <base/logging.h> #include <bluetooth/log.h> #include <stdio.h> #include <string.h> #include <time.h> Loading Loading @@ -52,6 +53,7 @@ extern std::unique_ptr<config_t> config; extern alarm_t* config_timer; using bluetooth::common::InitFlags; using namespace bluetooth; static void cleanup() { alarm_free(config_timer); Loading @@ -63,7 +65,7 @@ static void cleanup() { // Module lifecycle functions future_t* device_iot_config_module_init(void) { LOG_INFO(""); log::info(""); std::unique_lock<std::mutex> lock(config_lock); Loading @@ -77,20 +79,20 @@ future_t* device_iot_config_module_init(void) { config = config_new(IOT_CONFIG_FILE_PATH); device_iot_config_source = ORIGINAL; if (!config) { LOG_WARN("Unable to load config file: %s; using backup.", log::warn("Unable to load config file: {}; using backup.", IOT_CONFIG_FILE_PATH); config = config_new(IOT_CONFIG_BACKUP_PATH); device_iot_config_source = BACKUP; } if (!config) { LOG_ERROR("Unable to load bak file; creating empty config."); log::error("Unable to load bak file; creating empty config."); config = config_new_empty(); device_iot_config_source = NEW_FILE; } if (!config) { LOG_ERROR("Unable to allocate a config object."); log::error("Unable to allocate a config object."); cleanup(); return future_new_immediate(FUTURE_FAIL); } Loading @@ -108,14 +110,14 @@ future_t* device_iot_config_module_init(void) { } if (version != DEVICE_IOT_INFO_CURRENT_VERSION) { LOG_INFO("Version in file is %d, CURRENT_VERSION is %d ", version, log::info("Version in file is {}, CURRENT_VERSION is {}", version, DEVICE_IOT_INFO_CURRENT_VERSION); remove(IOT_CONFIG_FILE_PATH); remove(IOT_CONFIG_BACKUP_PATH); config.reset(); config = config_new_empty(); if (!config) { LOG_ERROR("Unable to allocate a config object."); log::error("Unable to allocate a config object."); cleanup(); return future_new_immediate(FUTURE_FAIL); } Loading @@ -125,7 +127,7 @@ future_t* device_iot_config_module_init(void) { } device_iot_config_devices_loaded = device_iot_config_get_device_num(*config); LOG_INFO("Devices loaded %d", device_iot_config_devices_loaded); log::info("Devices loaded {}", device_iot_config_devices_loaded); // Read or set config file creation timestamp const std::string* time_str = Loading @@ -150,7 +152,7 @@ future_t* device_iot_config_module_init(void) { // write back to disk. config_timer = alarm_new("btif.iot.config"); if (!config_timer) { LOG_ERROR("Unable to create alarm."); log::error("Unable to create alarm."); cleanup(); return future_new_immediate(FUTURE_FAIL); } Loading @@ -159,18 +161,18 @@ future_t* device_iot_config_module_init(void) { } future_t* device_iot_config_module_start_up(void) { LOG_INFO(""); log::info(""); return future_new_immediate(FUTURE_SUCCESS); } future_t* device_iot_config_module_shut_down(void) { LOG_INFO(""); log::info(""); device_iot_config_flush(); return future_new_immediate(FUTURE_SUCCESS); } future_t* device_iot_config_module_clean_up(void) { LOG_INFO(""); log::info(""); if (config_timer != NULL && alarm_is_scheduled(config_timer)) device_iot_config_flush(); Loading @@ -196,7 +198,7 @@ void device_iot_config_write(uint16_t event, UNUSED_ATTR char* p_param) { CHECK(config != NULL); CHECK(config_timer != NULL); LOG_INFO("evt=%d", event); log::info("evt={}", event); std::unique_lock<std::mutex> lock(config_lock); if (event == IOT_CONFIG_SAVE_TIMER_FIRED_EVT) { device_iot_config_set_modified_time(); Loading Loading @@ -235,7 +237,7 @@ void device_iot_config_save_async(void) { CHECK(config != NULL); CHECK(config_timer != NULL); LOG_VERBOSE(""); log::verbose(""); alarm_set(config_timer, CONFIG_SETTLE_PERIOD_MS, device_iot_config_timer_save_cb, NULL); } Loading Loading @@ -264,7 +266,7 @@ void device_iot_config_restrict_device_num(config_t& config) { need_remove_devices_num = curr_num - DEVICES_MAX_NUM_IN_IOT_INFO_FILE + DEVICES_NUM_MARGIN; LOG_INFO("curr_num=%d, need_remove_num=%d", curr_num, log::info("curr_num={}, need_remove_num={}", curr_num, need_remove_devices_num); std::list<section_t>::iterator i = config.sections.begin(); Loading Loading @@ -299,7 +301,7 @@ void device_iot_config_timer_save_cb(UNUSED_ATTR void* data) { // Moving file I/O to btif context instead of timer callback because // it usually takes a lot of time to be completed, introducing // delays during A2DP playback causing blips or choppiness. LOG_VERBOSE(""); log::verbose(""); btif_transfer_context(device_iot_config_write, IOT_CONFIG_SAVE_TIMER_FIRED_EVT, NULL, 0, NULL); } Loading
system/device/src/esco_parameters.cc +5 −3 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ #include "device/include/esco_parameters.h" #include <android_bluetooth_flags.h> #include <bluetooth/log.h> #include "base/logging.h" #include "check.h" #include "hci/controller_interface.h" #include "main/shim/entry.h" using namespace bluetooth; static const enh_esco_params_t default_esco_parameters[ESCO_NUM_CODECS] = { // CVSD D1 { Loading Loading @@ -334,13 +336,13 @@ enh_esco_params_t esco_parameters_for_codec(esco_codec_t codec, bool offload) { if (IS_FLAG_ENABLED(use_dsp_codec_when_controller_does_not_support)) { auto controller = bluetooth::shim::GetController(); if (controller == nullptr) { LOG_WARN("controller is null"); log::warn("controller is null"); } else { codecIds = controller->GetLocalSupportedBrEdrCodecIds(); if (std::find(codecIds.begin(), codecIds.end(), ESCO_CODING_FORMAT_LC3) == codecIds.end()) { if (codec == ESCO_CODEC_LC3_T1 || codec == ESCO_CODEC_LC3_T2) { LOG_INFO("BT controller does not support LC3 codec, use DSP codec"); log::info("BT controller does not support LC3 codec, use DSP codec"); enh_esco_params_t param = default_esco_parameters[codec]; param.input_coding_format.coding_format = ESCO_CODING_FORMAT_LC3; param.output_coding_format.coding_format = ESCO_CODING_FORMAT_LC3; Loading
system/device/src/interop.cc +91 −74 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <assert.h> #include <base/logging.h> #include <bluetooth/log.h> #include <ctype.h> #include <fcntl.h> #include <hardware/bluetooth.h> Loading Loading @@ -50,6 +51,8 @@ #include "osi/include/osi.h" #include "types/raw_address.h" using namespace bluetooth; #ifdef __ANDROID__ static const char* INTEROP_DYNAMIC_FILE_PATH = "/data/misc/bluedroid/interop_database_dynamic.conf"; Loading Loading @@ -186,6 +189,11 @@ typedef struct { } interop_db_entry_t; namespace fmt { template <> struct formatter<interop_bl_type> : enum_formatter<interop_bl_type> {}; } // namespace fmt static const char* interop_feature_string_(const interop_feature_t feature); static void interop_free_entry_(void* data); static void interop_lazy_init_(void); Loading Loading @@ -266,8 +274,8 @@ void interop_database_add(const uint16_t feature, const RawAddress* addr, } void interop_database_clear() { LOG_DEBUG("interop_is_initialized: %d interop_list: %p", interop_is_initialized, interop_list); log::debug("interop_is_initialized: {} interop_list: {}", interop_is_initialized, fmt::ptr(interop_list)); if (interop_is_initialized && interop_list) { for (int feature = BEGINNING_OF_INTEROP_LIST; Loading @@ -278,7 +286,7 @@ void interop_database_clear() { } static void interop_init_feature_name_id_map() { LOG_DEBUG(""); log::debug(""); feature_name_id_map.clear(); Loading Loading @@ -422,7 +430,7 @@ static int interop_config_init(void) { if (!stat(INTEROP_STATIC_FILE_PATH, &sts) && sts.st_size) { if (!(config_static = config_new(INTEROP_STATIC_FILE_PATH))) { LOG_WARN("unable to load static config file for : %s", log::warn("unable to load static config file for : {}", INTEROP_STATIC_FILE_PATH); } } Loading @@ -432,7 +440,7 @@ static int interop_config_init(void) { if (!stat(INTEROP_DYNAMIC_FILE_PATH, &sts) && sts.st_size) { if (!(config_dynamic = config_new(INTEROP_DYNAMIC_FILE_PATH))) { LOG_WARN("unable to load dynamic config file for : %s", log::warn("unable to load dynamic config file for : {}", INTEROP_DYNAMIC_FILE_PATH); } } Loading Loading @@ -497,7 +505,7 @@ int interop_feature_name_to_feature_id(const char* feature_name) { auto it = feature_name_id_map.find(std::string(feature_name)); if (it == feature_name_id_map.end()) { LOG_WARN("feature does not exist: %s", feature_name); log::warn("feature does not exist: {}", feature_name); return -1; } Loading Loading @@ -601,7 +609,7 @@ static bool interop_config_add_or_remove(interop_db_entry_t* db_entry, break; } default: LOG_ERROR("bl_type: %d not handled", db_entry->bl_type); log::error("bl_type: {} not handled", db_entry->bl_type); status = false; break; } Loading @@ -627,7 +635,7 @@ static void interop_database_add_(interop_db_entry_t* db_entry, bool persist) { if (match_found) { // return as the entry is already present LOG_DEBUG("Entry is already present in the list"); log::debug("Entry is already present in the list"); return; } Loading Loading @@ -766,7 +774,7 @@ static bool interop_database_match(interop_db_entry_t* entry, break; } default: LOG_ERROR("bl_type: %d not handled", db_entry->bl_type); log::error("bl_type: {} not handled", db_entry->bl_type); break; } Loading @@ -786,7 +794,7 @@ static bool interop_database_remove_(interop_db_entry_t* entry) { if (!interop_database_match( entry, &ret_entry, (interop_entry_type)(INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_ERROR("Entry not found in the list"); log::error("Entry not found in the list"); return false; } Loading Loading @@ -916,7 +924,7 @@ static bool load_to_database(int feature, const char* key, const char* value, len = (strlen(key) + 1) / 3; if (len < 3 || len > 4) { LOG_WARN("Ignoring as invalid entry for Address %s", key); log::warn("Ignoring as invalid entry for Address {}", key); return false; } Loading @@ -925,8 +933,8 @@ static bool load_to_database(int feature, const char* key, const char* value, for (int i = 6; i > len; i--) bdstr.append(append_str); if (!RawAddress::FromString(bdstr, addr)) { LOG_WARN( "key %s or Bluetooth Address %s is invalid, not added to interop " log::warn( "key {} or Bluetooth Address {} is invalid, not added to interop " "list", key, ADDRESS_TO_LOGGABLE_CSTR(addr)); return false; Loading @@ -943,7 +951,7 @@ static bool load_to_database(int feature, const char* key, const char* value, } else if (!strncasecmp(value, NAME_BASED, strlen(NAME_BASED))) { if (strlen(key) > KEY_MAX_LENGTH - 1) { LOG_WARN("ignoring %s due to invalid length", key); log::warn("ignoring {} due to invalid length", key); return false; } interop_db_entry_t* entry = Loading @@ -960,7 +968,7 @@ static bool load_to_database(int feature, const char* key, const char* value, uint16_t manufacturer; if (strlen(key) != VALID_MNFR_STR_LEN) { LOG_WARN("ignoring %s due to invalid Manufacturer id in config file", log::warn("ignoring {} due to invalid Manufacturer id in config file", key); return false; } Loading @@ -981,14 +989,14 @@ static bool load_to_database(int feature, const char* key, const char* value, char tmp_key[VALID_VNDR_PRDT_LEN + 1] = {'\0'}; if (strlen(key) != VALID_VNDR_PRDT_LEN) { LOG_WARN("ignoring %s due to invalid vendor/product id in config file", log::warn("ignoring {} due to invalid vendor/product id in config file", key); return false; } strlcpy(tmp_key, key, VALID_VNDR_PRDT_LEN + 1); if (!get_vendor_product_id(tmp_key, &vendor_id, &product_id)) { LOG_WARN("Error in parsing vendor/product id %s", key); log::warn("Error in parsing vendor/product id {}", key); return false; } Loading @@ -1007,14 +1015,14 @@ static bool load_to_database(int feature, const char* key, const char* value, char bdaddr_str[KEY_MAX_LENGTH] = {'\0'}; if (strlen(key) != VALID_SSR_LAT_LEN) { LOG_WARN("ignoring %s due to invalid key for ssr max lat in config file", log::warn("ignoring {} due to invalid key for ssr max lat in config file", key); return false; } strlcpy(tmp_key, key, KEY_MAX_LENGTH); if (!get_addr_maxlat(tmp_key, bdaddr_str, &max_lat)) { LOG_WARN("Error in parsing address and max_lat %s", key); log::warn("Error in parsing address and max_lat {}", key); return false; } Loading @@ -1022,7 +1030,7 @@ static bool load_to_database(int feature, const char* key, const char* value, len = (strlen(bdaddr_str) + 1) / 3; if (len != 3) { LOG_WARN("Ignoring as invalid entry for Address %s", bdaddr_str); log::warn("Ignoring as invalid entry for Address {}", bdaddr_str); return false; } Loading @@ -1033,8 +1041,8 @@ static bool load_to_database(int feature, const char* key, const char* value, bdstr.append(append_str); if (!RawAddress::FromString(bdstr, addr)) { LOG_WARN( "key %s or Bluetooth Address %s is invalid, not added to interop " log::warn( "key {} or Bluetooth Address {} is invalid, not added to interop " "list", key, ADDRESS_TO_LOGGABLE_CSTR(addr)); return false; Loading @@ -1052,7 +1060,7 @@ static bool load_to_database(int feature, const char* key, const char* value, uint16_t version; if (strlen(key) != VALID_VERSION_LEN) { LOG_WARN("ignoring %s due to invalid version in config file", key); log::warn("ignoring {} due to invalid version in config file", key); return false; } Loading @@ -1073,14 +1081,14 @@ static bool load_to_database(int feature, const char* key, const char* value, char bdaddr_str[KEY_MAX_LENGTH] = {'\0'}; if (strlen(key) != VALID_LMP_VERSION_LEN) { LOG_WARN("ignoring %s due to invalid key for lmp ver in config file", log::warn("ignoring {} due to invalid key for lmp ver in config file", key); return false; } strlcpy(tmp_key, key, KEY_MAX_LENGTH); if (!get_addr_lmp_ver(tmp_key, bdaddr_str, &lmp_ver, &lmp_sub_ver)) { LOG_WARN("Error in parsing address and lmp_ver %s", key); log::warn("Error in parsing address and lmp_ver {}", key); return false; } Loading @@ -1088,7 +1096,7 @@ static bool load_to_database(int feature, const char* key, const char* value, len = (strlen(bdaddr_str) + 1) / 3; if (len != 3) { LOG_WARN("Ignoring as invalid entry for Address %s", bdaddr_str); log::warn("Ignoring as invalid entry for Address {}", bdaddr_str); return false; } Loading @@ -1099,8 +1107,8 @@ static bool load_to_database(int feature, const char* key, const char* value, bdstr.append(append_str); if (!RawAddress::FromString(bdstr, addr)) { LOG_WARN( "key %s or Bluetooth Address %s is invalid, not added to interop " log::warn( "key {} or Bluetooth Address {} is invalid, not added to interop " "list", key, ADDRESS_TO_LOGGABLE_CSTR(addr)); return false; Loading @@ -1121,14 +1129,15 @@ static bool load_to_database(int feature, const char* key, const char* value, char tmp_key[KEY_MAX_LENGTH] = {'\0'}; if (strlen(key) != VALID_ADDR_RANGE_LEN) { LOG_WARN("Ignoring as invalid entry for Address range %s", key); log::warn("Ignoring as invalid entry for Address range {}", key); return false; } strlcpy(tmp_key, key, VALID_ADDR_RANGE_LEN + 1); if (!get_addr_range(tmp_key, &addr_start, &addr_end)) { LOG_WARN("key: %s addr_start %s or addr end %s is added to interop list", key, ADDRESS_TO_LOGGABLE_CSTR(addr_start), log::warn( "key: {} addr_start {} or addr end {} is added to interop list", key, ADDRESS_TO_LOGGABLE_CSTR(addr_start), ADDRESS_TO_LOGGABLE_CSTR(addr_end)); return false; Loading @@ -1144,7 +1153,7 @@ static bool load_to_database(int feature, const char* key, const char* value, interop_database_add_(entry, false); } LOG_VERBOSE("feature:: %d, key :: %s, value :: %s", feature, key, value); log::verbose("feature:: {}, key :: {}, value :: {}", feature, key, value); return true; } Loading @@ -1152,7 +1161,7 @@ static void load_config() { int init_status = interop_config_init(); if (init_status == -1) { LOG_ERROR("Error in initializing interop static config file"); log::error("Error in initializing interop static config file"); return; } Loading Loading @@ -1304,8 +1313,8 @@ bool interop_database_match_manufacturer(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN( "Device with manufacturer id: %d is a match for interop workaround %s", log::warn( "Device with manufacturer id: {} is a match for interop workaround {}", manufacturer, interop_feature_string_(feature)); return true; } Loading @@ -1330,7 +1339,7 @@ bool interop_database_match_name(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device with name: %s is a match for interop workaround %s", name, log::warn("Device with name: {} is a match for interop workaround {}", name, interop_feature_string_(feature)); return true; } Loading @@ -1353,8 +1362,9 @@ bool interop_database_match_addr(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } Loading @@ -1365,8 +1375,9 @@ bool interop_database_match_addr(const interop_feature_t feature, if (interop_database_match(&entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } Loading @@ -1386,9 +1397,9 @@ bool interop_database_match_vndr_prdt(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN( "Device with vendor_id: %d product_id: %d is a match for interop " "workaround %s", log::warn( "Device with vendor_id: {} product_id: {} is a match for interop " "workaround {}", vendor_id, product_id, interop_feature_string_(feature)); return true; } Loading @@ -1411,8 +1422,9 @@ bool interop_database_match_addr_get_max_lat(const interop_feature_t feature, &entry, &ret_entry, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); *max_lat = ret_entry->entry_type.ssr_max_lat_entry.max_lat; return true; } Loading @@ -1432,7 +1444,8 @@ bool interop_database_match_version(const interop_feature_t feature, &entry, NULL, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device with version: 0x%04x is a match for interop workaround %s", log::warn( "Device with version: 0x{:04x} is a match for interop workaround {}", version, interop_feature_string_(feature)); return true; } Loading @@ -1456,8 +1469,9 @@ bool interop_database_match_addr_get_lmp_ver(const interop_feature_t feature, &entry, &ret_entry, (interop_entry_type)(INTEROP_ENTRY_TYPE_STATIC | INTEROP_ENTRY_TYPE_DYNAMIC))) { LOG_WARN("Device %s is a match for interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a match for interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); *lmp_ver = ret_entry->entry_type.lmp_version_entry.lmp_ver; *lmp_sub_ver = ret_entry->entry_type.lmp_version_entry.lmp_sub_ver; return true; Loading @@ -1478,8 +1492,8 @@ bool interop_database_remove_name(const interop_feature_t feature, entry.entry_type.name_entry.feature = (interop_feature_t)feature; entry.entry_type.name_entry.length = strlen(entry.entry_type.name_entry.name); if (interop_database_remove_(&entry)) { LOG_WARN("Device with name: %s is removed from interop workaround %s", name, interop_feature_string_(feature)); log::warn("Device with name: {} is removed from interop workaround {}", name, interop_feature_string_(feature)); return true; } Loading @@ -1495,8 +1509,8 @@ bool interop_database_remove_manufacturer(const interop_feature_t feature, entry.entry_type.mnfr_entry.feature = feature; entry.entry_type.mnfr_entry.manufacturer = manufacturer; if (interop_database_remove_(&entry)) { LOG_WARN( "Device with manufacturer id: %d is removed from interop workaround %s", log::warn( "Device with manufacturer id: {} is removed from interop workaround {}", manufacturer, interop_feature_string_(feature)); return true; } Loading @@ -1516,8 +1530,9 @@ bool interop_database_remove_addr(const interop_feature_t feature, entry.entry_type.addr_entry.feature = (interop_feature_t)feature; entry.entry_type.addr_entry.length = sizeof(RawAddress); if (interop_database_remove_(&entry)) { LOG_WARN("Device %s is a removed from interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a removed from interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } Loading Loading @@ -1587,7 +1602,7 @@ bool interop_database_remove_feature(const interop_feature_t feature) { for (const section_t& sec : config_dynamic.get()->sections) { if (feature == interop_feature_name_to_feature_id(sec.name.c_str())) { LOG_WARN("found feature - %s", interop_feature_string_(feature)); log::warn("found feature - {}", interop_feature_string_(feature)); interop_config_remove_section(sec.name); return true; } Loading @@ -1609,9 +1624,9 @@ bool interop_database_remove_vndr_prdt(const interop_feature_t feature, entry.entry_type.vnr_pdt_entry.product_id = product_id; if (interop_database_remove_(&entry)) { LOG_WARN( "Device with vendor_id: %d product_id: %d is removed from interop " "workaround %s", log::warn( "Device with vendor_id: {} product_id: {} is removed from interop " "workaround {}", vendor_id, product_id, interop_feature_string_(feature)); return true; } Loading @@ -1631,8 +1646,9 @@ bool interop_database_remove_addr_max_lat(const interop_feature_t feature, entry.entry_type.ssr_max_lat_entry.max_lat = max_lat; if (interop_database_remove_(&entry)) { LOG_WARN("Device %s is a removed from interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a removed from interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } return false; Loading @@ -1649,8 +1665,8 @@ bool interop_database_remove_version(const interop_feature_t feature, entry.entry_type.version_entry.version = version; if (interop_database_remove_(&entry)) { LOG_WARN( "Device with version: 0x%04x is removed from interop workaround %s", log::warn( "Device with version: 0x{:04x} is removed from interop workaround {}", version, interop_feature_string_(feature)); return true; } Loading @@ -1672,8 +1688,9 @@ bool interop_database_remove_addr_lmp_version(const interop_feature_t feature, entry.entry_type.lmp_version_entry.lmp_sub_ver = lmp_sub_ver; if (interop_database_remove_(&entry)) { LOG_WARN("Device %s is a removed from interop workaround %s.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); log::warn("Device {} is a removed from interop workaround {}.", ADDRESS_TO_LOGGABLE_CSTR(*addr), interop_feature_string_(feature)); return true; } return false; Loading @@ -1690,7 +1707,7 @@ static void interop_database_save_allowlisted_media_players_list( for (const section_t& sec : config->sections) { if (INTEROP_BROWSE_PLAYER_ALLOW_LIST == interop_feature_name_to_feature_id(sec.name.c_str())) { LOG_WARN("found feature - %s", sec.name.c_str()); log::warn("found feature - {}", sec.name); for (const entry_t& entry : sec.entries) { list_append(media_player_list, (void*)(new std::string(entry.key))); } Loading