Fix SIM2 QMI UIM provisioning, auto-enable ModemManager, PIN auto-prompt, call audio, and Dunst clearing
This commit is contained in:
@@ -3,61 +3,42 @@
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
ca_dbus_get_prop() {
|
||||
dbus-send --session --print-reply --dest=org.mobian_project.CallAudio \
|
||||
--reply-timeout=2500 /org/mobian_project/CallAudio org.freedesktop.DBus.Properties.Get \
|
||||
string:org.mobian_project.CallAudio string:"$1"
|
||||
}
|
||||
|
||||
ca_dbus_set_prop() {
|
||||
dbus-send --session --print-reply --type=method_call \
|
||||
--reply-timeout=2500 --dest=org.mobian_project.CallAudio \
|
||||
/org/mobian_project/CallAudio org.mobian_project.CallAudio."$1" "$2" |\
|
||||
grep -q "boolean true" && return 0 || return 1
|
||||
}
|
||||
|
||||
enable_call_audio_mode() {
|
||||
if pactl -f json info 2>/dev/null | jq -r .server_name | grep -q PipeWire; then
|
||||
sxmo_audio.sh device set Earpiece
|
||||
sxmo_log "Successfully enabled call audio mode (Earpiece)."
|
||||
sxmo_hook_statusbar.sh volume
|
||||
return 0
|
||||
fi
|
||||
if ca_dbus_set_prop SelectMode uint32:1; then
|
||||
sxmo_log "Successfully enabled call audio mode."
|
||||
sxmo_hook_statusbar.sh volume
|
||||
else
|
||||
sxmo_notify_user.sh "Failed to enable call audio mode."
|
||||
return 1
|
||||
fi
|
||||
if command -v amixer >/dev/null 2>&1; then
|
||||
amixer -c 0 sset 'PRI_MI2S_RX Voice Mixer VoiceMMode1' on >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'VoiceMMode1 Capture Mixer TERT_MI2S_TX' on >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'RX1 MIX1 INP1' 'RX1' >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'RDAC2 MUX' 'RX1' >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'EAR_S' 'Switch' >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'DEC1 MUX' 'ADC1' >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'ADC1 Volume' 100% >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'RX1 Digital Volume' 84 >/dev/null 2>&1 || true
|
||||
fi
|
||||
sxmo_audio.sh device set Earpiece >/dev/null 2>&1 || true
|
||||
sxmo_log "Enabled ALSA voice call audio mode (Earpiece)."
|
||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||
return 0
|
||||
}
|
||||
|
||||
disable_call_audio_mode() {
|
||||
if pactl -f json info 2>/dev/null | jq -r .server_name | grep -q PipeWire; then
|
||||
sxmo_audio.sh device set Speaker
|
||||
sxmo_log "Successfully disabled call audio mode (Speaker)."
|
||||
sxmo_hook_statusbar.sh volume
|
||||
return 0
|
||||
fi
|
||||
if ca_dbus_set_prop SelectMode uint32:0; then
|
||||
sxmo_log "Successfully disabled call audio mode."
|
||||
sxmo_hook_statusbar.sh volume
|
||||
else
|
||||
sxmo_notify_user.sh "Failed to disable call audio mode."
|
||||
return 1
|
||||
fi
|
||||
if command -v amixer >/dev/null 2>&1; then
|
||||
amixer -c 0 sset 'PRI_MI2S_RX Voice Mixer VoiceMMode1' off >/dev/null 2>&1 || true
|
||||
amixer -c 0 sset 'VoiceMMode1 Capture Mixer TERT_MI2S_TX' off >/dev/null 2>&1 || true
|
||||
fi
|
||||
sxmo_audio.sh device set Speaker >/dev/null 2>&1 || true
|
||||
sxmo_log "Disabled ALSA voice call audio mode (Speaker)."
|
||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||
return 0
|
||||
}
|
||||
|
||||
setup_audio() {
|
||||
if ! enable_call_audio_mode; then
|
||||
return 1
|
||||
fi
|
||||
enable_call_audio_mode
|
||||
return 0
|
||||
}
|
||||
|
||||
reset_audio() {
|
||||
if ! disable_call_audio_mode; then
|
||||
return 1
|
||||
fi
|
||||
disable_call_audio_mode
|
||||
return 0
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
||||
Reference in New Issue
Block a user