~mil/sxmo-devel

sxmo-utils: fix conflicting audio settings (#502) v2 APPLIED

Peter John Hartman: 1
 fix conflicting audio settings (#502)

 1 files changed, 11 insertions(+), 10 deletions(-)
#791189 .build.yml success
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/33403/mbox | git am -3
Learn more about email & git

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

From: ArenM <aren@peacevolution.org>

I agree with the spirit, but I think the retry loops are needed. I added 
some log output so we can track it for now.  I still wasn't sure about 
the moving of unmute mic from beginning to end, so I wanted to send this 
to the list before I apply it.

(Original Comment:
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
End Original Comment)

Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
---
 scripts/modem/sxmo_modemaudio.sh | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/scripts/modem/sxmo_modemaudio.sh b/scripts/modem/sxmo_modemaudio.sh
index 1bdfedc..26ab341 100644
--- a/scripts/modem/sxmo_modemaudio.sh
+++ b/scripts/modem/sxmo_modemaudio.sh
@@ -4,9 +4,9 @@
. sxmo_common.sh

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
@@ -17,17 +17,18 @@ setup_audio() {

		sleep 0.2

		unmute_mic
		enable_call_audio_mode
		disable_speaker
		umute_mic
	done
}

reset_audio() {
	mute_mic
	disable_call_audio_mode
	enable_speaker
	mute_mic

	# eventually we should remove this loop once upstream is stable
	i=0
	while (! is_muted_mic) || (! is_default_audio_mode) || (! is_enabled_speaker); do
		i=$((i+1))
@@ -37,9 +38,9 @@ reset_audio() {

		sleep 0.2

		mute_mic
		disable_call_audio_mode
		enable_speaker
		mute_mic
	done
}

@@ -52,11 +53,11 @@ is_unmuted_mic() {
}

mute_mic() {
	callaudiocli -u 1
	callaudiocli -u 1 || sxmo_log "ERR: callaudiocli -u 1 failed"
}

unmute_mic() {
	callaudiocli -u 0
	callaudiocli -u 0 || sxmo_log "ERR: callaudiocli -u 0 failed"
}

is_call_audio_mode() {
@@ -68,11 +69,11 @@ is_default_audio_mode() {
}

enable_call_audio_mode() {
	callaudiocli -m 1
	callaudiocli -m 1 || sxmo_log "ERR: callaudiocl -m 1 failed"
}

disable_call_audio_mode() {
	callaudiocli -m 0
	callaudiocli -m 0 || sxmo_log "ERR: callaudiocli -m 0 failed"
}

is_enabled_speaker() {
@@ -84,11 +85,11 @@ is_disabled_speaker() {
}

enable_speaker() {
	callaudiocli -s 1
	callaudiocli -s 1 || sxmo_log "ERR: callaudiocli -s 1 failed"
}

disable_speaker() {
	callaudiocli -s 0
	callaudiocli -s 0 || sxmo_log "ERR: callaudiocli -s 0 failed"
}

"$@"
-- 
2.36.1
sxmo-utils/patches/.build.yml: SUCCESS in 32s

[fix conflicting audio settings (#502)][0] v2 from [Peter John Hartman][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/33403
[1]: mailto:peterjohnhartman@gmail.com

✓ #791189 SUCCESS sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/791189
Thanks for the investigations and thanks Peter for cleaned it up ! It
seems to works as expected now

Applied now !

To git.sr.ht:~mil/sxmo-utils
   99a3e17a..9f5346f0  9f5346f0 -> master