Implement 0010 RPM/L2/WCD/UART deep-standby, Adreno 304 ICC/SMMU fixes, and C11 autostart daemons
- patches/kernel/0010-msm8909-rpm-lpm-bimc-wcd-ldo-uart.patch and device DTS/DTB files (nokia-{argon,beatles,beatles-cover,coconut,sparkler,leo}): vMPM APSS RPM sleep, L2 SAW2 collapse, WCD-digital runtime PM, PM8909 LDO seeding, ttyMSM0 disable, dynamic msm_gpu gfx-mem BIMC interconnect scaling (mas_oxili), and qcom_iommu context restore + atomic TLB flush on resume.
- Replace Python/shell autostart loops with compiled C11 ARM ELF daemons (bananarchy-dsds, bananarchy-modemmonitor, bananarchy-soundmonitor, bananarchy-notifmonitor, bananarchy-run-aligned, bananarchy-session-loop) plus scripts/test-dsds-daemon.py.
- Update scripts/check-rebuild.sh, CHANGELOG.md, BATTERY-OPTIMIZATION-ANALYSIS.md, MANUAL.md, README.md, and AGENTS.md with verified a1114 (carbonara) image/archive pins and guards.
This commit is contained in:
1 parent
96c66bf0c6
commit
2ae4ef34a2
86 files changed
+99754
-94563
No files matched your search
@@ -1,182 +1,2 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
|
||||
# include common definitions
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
# see networkmanager documentation for these state names
|
||||
statenumtoname() {
|
||||
case "$1" in
|
||||
"int32 -1") printf "failed" ;;
|
||||
"int32 0") printf "unknown" ;;
|
||||
"int32 1") printf "initializing" ;;
|
||||
"int32 2") printf "locked" ;;
|
||||
"int32 3") printf "disabled" ;;
|
||||
"int32 4") printf "disabling" ;;
|
||||
"int32 5") printf "enabling" ;;
|
||||
"int32 6") printf "enabled" ;;
|
||||
"int32 7") printf "searching" ;;
|
||||
"int32 8") printf "registered" ;;
|
||||
"int32 9") printf "disconnecting" ;;
|
||||
"int32 10") printf "connecting" ;;
|
||||
"int32 11") printf "connected" ;;
|
||||
*) printf "ERROR" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
mainloop() {
|
||||
# get initial modem state and handle SIM2/QMI PIN lock or unprovisioned slot
|
||||
(
|
||||
tries=0
|
||||
newstate=""
|
||||
while [ "$tries" -lt 15 ]; do
|
||||
newstate="$(mmcli -m any -K 2>/dev/null | grep "^modem.generic.state " | cut -d':' -f2 | sed 's/^ //')"
|
||||
if [ -n "$newstate" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
|
||||
uim_st="$(doas -n /usr/libexec/msm-modem-uim-selection status 2>/dev/null || /usr/libexec/msm-modem-uim-selection status 2>/dev/null || true)"
|
||||
if printf "%s\n" "$uim_st" | grep -qE "SLOT[12]_PIN1_STATE=(enabled-not-verified|blocked)|SLOT[12]_APP_STATE=(pin1|puk1)"; then
|
||||
newstate="locked"
|
||||
elif [ "$newstate" = "locked" ] && printf "%s\n" "$uim_st" | grep -q "^MODEM_AVAILABLE=1$"; then
|
||||
newstate="$(mmcli -m any -K 2>/dev/null | grep "^modem.generic.state " | cut -d':' -f2 | sed 's/^ //')"
|
||||
if [ "$newstate" = "locked" ]; then
|
||||
newstate="disabled"
|
||||
fi
|
||||
elif printf "%s\n" "$uim_st" | grep -qE "SLOT[12]_STATE=present" && printf "%s\n" "$uim_st" | grep -q "^PRIMARY_GW_SLOT=0$"; then
|
||||
doas -n /usr/libexec/msm-modem-uim-selection boot >/dev/null 2>&1 || true
|
||||
newstate="$(mmcli -m any -K 2>/dev/null | grep "^modem.generic.state " | cut -d':' -f2 | sed 's/^ //')"
|
||||
elif printf "%s\n" "$uim_st" | grep -q "^SLOT1_STATE=present$" && printf "%s\n" "$uim_st" | grep -q "^SLOT2_STATE=present$" && printf "%s\n" "$uim_st" | grep -q "^SECONDARY_GW_SLOT=0$"; then
|
||||
doas -n /usr/libexec/msm-modem-uim-selection boot >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
if [ -n "$newstate" ]; then
|
||||
# fake oldstate (boot) and reason (0)
|
||||
sxmo_hook_modem.sh "boot" "$newstate" "0"
|
||||
sxmo_hook_statusbar.sh modem
|
||||
fi
|
||||
) &
|
||||
|
||||
# Monitor Secondary GW SIM calls and SMS in Dual-SIM Dual Standby (DSDS)
|
||||
(
|
||||
sleep 4
|
||||
if [ ! -f /tmp/sxmo_dsds_active ]; then
|
||||
doas -n /usr/libexec/msm-modem-uim-selection status >/dev/null 2>&1 || /usr/libexec/msm-modem-uim-selection status >/dev/null 2>&1 || true
|
||||
fi
|
||||
while : ; do
|
||||
if [ "$(cat /tmp/sxmo_dsds_active 2>/dev/null || echo 0)" = "1" ]; then
|
||||
if command -v doas >/dev/null 2>&1; then
|
||||
doas -n /usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true
|
||||
else
|
||||
/usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true
|
||||
fi
|
||||
sleep 30
|
||||
else
|
||||
sleep 600
|
||||
fi
|
||||
done
|
||||
) &
|
||||
|
||||
# Monitor ModemManager signals using a single dbus-monitor connection
|
||||
dbus-monitor --system \
|
||||
"interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" \
|
||||
"interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" \
|
||||
"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Sms'" \
|
||||
"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" \
|
||||
"interface='org.freedesktop.ModemManager1.Modem',type='signal',member='StateChanged'" \
|
||||
"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd'" |
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
signal*"interface=org.freedesktop.ModemManager1.Modem.Voice"*"member=CallAdded"*)
|
||||
( sxmo_modem.sh checkforincomingcalls & )
|
||||
;;
|
||||
signal*"interface=org.freedesktop.ModemManager1.Modem.Messaging"*"member=Added"*)
|
||||
( sxmo_modem.sh checkfornewtexts & )
|
||||
;;
|
||||
signal*"path=/org/freedesktop/ModemManager1/SMS/"*"member=PropertiesChanged"*)
|
||||
( sxmo_modem.sh checkfornewtexts & )
|
||||
;;
|
||||
signal*"path=/org/freedesktop/ModemManager1/Call/"*"member=PropertiesChanged"*)
|
||||
( sxmo_modem.sh checkforfinishedcalls & )
|
||||
;;
|
||||
signal*"interface=org.freedesktop.ModemManager1.Modem;"*"member=StateChanged"*)
|
||||
read -r oldstate || true
|
||||
read -r newstate || true
|
||||
read -r reason || true
|
||||
(
|
||||
(
|
||||
sxmo_hook_modem.sh "$(statenumtoname "$oldstate")" \
|
||||
"$(statenumtoname "$newstate")" \
|
||||
"$(echo "$reason" | sed 's/uint32 //')"
|
||||
sxmo_hook_statusbar.sh modem
|
||||
) &
|
||||
)
|
||||
;;
|
||||
signal*"path=/org/freedesktop/ModemManager1/Modem/"*"member=PropertiesChanged"*)
|
||||
MODEM="$(echo "$line" | awk -F'[;=]' '{print $6}')"
|
||||
;;
|
||||
*"string \"NetworkNotification\""*)
|
||||
[ -n "${MODEM:-}" ] && ( sxmo_ussd.sh "$MODEM" "NetworkNotification" "" & )
|
||||
;;
|
||||
*"string \"NetworkRequest\""*)
|
||||
[ -n "${MODEM:-}" ] && ( sxmo_ussd.sh "$MODEM" "NetworkRequest" "" & )
|
||||
;;
|
||||
esac
|
||||
done &
|
||||
|
||||
if [ -f "${SXMO_MMS_BASE_DIR:-"$HOME"/.mms/modemmanager}/mms" ]; then
|
||||
# monitor for received mms
|
||||
dbus-monitor "interface='org.ofono.mms.Service',type='signal',member='MessageAdded'" |
|
||||
while read -r line; do
|
||||
if echo "$line" | grep -q '^object path'; then
|
||||
MESSAGE_PATH="$(echo "$line" | cut -d\" -f2)"
|
||||
fi
|
||||
if echo "$line" | grep -q 'string "received"'; then
|
||||
sxmo_mms.sh processmms "$MESSAGE_PATH"
|
||||
fi
|
||||
done &
|
||||
fi
|
||||
|
||||
if [ -f "${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}/vvm" ]; then
|
||||
# monitor for vvm (Visual Voice Mail)
|
||||
VVM_START=0
|
||||
dbus-monitor "interface='org.kop316.vvm.Service',type='signal',member='MessageAdded'" |
|
||||
while read -r line; do
|
||||
if echo "$line" | grep -q '^object path'; then
|
||||
VVM_ID="$(echo "$line" | cut -d\" -f2 | rev | cut -d'/' -f1 | rev)"
|
||||
VVM_START=1
|
||||
fi
|
||||
|
||||
if echo "$line" | grep -q '^]'; then
|
||||
VVM_START=0
|
||||
sxmo_vvm.sh processvvm "$VVM_DATE" "$VVM_SENDER" "$VVM_ID" "$VVM_ATTACHMENT"
|
||||
fi
|
||||
|
||||
if [ "$VVM_START" -eq 1 ]; then
|
||||
if echo "$line" | grep -q '^string "Date"'; then
|
||||
read -r line
|
||||
VVM_DATE="$(echo "$line" | cut -d\" -f2)"
|
||||
elif echo "$line" | grep -q '^string "Sender"'; then
|
||||
read -r line
|
||||
VVM_SENDER="$(echo "$line" | cut -d\" -f2)"
|
||||
elif echo "$line" | grep -q '^string "Attachments"'; then
|
||||
read -r line
|
||||
VVM_ATTACHMENT="$(echo "$line" | cut -d\" -f2)"
|
||||
fi
|
||||
fi
|
||||
done &
|
||||
fi
|
||||
|
||||
wait
|
||||
}
|
||||
|
||||
# new session, clean up all phone related files
|
||||
rm "$XDG_RUNTIME_DIR/sxmo_calls/"* 2>/dev/null || true
|
||||
rm -f "$XDG_RUNTIME_DIR"/sxmo.ring.pid 2>/dev/null
|
||||
rm -f "$SXMO_NOTIFDIR"/incomingcall* 2>/dev/null
|
||||
mainloop
|
||||
exec /usr/bin/bananarchy-modemmonitor "$@"
|
||||
Reference in new issue
Block a user