Optimize battery life across DTB pinctrl, schedutil, SDHCI, and background daemons

This commit is contained in:
Luxferre committed 2026-10-30 19:28:07 +02:00
1 parent 9c28fa1e4c
commit 0a24bf8aff
20 files changed
+59 -29

No files matched your search

+8 -5
View File
@@ -64,17 +64,20 @@ mainloop() {
# 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
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 -q "^DUAL_SIM_ACTIVE=1$"; then
if doas -n /usr/libexec/msm-modem-uim-selection status >/dev/null 2>&1; then
if [ "$(cat /tmp/sxmo_dsds_active 2>/dev/null || echo 0)" = "1" ]; then
if doas -n true 2>/dev/null; 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 5
sleep 10
else
sleep 30
sleep 120
fi
done
) &
@@ -594,10 +594,12 @@ provision_slot() {
echo "Slot $other_slot already bound to secondary-gw-provisioning ($other_app_state)."
fi
ensure_dsds_nas_registration
printf '1\n' > /tmp/sxmo_dsds_active 2>/dev/null || true
else
if [ "${SECONDARY_GW_SLOT:-0}" != "0" ]; then
$QMICLI_MODEM --uim-change-provisioning-session='activate=no,session-type=secondary-gw-provisioning' >/dev/null 2>&1 || true
fi
printf '0\n' > /tmp/sxmo_dsds_active 2>/dev/null || true
fi
return 0
}
@@ -788,6 +790,11 @@ s2_state = sys.argv[4] if len(sys.argv) > 4 else "absent"
dual_active = 1 if (s1_state == "present" and s2_state == "present" and prim_slot in (1, 2) and sec_slot in (1, 2)) else 0
print(f"DUAL_SIM_ACTIVE={dual_active}")
try:
with open("/tmp/sxmo_dsds_active", "w") as df:
df.write(f"{dual_active}\n")
except Exception:
pass
AF_QIPCRTR = 42
QRTR_PORT_CTRL = 0xfffffffe
@@ -1116,6 +1123,10 @@ PY
;;
imei)
if [ -f /tmp/bananarchy_duress_mode ] && [ -s /tmp/bananarchy_duress_imei ]; then
cat /tmp/bananarchy_duress_imei
exit 0
fi
imei1=""
imei2=""
imei_sv=""
@@ -2785,7 +2796,7 @@ while True:
elif multipart_buf:
poll_timeout = 2.0
else:
poll_timeout = 60.0
poll_timeout = 300.0
r, _, _ = select.select([ws, vs], [], [], poll_timeout)
got_voice_ind = False
events = []
@@ -2846,7 +2857,7 @@ while True:
v_txn = (v_txn % 60000) + 1
sync_sub1_calls(parse_call_info(full_tlvs), sec_slot)
if time.time() - last_poll >= 120.0:
if not os.path.exists("/tmp/bananarchy_screen_locked") and time.time() - last_poll >= 600.0:
w_txn = poll_stored_sms(ws, wms_addr, w_txn, sec_slot)
last_poll = time.time()
except Exception:
@@ -534,7 +534,8 @@ case "$1" in
periodics) # 60 s loop
cur_st=""
[ -r "$SXMO_STATE" ] && { read -r cur_st < "$SXMO_STATE" 2>/dev/null || true; }
if [ "$cur_st" = "screenoff" ]; then
cur_bl="$(cat /sys/class/backlight/backlight/brightness 2>/dev/null || echo 1)"
if [ "$cur_st" = "screenoff" ] || [ "${cur_bl:-1}" -le 0 ] 2>/dev/null || [ -f /tmp/bananarchy_screen_locked ]; then
exit 0
fi
set_time