diff options
author | Deeraj Soman <sdeeraj@codeaurora.org> | 2019-04-25 15:54:49 +0530 |
---|---|---|
committer | Deeraj Soman <sdeeraj@codeaurora.org> | 2019-05-21 12:23:25 +0530 |
commit | 8494bb52fe66624bc65d70e57f62203bbf3706fd (patch) | |
tree | 5a198047fb7ee8fffdc2f1d8a5b2e4bf74eb9241 /qahw_api | |
parent | 1d4f132f20dfbcf72b9dc3da0102286700854f0a (diff) | |
download | android_hardware_qcom_audio-8494bb52fe66624bc65d70e57f62203bbf3706fd.tar.gz android_hardware_qcom_audio-8494bb52fe66624bc65d70e57f62203bbf3706fd.tar.bz2 android_hardware_qcom_audio-8494bb52fe66624bc65d70e57f62203bbf3706fd.zip |
qahw_api: Add support for RX and TX with BT SCO device
Add support for playback and capture with BT SCO device
Change-Id: Ie09bc3d2248bcca02f1dc95d2ff34aa7d35c409a
Diffstat (limited to 'qahw_api')
-rw-r--r-- | qahw_api/test/qahw_multi_record_test.c | 24 | ||||
-rw-r--r-- | qahw_api/test/qahw_playback_test.c | 30 | ||||
-rw-r--r-- | qahw_api/test/qahw_playback_test.h | 3 |
3 files changed, 49 insertions, 8 deletions
diff --git a/qahw_api/test/qahw_multi_record_test.c b/qahw_api/test/qahw_multi_record_test.c index c3455098..eccfe766 100644 --- a/qahw_api/test/qahw_multi_record_test.c +++ b/qahw_api/test/qahw_multi_record_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2015 The Android Open Source Project * @@ -77,6 +77,7 @@ struct audio_config_params { char kvpairs[256]; bool timestamp_mode; char timestamp_file_in[256]; + bool bt_wbs; }; struct timed_params { @@ -260,7 +261,7 @@ void *start_input(void *thread_param) double time_elapsed = 0; ssize_t bytes_read = -1; char param[100] = "audio_stream_profile="; - char file_name[256] = "/data/rec"; + char file_name[256] = "/data/audio/rec"; int data_sz = 0, name_len = strlen(file_name); qahw_in_buffer_t in_buf; static int64_t timestamp = 1; @@ -347,6 +348,12 @@ void *start_input(void *thread_param) strlcat(param, params->profile, sizeof(param)); qahw_in_set_parameters(in_handle, param); + if (audio_is_bluetooth_sco_device(params->input_device)) { + char param1[50]; + snprintf(param1, sizeof(param1), "bt_wbs=%s", ((params->bt_wbs == 1) ? "on" : "off")); + qahw_set_parameters(qahw_mod_handle, param1); + } + /* Caution: Below ADL log shouldnt be altered without notifying automation APT since it used for * automation testing */ @@ -548,6 +555,11 @@ int read_config_params_from_user(struct audio_config_params *thread_param) { scanf(" %d", &thread_param->input_device); thread_param->input_device |= AUDIO_DEVICE_BIT_IN; + if (thread_param->input_device == AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) { + printf(" \n Enable wbs for BT sco?? (1 - Enable 0 - Disable) ::::: "); + scanf("%d", &thread_param->bt_wbs); + } + printf(" \n Enter the format (1 ->16 bit pcm recording, 6 -> 24 bit packed pcm recording) ::::: "); scanf(" %d", &thread_param->config.format); @@ -587,6 +599,7 @@ void fill_default_params(struct audio_config_params *thread_param, int rec_sessi thread_param->record_length = 8 /*sec*/; thread_param->record_delay = 0 /*sec*/; thread_param->timestamp_mode = false; + thread_param->bt_wbs = false; thread_param->handle = 0x99A - rec_session; } @@ -613,6 +626,7 @@ void usage() { printf(" All other flags passed would be ignore if this flag is used\n\n"); printf(" -S --source-tracking - Use this flag to show capture source tracking params for recordings\n\n"); printf(" -k --kvpairs - kvpairs to be set globally\n"); + printf(" -z --bt-wbs - set bt_wbs param\n"); printf(" -h --help - Show this help\n\n"); printf(" \n Examples \n"); printf(" hal_rec_test -> start a recording stream with default configurations\n\n"); @@ -670,6 +684,7 @@ int main(int argc, char* argv[]) { {"source-tracking", no_argument, 0, 'S'}, {"kvpairs", required_argument, 0, 'k'}, {"help", no_argument, 0, 'h'}, + {"bt-wbs", no_argument, 0, 'z'}, {0, 0, 0, 0} }; @@ -677,7 +692,7 @@ int main(int argc, char* argv[]) { int option_index = 0; while ((opt = getopt_long(argc, argv, - "-d:f:F:r:c:s:p:t:D:l:m:k:KiSh", + "-d:f:F:r:c:s:p:t:D:l:m:k:KiShz", long_options, &option_index)) != -1) { switch (opt) { @@ -727,6 +742,9 @@ int main(int argc, char* argv[]) { case 'k': snprintf(params[0].kvpairs, sizeof(params[0].kvpairs), "%s", optarg); break; + case 'z': + params[0].bt_wbs = true; + break; case 'h': usage(); return 0; diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c index 803242e4..9f1489ca 100644 --- a/qahw_api/test/qahw_playback_test.c +++ b/qahw_api/test/qahw_playback_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2015 The Android Open Source Project * @@ -648,6 +648,14 @@ void *start_stream_playback (void* stream_data) fprintf(log_file, "stream %d: open output stream is success, out_handle %p\n", params->stream_index, params->out_handle); + if (audio_is_bluetooth_sco_device(params->output_device)) { + char param1[50]; + int ret = -1; + snprintf(param1, sizeof(param1), "bt_wbs=%s", ((params->bt_wbs == 1) ? "on" : "off")); + ret = qahw_set_parameters(params->qahw_out_hal_handle, param1); + fprintf(log_file, " param %s set to hal with return value %d\n", param1, ret); + } + if (kpi_mode == true) { measure_kpi_values(params->out_handle, params->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD); rc = qahw_close_output_stream(params->out_handle); @@ -1573,6 +1581,7 @@ void usage() { printf(" -A --bt-addr <bt device addr> - Required to set bt device adress for aptx decoder\n\n"); printf(" -q --drift query - Required for querying avtime vs hdmi drift\n"); printf(" -Q --drift query and correction - Enable Drift query and correction\n"); + printf(" -z --bt-wbs - Set bt_wbs param\n\n"); printf(" -P - Argument to do multi-stream playback, currently 2 streams are supported to run concurrently\n"); printf(" Put -P and mention required attributes for the next stream\n"); printf(" 0:bassboost 1:virtualizer 2:equalizer 3:visualizer(NA) 4:reverb 5:audiosphere others:null"); @@ -2103,6 +2112,7 @@ int main(int argc, char* argv[]) { {"device-config", required_argument, 0, 'C'}, {"play-list", required_argument, 0, 'g'}, {"help", no_argument, 0, 'h'}, + {"bt-wbs", no_argument, 0, 'z'}, {0, 0, 0, 0} }; @@ -2125,7 +2135,7 @@ int main(int argc, char* argv[]) { while ((opt = getopt_long(argc, argv, - "-f:r:c:b:d:s:v:V:l:t:a:w:k:PD:KF:Ee:A:u:m:S:C:p::x:y:qQh:i:h:g:O:", + "-f:r:c:b:d:s:v:V:l:t:a:w:k:PD:KF:Ee:A:u:m:S:C:p::x:y:qQzh:i:h:g:O:", long_options, &option_index)) != -1) { @@ -2158,6 +2168,9 @@ int main(int argc, char* argv[]) { case 'V': enable_dump = atof(optarg); break; + case 'z': + stream_param[i].bt_wbs = true; + break; case 'l': log_filename = optarg; if (strcasecmp(log_filename, "stdout") && @@ -2498,10 +2511,19 @@ int main(int argc, char* argv[]) { } } - if (stream->output_device != AUDIO_DEVICE_NONE) - if ((stream->qahw_out_hal_handle = load_hal(stream->output_device)) <= 0) + if (stream->output_device != AUDIO_DEVICE_NONE) { + if ((stream->qahw_out_hal_handle = load_hal(stream->output_device)) <= 0) goto exit; + /* Turn BT_SCO on if bt_sco recording */ + if(audio_is_bluetooth_sco_device(stream->output_device)) { + int ret = -1; + const char * bt_sco_on = "BT_SCO=on"; + ret = qahw_set_parameters(stream->qahw_out_hal_handle, bt_sco_on); + fprintf(log_file, " param %s set to hal with return value %d\n", bt_sco_on, ret); + } + } + if (stream->input_device != AUDIO_DEVICE_NONE) if ((stream->qahw_in_hal_handle = load_hal(stream->input_device))== 0) goto exit; diff --git a/qahw_api/test/qahw_playback_test.h b/qahw_api/test/qahw_playback_test.h index 0ac51dfa..6f333388 100644 --- a/qahw_api/test/qahw_playback_test.h +++ b/qahw_api/test/qahw_playback_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017,2019, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2015 The Android Open Source Project * @@ -145,6 +145,7 @@ typedef struct { pthread_mutex_t input_buffer_available_lock; uint32_t input_buffer_available_size; char *set_params; + bool bt_wbs; }stream_config; qahw_module_handle_t * load_hal(audio_devices_t dev); |