From 88fd621c6c0b923dfcefb277abe7c9f4a5922b81 Mon Sep 17 00:00:00 2001 From: Giovanni Fulco Date: Fri, 7 Jul 2023 18:32:06 +0200 Subject: [PATCH] [Bugfix] Handle card index properly #2 --- README.md | 1 + bin/entrypoint.sh | 5 ++++- configure.sh | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a08005b..7e9eee7 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ An already started tidal-connect container should start working immediately, at Date|Comment :---|:--- +2023-07-07|Fixed asound.conf generation from card index, see issue ([#2](https://github.com/GioF71/tidal-connect/issues/2)) 2023-06-02|First unfolding seems to be working 2023-06-02|Some effort to avoid resampling 2023-06-02|MQA passthrough defaults to `false` diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 581935d..69d393c 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -45,7 +45,10 @@ if [[ "${card_index}" == "-1" && -n "${card_name}" ]]; then fi fi done -elif [[ -z "${card_index}" ]]; then +elif [[ -n "${card_index}" ]]; then + echo "Set card_index=[$card_index]" + write_audio_config $card_index +else echo "Set default card_index=[$DEFAULT_CARD_INDEX]" write_audio_config $DEFAULT_CARD_INDEX fi diff --git a/configure.sh b/configure.sh index 622dc77..bd28d02 100755 --- a/configure.sh +++ b/configure.sh @@ -1,5 +1,8 @@ #!/bin/bash +# error codes +# 1 cannot specify both index and name + set -ex ENV_FILE=.env @@ -18,6 +21,11 @@ do esac done +if [[ -n "${card_index}" && -n "${card_name}" ]]; then + echo "Cannot specify both index and name for audio card" + exit 1 +fi + echo "card_index=[$card_index]" echo "card_name=[$card_name]" @@ -53,4 +61,5 @@ if [[ -n "${card_name}" ]]; then echo "CARD_NAME=${card_name}" >> $ENV_FILE elif [[ -n "${card_index}" ]]; then echo "CARD_INDEX=${card_index}" >> $ENV_FILE + echo "CARD_NAME=NOT_SET" >> $ENV_FILE fi