~mil/sxmo-devel

sxmo-utils: fix conflicting audio settings (#502) v1 SUPERSEDED

ArenM: 1
 fix conflicting audio settings (#502)

 1 files changed, 14 insertions(+), 28 deletions(-)
#751363 .build.yml success
Nevermind, I misread your comment... this seems good, but why is there a 
'TODO'...

--
sic dicit magister P
https://phartman.sites.luc.edu/
GPG keyID 0xE0DBD3D6 (CAE6 3A6F 755F 7BC3 36CA  330D B3E6 39C6 E0DB D3D6)
The todo is about having callaudiocli report errors it encounters,
rather than us needing to check its work. Sorry the comment wasn't very
descriptive, I need to get better about that.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/sxmo-devel/patches/31955/mbox | git am -3
Learn more about email & git

[PATCH sxmo-utils] fix conflicting audio settings (#502) Export this patch

When callaudiod disables call audio mode it always enables the mic.
Because we were disabling the mic before disabling call audio mode
reset_audio always fails.

I also removed the retry loop; if the software we rely on breaks we
should fix it upstream, rather than hitting it with a hammer until it
works.
This should fix https://todo.sr.ht/~mil/sxmo-tickets/502
---
 scripts/modem/sxmo_modemaudio.sh | 42 +++++++++++---------------------
 1 file changed, 14 insertions(+), 28 deletions(-)

diff --git a/scripts/modem/sxmo_modemaudio.sh b/scripts/modem/sxmo_modemaudio.sh
index 1bdfedc..8e02ad8 100644
--- a/scripts/modem/sxmo_modemaudio.sh
+++ b/scripts/modem/sxmo_modemaudio.sh
@@ -3,44 +3,30 @@
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh

set -e

setup_audio() {
	unmute_mic
	enable_call_audio_mode
	disable_speaker
	unmute_mic

	i=0
	while (! is_unmuted_mic) || (! is_call_audio_mode) || (! is_disabled_speaker); do
		i=$((i+1))
		if [ "$i" -gt 5 ]; then
			return 1
		fi

		sleep 0.2

		unmute_mic
		enable_call_audio_mode
		disable_speaker
	done
	# TODO: callaudiocli should error if it doesn't set these
	# Since we set -e this script will error if these aren't true
	is_call_audio_mode
	is_disabled_speaker
	is_unmuted_mic
}

reset_audio() {
	mute_mic
	disable_call_audio_mode
	enable_speaker
	mute_mic

	i=0
	while (! is_muted_mic) || (! is_default_audio_mode) || (! is_enabled_speaker); do
		i=$((i+1))
		if [ "$i" -gt 5 ]; then
			return 1
		fi

		sleep 0.2

		mute_mic
		disable_call_audio_mode
		enable_speaker
	done
	# TODO: callaudiocli should error if it doesn't set these
	# Since we set -e this script will error if these aren't true
	is_default_audio_mode
	is_enabled_speaker
	is_muted_mic
}

is_muted_mic() {
-- 
2.36.0

sxmo-utils/patches/.build.yml: SUCCESS in 24s

[fix conflicting audio settings (#502)][0] from [ArenM][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/31955
[1]: mailto:aren@peacevolution.org

✓ #751363 SUCCESS sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/751363
Thanks! Comments below:

On Thu, May 05, 2022 at 12:06:01AM -0400, ArenM wrote: