From 3e95c41c0d3056c7949e698e6cf679eda23ca8aa Mon Sep 17 00:00:00 2001 From: Nick Anstee Date: Thu, 9 May 2024 19:00:34 +0200 Subject: [PATCH 1/3] Update uart_log.sh Pick the serial device by ID, allowing us to safely predict the paths to find the left and right bud at Also improve the script so it asks which bud we'd like to debug Specify necessary minicom options, so it opens even if the default configuration is invalid --- uart_log.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/uart_log.sh b/uart_log.sh index 4edec55..3ae39c7 100755 --- a/uart_log.sh +++ b/uart_log.sh @@ -1,5 +1,11 @@ #!/usr/bin/env sh -num=$(find /dev -name 'ttyUSB*' | rev | cut -c 1) -echo "$num" -sudo minicom "port$num" +rightbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if00 +leftbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if02 + +read -p "Which bud do you want to connect to UART for? L/R (default L): " -n 1 -r +ttydev=$leftbud +if [[ $REPLY =~ ^[Rr]$ ]]; then + ttydev=$rightbud +fi +sudo minicom -D $ttydev -b 2000000 From 839d5133671dbc9ddcb323731a9df387e0cb0346 Mon Sep 17 00:00:00 2001 From: nicka101 Date: Fri, 10 May 2024 02:10:31 +0200 Subject: [PATCH 2/3] Enable LDAC in the build Permit LDAC to be enabled independenly of LHDC Fix a bug/oversight in bt_sbc_player which caused system frequencies above 52M to be ignored --- config/open_source/target.mk | 4 +++- services/bt_app/app_bt_stream.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/open_source/target.mk b/config/open_source/target.mk index af9ed80..ec1f5ae 100644 --- a/config/open_source/target.mk +++ b/config/open_source/target.mk @@ -228,7 +228,7 @@ A2DP_LHDC_LARC ?= 1 export FLASH_UNIQUE_ID ?= 1 endif -A2DP_LDAC_ON ?= 0 +A2DP_LDAC_ON ?= 1 export TX_RX_PCM_MASK ?= 0 @@ -343,6 +343,8 @@ export BT_EXT_PA ?=0 ifeq ($(A2DP_LHDC_ON),1) AUDIO_BUFFER_SIZE := 140*1024 +else ifeq ($(A2DP_LDAC_ON),1) +AUDIO_BUFFER_SIZE := 140*1024 else AUDIO_BUFFER_SIZE := 100*1024 endif diff --git a/services/bt_app/app_bt_stream.cpp b/services/bt_app/app_bt_stream.cpp index 45a30bb..27aa4c8 100644 --- a/services/bt_app/app_bt_stream.cpp +++ b/services/bt_app/app_bt_stream.cpp @@ -3866,7 +3866,9 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq) { } #endif #endif - freq = APP_SYSFREQ_52M; + if (freq < APP_SYSFREQ_52M) { + freq = APP_SYSFREQ_52M; + } app_sysfreq_req(APP_SYSFREQ_USER_BT_A2DP, freq); TRACE_AUD_STREAM_I("[A2DP_PLAYER] sysfreq %d", freq); TRACE_AUD_STREAM_I("[A2DP_PLAYER] sysfreq calc : %d\n", @@ -3886,8 +3888,10 @@ int bt_sbc_player(enum PLAYER_OPER_T on, enum APP_SYSFREQ_FREQ_T freq) { else if (codec_type == BTIF_AVDTP_CODEC_TYPE_NON_A2DP) { TRACE(1, "current_a2dp_non_type %d", current_a2dp_non_type); + if (0) { + } #if defined(A2DP_LHDC_ON) - if (current_a2dp_non_type == A2DP_NON_CODEC_TYPE_LHDC) { + else if (current_a2dp_non_type == A2DP_NON_CODEC_TYPE_LHDC) { app_overlay_select(APP_OVERLAY_A2DP_LHDC); } #endif From b61712a01cca1dd99981985d60ec107183c99722 Mon Sep 17 00:00:00 2001 From: Nick Anstee Date: Fri, 10 May 2024 18:05:30 +0200 Subject: [PATCH 3/3] Functional UART logging both inside and outside dev container Adds minicom and sudo to the docker image Switches the shebang line to bash to fix a bug in uart_log.sh when inside the container (-n option to read requires bash) --- Dockerfile | 5 +++++ uart_log.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 50beb99..32b8684 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,6 +41,11 @@ RUN apt-get update \ && curl \ https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-$(arch)-linux.tar.bz2 | tar -xj -C /src/ +RUN apt-get update \ + && apt-get install -y \ + minicom \ + sudo + ENV PATH="${PATH}:/src/gcc-arm-none-eabi-9-2019-q4-major/bin" COPY --from=rust_build /usr/src/bestool/bestool/target/release/bestool /usr/local/bin/bestool COPY . /usr/src diff --git a/uart_log.sh b/uart_log.sh index 3ae39c7..72f71c7 100755 --- a/uart_log.sh +++ b/uart_log.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash rightbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if00 leftbud=/dev/serial/by-id/usb-wch.cn_USB_Dual_Serial_0123456789-if02