diff --git a/hal/acdb.c b/hal/acdb.c index d2b2b94b..f4cebecc 100644 --- a/hal/acdb.c +++ b/hal/acdb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project @@ -102,7 +102,8 @@ int acdb_init_v2(struct mixer *mixer) int result = -1; char *cvd_version = NULL; - char platform_info_file[MIXER_PATH_MAX_LENGTH] = PLATFORM_INFO_XML_PATH; + char vendor_config_path[VENDOR_CONFIG_PATH_MAX_LENGTH]; + char platform_info_file[VENDOR_CONFIG_FILE_MAX_LENGTH]; const char *snd_card_name = NULL; struct acdb_platform_data *my_data = NULL; @@ -118,6 +119,10 @@ int acdb_init_v2(struct mixer *mixer) } list_init(&my_data->acdb_meta_key_list); + audio_get_vendor_config_path(vendor_config_path, sizeof(vendor_config_path)); + /* Get path for platorm_info_xml_path_name in vendor */ + snprintf(platform_info_file, sizeof(platform_info_file), + "%s/%s", vendor_config_path, PLATFORM_INFO_XML_PATH_NAME); get_platform_file_for_device(mixer, platform_info_file); /* Extract META KEY LIST INFO */ platform_info_init(platform_info_file, my_data, ACDB_EXTN); diff --git a/hal/acdb.h b/hal/acdb.h index e0d4628c..10a78d39 100644 --- a/hal/acdb.h +++ b/hal/acdb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project @@ -28,11 +28,9 @@ #define CVD_VERSION_MIXER_CTL "CVD Version" #define ACDB_METAINFO_KEY_MODULE_NAME_LEN 100 -#ifdef LINUX_ENABLED -#define PLATFORM_INFO_XML_PATH "/etc/audio_platform_info.xml" -#else -#define PLATFORM_INFO_XML_PATH "/vendor/etc/audio_platform_info.xml" -#endif + +#define PLATFORM_INFO_XML_PATH_NAME "audio_platform_info.xml" + enum { ACDB_LOADER_INIT_V1 = 1, diff --git a/hal/audio_extn/ffv.c b/hal/audio_extn/ffv.c index fe6ffa6d..4f51cb1b 100644 --- a/hal/audio_extn/ffv.c +++ b/hal/audio_extn/ffv.c @@ -61,21 +61,9 @@ #define AUDIO_PARAMETER_FFV_EC_REF_DEVICE "ffv_ec_ref_dev" #define AUDIO_PARAMETER_FFV_CHANNEL_INDEX "ffv_channel_index" -#if LINUX_ENABLED -#define FFV_CONFIG_FILE_PATH "/etc/BF_1out.cfg" -#ifdef __LP64__ -#define FFV_LIB "/usr/lib64/libffv.so" -#else -#define FFV_LIB "/usr/lib/libffv.so" -#endif -#else -#define FFV_CONFIG_FILE_PATH "/vendor/etc/BF_1out.cfg" -#ifdef __LP64__ -#define FFV_LIB "/vendor/lib64/libffv.so" -#else -#define FFV_LIB "/vendor/lib/libffv.so" -#endif -#endif + +#define FFV_CONFIG_FILE_NAME "BF_1out.cfg" +#define FFV_LIB_NAME "libffv.so" #define FFV_SAMPLING_RATE_16000 16000 #define FFV_EC_REF_LOOPBACK_DEVICE_MONO "ec-ref-loopback-mono" @@ -200,18 +188,46 @@ static struct pcm_config ffv_pcm_config = { .format = PCM_FORMAT_S16_LE, }; +void audio_get_lib_path(char* lib_path, int path_size) +{ +#ifdef LINUX_ENABLED +#ifdef __LP64__ + /* libs are stored in /usr/lib64 */ + snprintf(lib_path, path_size, "%s", "/usr/lib64"); +#else + /* libs are stored in /usr/lib */ + snprintf(lib_path, path_size, "%s", "/usr/lib"); +#endif +#else +#ifdef __LP64__ + /* libs are stored in /vendor/lib64 */ + snprintf(lib_path, path_size, "%s", "/vendor/lib64"); +#else + /* libs are stored in /vendor/lib */ + snprintf(lib_path, path_size, "%s", "/vendor/lib"); +#endif +#endif +} + static int32_t ffv_init_lib() { int status = 0; + char lib_path[VENDOR_CONFIG_PATH_MAX_LENGTH]; + char lib_file[VENDOR_CONFIG_FILE_MAX_LENGTH]; + /* Get path for lib in vendor */ + audio_get_lib_path(lib_path, sizeof(lib_path)); + + /* Get path for ffv_lib_file */ + snprintf(lib_file, sizeof(lib_file), "%s/%s", lib_path, FFV_LIB_NAME); if (ffvmod.ffv_lib_handle) { ALOGE("%s: FFV library is already initialized", __func__); return 0; } - ffvmod.ffv_lib_handle = dlopen(FFV_LIB, RTLD_NOW); + ffvmod.ffv_lib_handle = dlopen(lib_file, RTLD_NOW); if (!ffvmod.ffv_lib_handle) { - ALOGE("%s: Unable to open %s, error %s", __func__, FFV_LIB, + ALOGE("%s: Unable to open %s, error %s", __func__, lib_file, dlerror()); status = -ENOENT; goto exit; @@ -438,7 +454,9 @@ int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic) int num_tx_in_ch, num_out_ch, num_ec_ref_ch; int frame_len; int sample_rate; - const char *config_file_path = FFV_CONFIG_FILE_PATH; + const char *config_file_path; + char vendor_config_path[VENDOR_CONFIG_PATH_MAX_LENGTH]; + char platform_info_xml_path_file[VENDOR_CONFIG_FILE_MAX_LENGTH]; int total_mem_size; FfvStatusType status_type; const char *sm_buffer = "DISABLE_KEYWORD_DETECTION"; @@ -447,6 +465,11 @@ int32_t audio_extn_ffv_stream_init(struct stream_in *in, int key, char* lic) int param_size = 0; int param_id; + audio_get_vendor_config_path(vendor_config_path, sizeof(vendor_config_path)); + /* Get path for ffv_config_file_name in vendor */ + snprintf(platform_info_xml_path_file, sizeof(platform_info_xml_path_file), + "%s/%s", vendor_config_path, FFV_CONFIG_FILE_NAME); + config_file_path = platform_info_xml_path_file; if (!audio_extn_ffv_get_enabled()) { ALOGE("Rejecting FFV -- init is called without enabling FFV"); goto fail; diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index f8f0d691..2f675ea6 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -60,33 +60,17 @@ #define MIXER_XML_BASE_STRING "mixer_paths" #define MIXER_XML_DEFAULT_PATH "mixer_paths.xml" -#ifdef LINUX_ENABLED -#define PLATFORM_INFO_XML_PATH_INTCODEC "/etc/audio_platform_info_intcodec.xml" -#define PLATFORM_INFO_XML_PATH_SKUSH "/etc/audio_platform_info_skush.xml" -#define PLATFORM_INFO_XML_PATH_SKUW "/etc/audio_platform_info_skuw.xml" -#define PLATFORM_INFO_XML_PATH_QRD "/etc/audio_platform_info_qrd.xml" -#define PLATFORM_INFO_XML_PATH_LAGOON_QRD "/etc/audio_platform_info_lagoon_qrd.xml" -#define PLATFORM_INFO_XML_PATH "/etc/audio_platform_info.xml" -#define MIXER_XML_PATH_AUXPCM "/etc/mixer_paths_auxpcm.xml" -#define MIXER_XML_PATH_I2S "/etc/mixer_paths_i2s.xml" -#define PLATFORM_INFO_XML_PATH_I2S "/etc/audio_platform_info_extcodec.xml" -#define PLATFORM_INFO_XML_PATH_WSA "/etc/audio_platform_info_wsa.xml" -#define PLATFORM_INFO_XML_PATH_TDM "/etc/audio_platform_info_tdm.xml" -#define PLATFORM_INFO_XML_PATH_SCUBA_IDP "/etc/audio_platform_info_scubaidp.xml" -#else -#define PLATFORM_INFO_XML_PATH_INTCODEC "/vendor/etc/audio_platform_info_intcodec.xml" -#define PLATFORM_INFO_XML_PATH_SKUSH "/vendor/etc/audio_platform_info_skush.xml" -#define PLATFORM_INFO_XML_PATH_SKUW "/vendor/etc/audio_platform_info_skuw.xml" -#define PLATFORM_INFO_XML_PATH_QRD "/vendor/etc/audio_platform_info_qrd.xml" -#define PLATFORM_INFO_XML_PATH_LAGOON_QRD "/vendor/etc/audio_platform_info_lagoon_qrd.xml" -#define PLATFORM_INFO_XML_PATH "/vendor/etc/audio_platform_info.xml" -#define MIXER_XML_PATH_AUXPCM "/vendor/etc/mixer_paths_auxpcm.xml" -#define MIXER_XML_PATH_I2S "/vendor/etc/mixer_paths_i2s.xml" -#define PLATFORM_INFO_XML_PATH_I2S "/vendor/etc/audio_platform_info_i2s.xml" -#define PLATFORM_INFO_XML_PATH_WSA "/vendor/etc/audio_platform_info_wsa.xml" -#define PLATFORM_INFO_XML_PATH_TDM "/vendor/etc/audio_platform_info_tdm.xml" -#define PLATFORM_INFO_XML_PATH_SCUBA_IDP "/vendor/etc/audio_platform_info_scubaidp.xml" -#endif +#define PLATFORM_INFO_XML_PATH_INTCODEC_NAME "audio_platform_info_intcodec.xml" +#define PLATFORM_INFO_XML_PATH_SKUSH_NAME "audio_platform_info_skush.xml" +#define PLATFORM_INFO_XML_PATH_SKUW_NAME "audio_platform_info_skuw.xml" +#define PLATFORM_INFO_XML_PATH_QRD_NAME "audio_platform_info_qrd.xml" +#define PLATFORM_INFO_XML_PATH_LAGOON_QRD_NAME "audio_platform_info_lagoon_qrd.xml" +#define PLATFORM_INFO_XML_PATH_NAME "audio_platform_info.xml" +#define MIXER_XML_PATH_AUXPCM_NAME "mixer_paths_auxpcm.xml" +#define MIXER_XML_PATH_I2S_NAME "mixer_paths_i2s.xml" +#define PLATFORM_INFO_XML_PATH_I2S_NAME "audio_platform_info_extcodec.xml" +#define PLATFORM_INFO_XML_PATH_WSA_NAME "audio_platform_info_wsa.xml" +#define PLATFORM_INFO_XML_PATH_TDM_NAME "audio_platform_info_tdm.xml" #include #if defined (PLATFORM_MSM8998) || (PLATFORM_SDM845) || (PLATFORM_SDM710) || \ @@ -251,6 +235,8 @@ enum { }; #define PLATFORM_CONFIG_KEY_OPERATOR_INFO "operator_info" +char vendor_config_path[VENDOR_CONFIG_PATH_MAX_LENGTH]; +char xml_file_path[VENDOR_CONFIG_FILE_MAX_LENGTH]; struct operator_info { struct listnode list; @@ -1651,6 +1637,14 @@ bool is_operator_tmus() } } +const char* get_xml_file_path(const char* file_name) +{ + audio_get_vendor_config_path(vendor_config_path, sizeof(vendor_config_path)); + snprintf(xml_file_path, sizeof(xml_file_path), + "%s/%s", vendor_config_path, file_name); + return xml_file_path; +} + static char *get_current_operator() { struct listnode *node; @@ -3319,54 +3313,66 @@ void *platform_init(struct audio_device *adev) if (ret || !my_data->is_internal_codec) my_data->hifi_audio = true; set_platform_defaults(my_data); - /* Initialize ACDB ID's */ - if (my_data->is_i2s_ext_modem && !is_auto_snd_card(snd_card_name)) - platform_info_init(PLATFORM_INFO_XML_PATH_I2S, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "sdm660-snd-card-skush", - sizeof("sdm660-snd-card-skush"))) - platform_info_init(PLATFORM_INFO_XML_PATH_SKUSH, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card", - sizeof("sdm670-skuw-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_SKUW, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card", - sizeof("sm6150-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card", - sizeof("sm6150-wcd9375qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card", - sizeof("lahaina-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "kona-qrd-snd-card", - sizeof("kona-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "sm8150-tavil-qrd-snd-card", - sizeof("sm8150-tavil-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "lito-qrd-snd-card", - sizeof("lito-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "lito-lagoonqrd-snd-card", - sizeof("lito-lagoonqrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_LAGOON_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "atoll-qrd-snd-card", - sizeof("atoll-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "bengal-qrd-snd-card", - sizeof("bengal-qrd-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_QRD, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "bengal-scubaidp-snd-card", - sizeof("bengal-scubaidp-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_SCUBA_IDP, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "qcs405-wsa-snd-card", - sizeof("qcs405-wsa-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_WSA, my_data, PLATFORM); - else if (!strncmp(snd_card_name, "qcs405-tdm-snd-card", - sizeof("qcs405-tdm-snd-card"))) - platform_info_init(PLATFORM_INFO_XML_PATH_TDM, my_data, PLATFORM); - else if (my_data->is_internal_codec) - platform_info_init(PLATFORM_INFO_XML_PATH_INTCODEC, my_data, PLATFORM); + if (my_data->is_i2s_ext_modem && !is_auto_snd_card(snd_card_name)) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_I2S_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "sdm660-snd-card-skush", + sizeof("sdm660-snd-card-skush"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_SKUSH_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "sdm670-skuw-snd-card", + sizeof("sdm670-skuw-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_SKUW_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "sm6150-qrd-snd-card", + sizeof("sm6150-qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "sm6150-wcd9375qrd-snd-card", + sizeof("sm6150-wcd9375qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card", + sizeof("lahaina-qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "kona-qrd-snd-card", + sizeof("kona-qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "sm8150-tavil-qrd-snd-card", + sizeof("sm8150-tavil-qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "lito-qrd-snd-card", + sizeof("lito-qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "lito-lagoonqrd-snd-card", + sizeof("lito-lagoonqrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_LAGOON_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "atoll-qrd-snd-card", + sizeof("atoll-qrd-snd-card"))){ + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "bengal-qrd-snd-card", + sizeof("bengal-qrd-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_QRD_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "qcs405-wsa-snd-card", + sizeof("qcs405-wsa-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_WSA_NAME), + my_data, PLATFORM); + } else if (!strncmp(snd_card_name, "qcs405-tdm-snd-card", + sizeof("qcs405-tdm-snd-card"))) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_TDM_NAME), + my_data, PLATFORM); + } else if (my_data->is_internal_codec) { + platform_info_init(get_xml_file_path(PLATFORM_INFO_XML_PATH_INTCODEC_NAME), + my_data, PLATFORM); + } else { // Try to load pixel or default audio_extn_utils_get_platform_info(snd_card_name, platform_info_file); @@ -3380,9 +3386,8 @@ void *platform_init(struct audio_device *adev) if (platform_is_i2s_ext_modem(snd_card_name, my_data) && !is_auto_snd_card(snd_card_name)) { ALOGD("%s: Call MIXER_XML_PATH_I2S", __func__); - adev->audio_route = audio_route_init(adev->snd_card, - MIXER_XML_PATH_I2S); + get_xml_file_path(MIXER_XML_PATH_I2S_NAME)); } else { /* Get the codec internal name from the sound card name * and form the mixer paths file name dynamically. This @@ -3419,7 +3424,7 @@ void *platform_init(struct audio_device *adev) ALOGD("%s: Loading mixer file: %s", __func__, mixer_xml_file); if (audio_extn_read_xml(adev, adev->snd_card, mixer_xml_file, - MIXER_XML_PATH_AUXPCM) == -ENOSYS) { + get_xml_file_path(MIXER_XML_PATH_AUXPCM_NAME)) == -ENOSYS) { adev->audio_route = audio_route_init(adev->snd_card, mixer_xml_file); } } diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h index c89fee09..88c035bb 100644 --- a/hal/msm8974/platform.h +++ b/hal/msm8974/platform.h @@ -372,7 +372,7 @@ enum { #define ALL_SESSION_VSID 0xFFFFFFFF #define DEFAULT_MUTE_RAMP_DURATION_MS 20 #define DEFAULT_VOLUME_RAMP_DURATION_MS 20 -#define MIXER_PATH_MAX_LENGTH 100 +#define MIXER_PATH_MAX_LENGTH 128 #define CODEC_VERSION_MAX_LENGTH 100 #define CODEC_VARIANT_MAX_LENGTH 100 diff --git a/hal/platform_info.c b/hal/platform_info.c index 9b64c791..76239ace 100644 --- a/hal/platform_info.c +++ b/hal/platform_info.c @@ -39,6 +39,7 @@ #include #include "acdb.h" #include "platform_api.h" +#include "audio_extn.h" #include #include @@ -49,6 +50,8 @@ #endif #define BUF_SIZE 1024 +char vendor_config_path[VENDOR_CONFIG_PATH_MAX_LENGTH]; +char platform_info_xml_path_file[VENDOR_CONFIG_FILE_MAX_LENGTH]; typedef enum { ROOT, @@ -83,6 +86,15 @@ typedef enum { typedef void (* section_process_fn)(const XML_Char **attr); +const char* get_platform_xml_path() +{ + audio_get_vendor_config_path(vendor_config_path, sizeof(vendor_config_path)); + /* Get path for platorm_info_xml_path_name in vendor */ + snprintf(platform_info_xml_path_file, sizeof(platform_info_xml_path_file), + "%s/%s", vendor_config_path, PLATFORM_INFO_XML_PATH_NAME); + return platform_info_xml_path_file; +} + static void process_acdb_id(const XML_Char **attr); static void process_audio_effect(const XML_Char **attr, effect_type_t effect_type); static void process_effect_aec(const XML_Char **attr); @@ -456,7 +468,7 @@ static void process_operator_specific(const XML_Char **attr) snd_device = platform_get_snd_device_index((char *)attr[1]); if (snd_device < 0) { ALOGE("%s: Device %s in %s not found, no ACDB ID set!", - __func__, (char *)attr[3], PLATFORM_INFO_XML_PATH); + __func__, (char *)attr[3], get_platform_xml_path()); goto done; } @@ -493,7 +505,7 @@ static void process_external_dev(const XML_Char **attr) snd_device = platform_get_snd_device_index((char *)attr[1]); if (snd_device < 0) { ALOGE("%s: Device %s in %s not found, no ACDB ID set!", - __func__, (char *)attr[3], PLATFORM_INFO_XML_PATH); + __func__, (char *)attr[3], get_platform_xml_path()); goto done; } @@ -719,7 +731,7 @@ static void process_snd_device_delay(const XML_Char **attr) snd_device = platform_get_snd_device_index((char *)attr[1]); if (snd_device < 0) { ALOGE("%s: Device %s in %s not found, no ACDB ID set!", - __func__, (char *)attr[3], PLATFORM_INFO_XML_PATH); + __func__, (char *)attr[3], get_platform_xml_path()); goto done; } @@ -816,7 +828,10 @@ done: static void process_microphone_characteristic(const XML_Char **attr) { struct audio_microphone_characteristic_t microphone; uint32_t curIdx = 0; + char platform_info_xml_path[VENDOR_CONFIG_FILE_MAX_LENGTH]; + strlcpy(platform_info_xml_path, get_platform_xml_path(), + sizeof(platform_info_xml_path)); if (strcmp(attr[curIdx++], "valid_mask")) { ALOGE("%s: valid_mask not found", __func__); goto done; @@ -840,7 +855,7 @@ static void process_microphone_characteristic(const XML_Char **attr) { if (!find_enum_by_string(device_in_types, (char*)attr[curIdx++], ARRAY_SIZE(device_in_types), µphone.device)) { ALOGE("%s: type %s in %s not found!", - __func__, attr[--curIdx], PLATFORM_INFO_XML_PATH); + __func__, attr[--curIdx], platform_info_xml_path); goto done; } @@ -869,7 +884,7 @@ static void process_microphone_characteristic(const XML_Char **attr) { if (!find_enum_by_string(mic_locations, (char*)attr[curIdx++], AUDIO_MICROPHONE_LOCATION_CNT, µphone.location)) { ALOGE("%s: location %s in %s not found!", - __func__, attr[--curIdx], PLATFORM_INFO_XML_PATH); + __func__, attr[--curIdx], platform_info_xml_path); goto done; } @@ -892,7 +907,7 @@ static void process_microphone_characteristic(const XML_Char **attr) { if (!find_enum_by_string(mic_directionalities, (char*)attr[curIdx++], AUDIO_MICROPHONE_DIRECTIONALITY_CNT, µphone.directionality)) { ALOGE("%s: directionality %s in %s not found!", - __func__, attr[--curIdx], PLATFORM_INFO_XML_PATH); + __func__, attr[--curIdx], platform_info_xml_path); goto done; } @@ -1059,7 +1074,10 @@ static void process_mic_info(const XML_Char **attr) { uint32_t curIdx = 0; struct mic_info microphone; + char platform_info_xml_path[VENDOR_CONFIG_FILE_MAX_LENGTH]; + strlcpy(platform_info_xml_path, get_platform_xml_path(), + sizeof(platform_info_xml_path)); memset(µphone.channel_mapping, AUDIO_MICROPHONE_CHANNEL_MAPPING_UNUSED, sizeof(microphone.channel_mapping)); @@ -1082,7 +1100,7 @@ static void process_mic_info(const XML_Char **attr) AUDIO_MICROPHONE_CHANNEL_MAPPING_CNT, µphone.channel_mapping[idx++])) { ALOGE("%s: channel_mapping %s in %s not found!", - __func__, attr[--curIdx], PLATFORM_INFO_XML_PATH); + __func__, attr[--curIdx], platform_info_xml_path); goto on_error; } token = strtok_r(NULL, " ", &context); @@ -1581,10 +1599,13 @@ int platform_info_init(const char *filename, void *platform, caller_t caller_typ int bytes_read; void *buf; char platform_info_file_name[MIXER_PATH_MAX_LENGTH]= {0}; + char platform_info_xml_path[VENDOR_CONFIG_FILE_MAX_LENGTH]; + strlcpy(platform_info_xml_path, get_platform_xml_path(), + sizeof(platform_info_xml_path)); pthread_mutex_lock(&parser_lock); if (filename == NULL) - strlcpy(platform_info_file_name, PLATFORM_INFO_XML_PATH, + strlcpy(platform_info_file_name, platform_info_xml_path, MIXER_PATH_MAX_LENGTH); else strlcpy(platform_info_file_name, filename, MIXER_PATH_MAX_LENGTH);