From 1f5a566c59469f75081cd2a21673b588873c9d1d Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Sat, 8 Feb 2025 03:33:38 -0700 Subject: [PATCH] VARA - Enabled sane audio defaults when using VARA --- overlay/opt/emcomm-tools/bin/et-mode | 4 ++-- overlay/opt/emcomm-tools/bin/et-vara-fm | 25 +++++++++++++++++++++---- overlay/opt/emcomm-tools/bin/et-vara-hf | 25 +++++++++++++++++++++---- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-mode b/overlay/opt/emcomm-tools/bin/et-mode index 7fe5581..bf4c8d3 100755 --- a/overlay/opt/emcomm-tools/bin/et-mode +++ b/overlay/opt/emcomm-tools/bin/et-mode @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 6 November 2024 -# Updated : 5 February 2025 +# Updated : 7 February 2025 # Purpose : Configures the system for a specific mode of operation # Use a simple text file to save the state of the last mode selected @@ -223,7 +223,7 @@ if [ $exit_status -eq 0 ]; then start_and_wait_for_vara et-vara-hf et-winlink start-vara-hf & sleep 1 - min http://localhost:8080 + min http://localhost:8080 2>/dev/null ;; *) et-log "Mode ${SELECTED_MODE} not yet supported" diff --git a/overlay/opt/emcomm-tools/bin/et-vara-fm b/overlay/opt/emcomm-tools/bin/et-vara-fm index a0873e0..5d8a737 100755 --- a/overlay/opt/emcomm-tools/bin/et-vara-fm +++ b/overlay/opt/emcomm-tools/bin/et-vara-fm @@ -1,16 +1,14 @@ #!/bin/bash # Author : Gaston Gonzalez # Date : 20 January 2025 -# Updated : 1 February 2025 +# Updated : 7 February 2025 # Purpose : Run VARA FM source /opt/emcomm-tools/bin/et-common EXE="${HOME}/.wine32/drive_c/VARA FM/VARAFM.exe" -if [[ -e ${EXE} ]]; then - wine ~/.wine32/drive_c/VARA\ FM/VARAFM.exe -else +if [[ ! -e ${EXE} ]]; then echo -e "${RED}" echo -e "${EXE} does not exist." echo -e "You might NOT have installed the windows subsystem (WINE)." @@ -19,3 +17,22 @@ else echo -e "${NC}" exit 1 fi + +# 1. Check if the symlink was created by the udev rules +if [[ -e /dev/et-audio ]]; then + + # 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule + APLAY_OUT=$(arecord -l | grep ET_AUDIO) + if [[ $? -eq 0 ]]; then + # Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + else + echo -e "${RED}No ET_AUDIO device detected.${NC}" + exit 1 + fi +else + echo -e "${RED}No ET_AUDIO device plugged in.${NC}" + exit 1 +fi + +wine ~/.wine32/drive_c/VARA\ FM/VARAFM.exe diff --git a/overlay/opt/emcomm-tools/bin/et-vara-hf b/overlay/opt/emcomm-tools/bin/et-vara-hf index acc4032..bf762a3 100755 --- a/overlay/opt/emcomm-tools/bin/et-vara-hf +++ b/overlay/opt/emcomm-tools/bin/et-vara-hf @@ -1,16 +1,14 @@ #!/bin/bash # Author : Gaston Gonzalez # Date : 20 January 2025 -# Updated : 1 February 2025 +# Updated : 7 February 2025 # Purpose : Run VARA HF source /opt/emcomm-tools/bin/et-common EXE="${HOME}/.wine32/drive_c/VARA/VARA.exe" -if [[ -e ${EXE} ]]; then - wine ${EXE} -else +if [[ ! -e ${EXE} ]]; then echo -e "${RED}" echo -e "${EXE} does not exist." echo -e "You might NOT have installed the windows subsystem (WINE)." @@ -19,3 +17,22 @@ else echo -e "${NC}" exit 1 fi + +# 1. Check if the symlink was created by the udev rules +if [[ -e /dev/et-audio ]]; then + + # 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule + APLAY_OUT=$(arecord -l | grep ET_AUDIO) + if [[ $? -eq 0 ]]; then + # Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + else + echo -e "${RED}No ET_AUDIO device detected.${NC}" + exit 1 + fi +else + echo -e "${RED}No ET_AUDIO device plugged in.${NC}" + exit 1 +fi + +wine ${EXE}