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,185 +1,2 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2023 Sxmo Contributors
|
||||
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. "$(dirname "$0")/sxmo_common.sh"
|
||||
|
||||
find_jack_event_dev() {
|
||||
for sysname in /sys/class/input/event*/device/name; do
|
||||
[ -r "$sysname" ] || continue
|
||||
read -r dname < "$sysname" 2>/dev/null || continue
|
||||
case "$dname" in
|
||||
*[Jj]ack*|*[Hh]eadset*)
|
||||
ev="${sysname%/device/name}"
|
||||
ev="/dev/input/${ev##*/}"
|
||||
if [ -c "$ev" ]; then
|
||||
printf "%s\n" "$ev"
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
is_hp_plugged() {
|
||||
jdev="$1"
|
||||
if [ -n "$jdev" ] && command -v evtest >/dev/null 2>&1; then
|
||||
evtest --query "$jdev" EV_SW SW_HEADPHONE_INSERT >/dev/null 2>&1
|
||||
rc=$?
|
||||
[ "$rc" -eq 10 ] && return 0
|
||||
fi
|
||||
if command -v amixer >/dev/null 2>&1; then
|
||||
amixer -c 0 cget "name='Headphone Jack'" 2>/dev/null | grep -q ": values=on" && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
is_mic_plugged() {
|
||||
jdev="$1"
|
||||
if [ -n "$jdev" ] && command -v evtest >/dev/null 2>&1; then
|
||||
evtest --query "$jdev" EV_SW SW_MICROPHONE_INSERT >/dev/null 2>&1
|
||||
rc=$?
|
||||
[ "$rc" -eq 10 ] && return 0
|
||||
fi
|
||||
if command -v amixer >/dev/null 2>&1; then
|
||||
amixer -c 0 cget "name='Mic Jack'" 2>/dev/null | grep -q ": values=on" && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
handle_jack_insert() {
|
||||
jdev="$1"
|
||||
cur_out="$(sxmo_audio.sh device get 2>/dev/null || printf "Speaker")"
|
||||
if [ "$cur_out" != "Headphones" ]; then
|
||||
printf "%s\n" "$cur_out" > /tmp/sxmo_prev_out_device 2>/dev/null || true
|
||||
fi
|
||||
printf "1\n" > /tmp/sxmo_jack_plugged 2>/dev/null || true
|
||||
if is_mic_plugged "$jdev"; then
|
||||
printf "Headset\n" > /tmp/sxmo_audio_in_device 2>/dev/null || true
|
||||
sxmo_audio.sh device setinput Headset >/dev/null 2>&1 || true
|
||||
else
|
||||
printf "Mic1\n" > /tmp/sxmo_audio_in_device 2>/dev/null || true
|
||||
fi
|
||||
sxmo_audio.sh device set Headphones >/dev/null 2>&1 || true
|
||||
sxmo_log "Wired headphones plugged in -> routed audio to Headphones"
|
||||
}
|
||||
|
||||
handle_jack_remove() {
|
||||
printf "0\n" > /tmp/sxmo_jack_plugged 2>/dev/null || true
|
||||
printf "Mic1\n" > /tmp/sxmo_audio_in_device 2>/dev/null || true
|
||||
sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1 || true
|
||||
target_out="Speaker"
|
||||
if [ -r /tmp/sxmo_in_call ]; then
|
||||
read -r incall < /tmp/sxmo_in_call 2>/dev/null || incall=0
|
||||
if [ "$incall" = "1" ]; then
|
||||
target_out="Earpiece"
|
||||
fi
|
||||
fi
|
||||
sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true
|
||||
sxmo_log "Wired headphones unplugged -> routed audio to $target_out"
|
||||
}
|
||||
|
||||
monitor_jack_events() {
|
||||
while : ; do
|
||||
jdev="$(find_jack_event_dev || true)"
|
||||
if [ -z "$jdev" ] || ! command -v evtest >/dev/null 2>&1; then
|
||||
sleep 5
|
||||
continue
|
||||
fi
|
||||
|
||||
if is_hp_plugged "$jdev"; then
|
||||
handle_jack_insert "$jdev"
|
||||
else
|
||||
printf "0\n" > /tmp/sxmo_jack_plugged 2>/dev/null || true
|
||||
if [ -n "$(pactl list short sinks 2>/dev/null | awk '$2 ~ /^bluez_output\./ { print $2; exit }')" ]; then
|
||||
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
|
||||
else
|
||||
sxmo_audio.sh device apply >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
|
||||
evtest "$jdev" 2>/dev/null | while read -r line; do
|
||||
case "$line" in
|
||||
*SW_HEADPHONE_INSERT*value\ 1*)
|
||||
sleep 0.1
|
||||
handle_jack_insert "$jdev"
|
||||
;;
|
||||
*SW_HEADPHONE_INSERT*value\ 0*)
|
||||
handle_jack_remove
|
||||
;;
|
||||
*SW_MICROPHONE_INSERT*value\ 1*)
|
||||
sxmo_audio.sh device setinput Headset >/dev/null 2>&1 || true
|
||||
;;
|
||||
*SW_MICROPHONE_INSERT*value\ 0*)
|
||||
sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1 || true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
sleep 2
|
||||
done
|
||||
}
|
||||
|
||||
handle_change() {
|
||||
prev_bt_sink="$(pactl list short sinks 2>/dev/null | awk '$2 ~ /^bluez_output\./ { print $2; exit }')"
|
||||
if [ -n "$prev_bt_sink" ]; then
|
||||
cur_out="$(cat /tmp/sxmo_audio_out_device 2>/dev/null || true)"
|
||||
if [ "$cur_out" != "Bluetooth" ]; then
|
||||
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
|
||||
else
|
||||
sxmo_audio.sh device apply >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
|
||||
pactl subscribe 2>/dev/null | while read -r line; do
|
||||
case "$line" in
|
||||
*"Event 'new' on sink"*|*"Event 'new' on card"*|*"Event 'change' on card"*)
|
||||
bt_sink="$(pactl list short sinks 2>/dev/null | awk '$2 ~ /^bluez_output\./ { print $2; exit }')"
|
||||
if [ -n "$bt_sink" ] && [ "$bt_sink" != "$prev_bt_sink" ]; then
|
||||
prev_bt_sink="$bt_sink"
|
||||
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
|
||||
sxmo_log "Bluetooth sink $bt_sink detected -> routed audio to Bluetooth"
|
||||
fi
|
||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||
;;
|
||||
*"Event 'remove' on sink"*|*"Event 'remove' on card"*)
|
||||
bt_sink="$(pactl list short sinks 2>/dev/null | awk '$2 ~ /^bluez_output\./ { print $2; exit }')"
|
||||
if [ -z "$bt_sink" ] && [ -n "$prev_bt_sink" ]; then
|
||||
prev_bt_sink=""
|
||||
cur_out="$(cat /tmp/sxmo_audio_out_device 2>/dev/null || true)"
|
||||
if [ "$cur_out" = "Bluetooth" ]; then
|
||||
if [ "$(cat /tmp/sxmo_jack_plugged 2>/dev/null || true)" = "1" ]; then
|
||||
sxmo_audio.sh device set Headphones >/dev/null 2>&1 || true
|
||||
elif [ -r /tmp/sxmo_in_call ]; then
|
||||
sxmo_audio.sh device set Earpiece >/dev/null 2>&1 || true
|
||||
else
|
||||
sxmo_audio.sh device set Speaker >/dev/null 2>&1 || true
|
||||
fi
|
||||
sxmo_log "Bluetooth sink removed -> restored local audio route"
|
||||
fi
|
||||
fi
|
||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||
;;
|
||||
*"Event 'change' on sink"*|*"Event 'change' on source"*)
|
||||
if [ ! -d /tmp/sxmo_volset.lock ]; then
|
||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
kill 0 2>/dev/null || true
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
monitor_jack_events &
|
||||
|
||||
while : ; do
|
||||
handle_change || true
|
||||
# U10: pactl subscribe is event-driven; only back off after a failure.
|
||||
sleep 10
|
||||
done
|
||||
exec /usr/bin/bananarchy-soundmonitor "$@"
|
||||
Reference in new issue
Block a user