Implement 0014 keypad debouncer, Sparkler LRA filter, standby fixes, and stage a1125 (ampere)

- Extend 0012 standby optimizations with removable-SD-only MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE in sdhci-msm, proxy mem clock and BIMC XO re-parenting + 0x45000 BIT(2) early-vote clear in qcom_q6v5_mss / gcc-msm8909, 100 MHz opp-99999975 floor across qcom-msm8909.dtsi and all 6 device DTS/DTBs, disabled-by-default Bluetooth with bt_enabled persistence, NM ipv6.method=ignore + standby wlan0/disable_ipv6 muting, and post-park DSDS signal hysteresis

- Add ABI-preserving system-core keypad debouncer patch 0014 (drivers/input/input.c key_debounce_ms + pm8941-pwrkey press/release chatter holdoff), replace ignored col-scan-delay-ms with col-scan-delay-us = <0x32> and raise DT debounce intervals across all 6 DTS/DTBs, configure per-target key_debounce_ms at boot and xset r rate 300 25, and add C/DTS verification in scripts/test-keypad-debouncer.py

- Isolate Nokia 8000 4G (nokia-sparkler / nokia-leo) media playback from the shared 157 Hz SPK_DRV vibrator channel via dynamic Speaker-only filtering in music.so, files.so, and ringtones.so, explicit RX3/SPK mixer zeroing on Earpiece/Headphones/Bluetooth routes in sxmo_audio.sh and preview plugins, and Sparkler/Leo-only /etc/mpv/mpv.conf provisioning

- Register upcoming build a1125 (ampere) in scripts/version.sh, scripts/check-rebuild.sh, AGENTS.md, and CHANGELOG.md, fix --for-rebuild pre-rebuild stale output checks in check-rebuild.sh/test-cover-dt.py, rebuild vmlinuz/DTBs/plugins and all 4 --mkinitfs target images stamped a1125 (ampere), and pin their verified SHA-256 checksums
This commit is contained in:
Luxferre committed 2026-11-23 15:26:56 +02:00
1 parent c529463ae3
commit 5d427e39ab
55 files changed
+78935 -77569

No files matched your search

+17
View File
@@ -600,6 +600,8 @@ chmod 644 "$TARGET_ROOTFS/etc/pam.d/sshd" \
2>/dev/null || true
chown 0:0 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" \
"$TARGET_ROOTFS/etc/conf.d/bluetooth" 2>/dev/null || true
# Keep bluetooth stopped/off at boot unless the user explicitly enabled it.
rm -f "$TARGET_ROOTFS/etc/runlevels/default/bluetooth"
chmod 0644 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" \
"$TARGET_ROOTFS/etc/conf.d/bluetooth" 2>/dev/null || true
chown 0:0 "$TARGET_ROOTFS/etc/pam.d/sshd" \
@@ -616,5 +618,20 @@ chown -R 10000:10000 "$TARGET_ROOTFS/home/user/.ssh" 2>/dev/null || true
chown -R 0:0 "$TARGET_ROOTFS/etc/skel/.ssh" "$TARGET_ROOTFS/root/.ssh" \
2>/dev/null || true
# Filter out the 157 Hz speaker-LRA band for standalone mpv playback on Sparkler/Leo only.
case "$DEVICE" in
nokia-sparkler|nokia-leo)
mkdir -p "$TARGET_ROOTFS/etc/mpv"
cat > "$TARGET_ROOTFS/etc/mpv/mpv.conf" <<'EOF'
# Filter out the 157 Hz speaker-LRA resonance band on Nokia 8000 4G / 6300 4G
af=lavfi=[highpass=f=260:poles=2,highpass=f=260:poles=2,bandreject=f=157:width_type=h:w=80]
EOF
chmod 0644 "$TARGET_ROOTFS/etc/mpv/mpv.conf"
;;
*)
rm -f "$TARGET_ROOTFS/etc/mpv/mpv.conf"
;;
esac
"$BASE_DIR/scripts/compile-gsettings-schemas.sh" "$TARGET_ROOTFS"
echo "Bananarchy overlay applied to $TARGET_ROOTFS for device $DEVICE."
+1 -1
View File
@@ -214,7 +214,7 @@ for svc in bootmisc hostname loopback modules msm-firmware-loader-unpack osclock
swclock-offset-boot sysctl tmpfs; do
enable_service boot "$svc"
done
for svc in bananarchy-imsd bluetooth cgroups chronyd dbus elogind kill-plymouth local \
for svc in bananarchy-imsd cgroups chronyd dbus elogind kill-plymouth local \
modemmanager msm8909-modem-wwan-port msm-modem-uim-selection networkmanager \
postmarketos-zram-swap q6voiced rfkill rmtfs sshd tinydm udev-postmount \
wpa_supplicant; do
+6
View File
@@ -108,6 +108,10 @@ EOF
echo "[2l/5] Applying MSM8909 early-SCM SMP boot address and cpufreq patch..."
patch -p1 < /bananarchy/patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch
fi
if ! grep -q "ba_filter_key_bounce" drivers/input/input.c 2>/dev/null; then
echo "[2m/5] Applying system-core keypad debouncer patch..."
patch -p1 < /bananarchy/patches/kernel/0014-input-core-keypad-debouncer.patch
fi
if [ ! -f include/config/auto.conf ] || \
! grep -q "CONFIG_NETFILTER_XT_MATCH_OWNER=m" .config 2>/dev/null || \
! grep -q "CONFIG_INTERCONNECT_QCOM_MSM8909=y" .config 2>/dev/null || \
@@ -156,6 +160,8 @@ EOF
patch -p1 < /bananarchy/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch
echo "[2l/5] Applying MSM8909 early-SCM SMP boot address and cpufreq patch..."
patch -p1 < /bananarchy/patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch
echo "[2m/5] Applying system-core keypad debouncer patch..."
patch -p1 < /bananarchy/patches/kernel/0014-input-core-keypad-debouncer.patch
echo "[3/5] Preparing kernel configuration and Module.symvers..."
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
+79 -33
View File
@@ -564,15 +564,15 @@ fi
echo "[check] Known-good flashable image set..."
for pair in \
"4f72a1156a2e9144386d82f10fc8078e90c69ed60446d0259dfbdf66362f47bc images/bananarchy-nokia-argon.img" \
"ac29427c8582049bc5fbaa504685442a997e260eb3f74d7b92d5b999f0f4a4fa images/bananarchy-nokia-beatles.img" \
"35aa314d1d21a401412794820416c21d1d22457671489dcf05410d39daf9f7da images/boot-bananarchy-nokia-beatles.img" \
"a0a02a8502736fae9c25de54cb8043231b2fd3ac488e123676cc8c3a35577ea1 images/bananarchy-nokia-argon.img" \
"9703ab732bac535ad83862a89c71931a4c16704b685f1bca45c23d7ac066c341 images/bananarchy-nokia-beatles.img" \
"7eab3dcf44ba01f044e9b6dba3f786aebe80a3380884966e6ecd5dafc455c16a images/boot-bananarchy-nokia-beatles.img" \
"f13db705a714aaebd2d8fcc2e0f7266d0e40268c0a276208117dfdf9d8f45351 images/boot-lk2nd-nokia-beatles-display.img" \
"d7bcfffdc33fefa12f173b4b3664ae02ecb4850b9f7ccf096719f2d19a799772 images/bananarchy-nokia-coconut.img" \
"8ffc67df915d27b286aaf0d82186f2d52719d27c67f954f7abafbd206331efc1 images/boot-bananarchy-nokia-coconut.img" \
"5158dc6e545c975387ba29c44593afe2758a4cd926e0c43df90e8b79b72a6b37 images/bananarchy-nokia-coconut.img" \
"d79b51d86344441f170b1ddf205b721b54ce8c995a66bb611670065911768347 images/boot-bananarchy-nokia-coconut.img" \
"9a5bd2da6cfd95c745d9c1acb2e3bc61afa339824810e3d160bf079e17b23192 images/boot-lk2nd-nokia-coconut-display.img" \
"d3da5d807c8c53c4c6e153fa3a03155ec2d9e1a854ba29ed18d61dba77fb0174 images/bananarchy-nokia-sparkler.img" \
"b46341849e509e71272a946829d3742881dbdb8ed33a58f6a6316288cbb8bb36 images/boot-bananarchy-nokia-sparkler.img" \
"90ff40226f344d280b7a9cca1d23fb587cc987255c375b57969b3fd415c786b4 images/bananarchy-nokia-sparkler.img" \
"4e1ddbfd5acc8335cb3e3e50b3fef46b9c6fe93afdaa9c2c0826500e63b60adf images/boot-bananarchy-nokia-sparkler.img" \
"120ade81bc5416263a1afd95a29981675358b98516e105e5ed611edf258a29f7 images/boot-lk2nd-nokia-sparkler-display.img"; do
set -- $pair
want=$1
@@ -694,7 +694,7 @@ for svc in bananarchy-lid bananarchy-cover-display bananarchy-volume-keys; do
fail "$svc does not start its compiled daemon"
fi
done
if ! grep -qF 'xset r rate 180 30' \
if ! grep -qF 'xset r rate 300 25' \
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh"; then
fail "the X session no longer lowers keypad auto-repeat delay"
fi
@@ -941,19 +941,23 @@ if check_target nokia-beatles; then
if ! grep -qF 'reg = <0x80000000 0x20000000>;' "$BEATLES_DTS"; then
fail "nokia-beatles DTS lost the 512 MiB memory fallback"
fi
if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-beatles.img" ]; then
if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py"; then
fail "2720 boot image validation failed"
fi
if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then
echo "[skip] --for-rebuild: skipping pre-rebuild 2720 boot/raw image checks"
else
echo "[skip] local build output images/boot-bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it"
fi
if [ -f "$BASE_DIR/images/bananarchy-nokia-beatles.img" ]; then
if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --raw-image "$BASE_DIR/images/bananarchy-nokia-beatles.img"; then
fail "2720 raw image pmOS_boot filesystem is damaged or stale"
if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-beatles.img" ]; then
if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py"; then
fail "2720 boot image validation failed"
fi
else
echo "[skip] local build output images/boot-bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it"
fi
if [ -f "$BASE_DIR/images/bananarchy-nokia-beatles.img" ]; then
if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --raw-image "$BASE_DIR/images/bananarchy-nokia-beatles.img"; then
fail "2720 raw image pmOS_boot filesystem is damaged or stale"
fi
else
echo "[skip] local build output images/bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it"
fi
else
echo "[skip] local build output images/bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it"
fi
fi
@@ -975,14 +979,18 @@ if check_target nokia-coconut; then
if grep -q 'switch-lid-' "$COCONUT_DTS"; then
fail "nokia-coconut DTS still carries phantom slider lid-switch nodes"
fi
if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-coconut.img" ]; then
if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then
echo "[skip] --for-rebuild: skipping pre-rebuild 800 Tough boot image check"
elif [ -f "$BASE_DIR/images/boot-bananarchy-nokia-coconut.img" ]; then
if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py" --device nokia-coconut; then
fail "800 Tough boot image validation failed"
fi
else
echo "[skip] local build output images/boot-bananarchy-nokia-coconut.img is absent; prepare-release.sh will rebuild it"
fi
if [ -f "$BASE_DIR/images/bananarchy-nokia-coconut.img" ]; then
if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then
echo "[skip] --for-rebuild: skipping pre-rebuild 800 Tough raw image bootfs check"
elif [ -f "$BASE_DIR/images/bananarchy-nokia-coconut.img" ]; then
if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --device nokia-coconut --raw-image "$BASE_DIR/images/bananarchy-nokia-coconut.img"; then
fail "800 Tough raw image pmOS_boot filesystem is damaged or stale"
fi
@@ -1011,14 +1019,18 @@ if check_target nokia-sparkler nokia-leo; then
fail "nokia-sparkler DTS is missing $node"
fi
done
if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-sparkler.img" ]; then
if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then
echo "[skip] --for-rebuild: skipping pre-rebuild 8000 4G boot image check"
elif [ -f "$BASE_DIR/images/boot-bananarchy-nokia-sparkler.img" ]; then
if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py" --device nokia-sparkler; then
fail "8000 4G boot image validation failed"
fi
else
echo "[skip] local build output images/boot-bananarchy-nokia-sparkler.img is absent; prepare-release.sh will rebuild it"
fi
if [ -f "$BASE_DIR/images/bananarchy-nokia-sparkler.img" ]; then
if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then
echo "[skip] --for-rebuild: skipping pre-rebuild 8000 4G raw image bootfs check"
elif [ -f "$BASE_DIR/images/bananarchy-nokia-sparkler.img" ]; then
if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --device nokia-sparkler --raw-image "$BASE_DIR/images/bananarchy-nokia-sparkler.img"; then
fail "8000 4G raw image pmOS_boot filesystem is damaged or stale"
fi
@@ -1460,7 +1472,8 @@ for f in etc/rc.conf etc/conf.d/udev-settle \
usr/bin/bananarchy-x11-session.sh etc/init.d/bananarchy-lid \
etc/init.d/bananarchy-sshd-debug etc/init.d/local \
etc/local.d/20-bananarchy-sshd-debug.start; do
# A clean clone has no rootfs yet; rebuild-image.sh bootstraps it next.
# A clean clone has no rootfs yet; rebuild-image.sh bootstraps/overlays it next.
[ "$SKIP_PINNED_HASHES" -eq 0 ] || continue
[ -e "$BASE_DIR/rootfs/$f" ] || continue
if ! cmp -s "$BASE_DIR/overlay/rootfs/$f" "$BASE_DIR/rootfs/$f"; then
fail "live rootfs copy drifted from overlay: $f"
@@ -1743,8 +1756,8 @@ for dts in \
"$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \
"$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do
artifact_matches_target "$dts" || continue
if [ "$(grep -c 'clock-latency-ns' "$dts" 2>/dev/null || echo 0)" -ne 8 ]; then
fail "${dts#"$BASE_DIR/"} must declare clock-latency-ns on all 8 opp nodes"
if [ "$(grep -c 'clock-latency-ns' "$dts" 2>/dev/null || echo 0)" -ne 9 ]; then
fail "${dts#"$BASE_DIR/"} must declare clock-latency-ns on all 9 opp nodes"
fi
done
for dts in \
@@ -1886,7 +1899,7 @@ fi
echo "[check] Version helper..."
# Pin the release under test so the check does not break when the wall clock
# rolls past the release date (version.sh otherwise derives it from today).
for pair in "a1120 cocojamboo" "a1114 carbonara" "a1111 lennon"; do
for pair in "a1125 ampere" "a1120 cocojamboo" "a1114 carbonara" "a1111 lennon"; do
set -- $pair
want_ver=$1
want_codename=$2
@@ -2373,7 +2386,9 @@ if check_target nokia-beatles; then
if ! "$BASE_DIR/scripts/build-beatles-cover-panel.py" --check >/dev/null 2>&1; then
fail "opt-in two-panel DTB validation failed"
fi
if ! "$BASE_DIR/scripts/test-cover-dt.py" >/dev/null 2>&1; then
COVER_DT_ARGS=""
[ "$SKIP_PINNED_HASHES" -eq 1 ] && COVER_DT_ARGS="--for-rebuild"
if ! "$BASE_DIR/scripts/test-cover-dt.py" $COVER_DT_ARGS >/dev/null 2>&1; then
fail "host 2720 Flip DT wiring validation failed"
fi
fi
@@ -2452,8 +2467,12 @@ if [ ! -f "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.
! grep -qF 'mmc->ios.vdd ? 200000 : 0' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'regulator_set_load(msm_host->mmc->supply.vmmc, 200000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'regulator_set_load(mmc->supply.vqmmc, 20000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'regulator_set_load(host->mmc->supply.vmmc, 2000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch"; then
fail "kernel patch 0012, sdhci-msm HPM/LPM regulator_set_load hunks, or build-kernel-audio.sh wiring is missing"
! grep -qF 'regulator_set_load(host->mmc->supply.vmmc, 2000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'MMC_CAP_AGGRESSIVE_PM' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'gcc_mss_q6_bimc_axi_clk' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'qcom_q6v5_mss.c' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
! grep -qF 'opp-99999975' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch"; then
fail "kernel patch 0012, sdhci-msm HPM/LPM/aggressive-PM, MSS proxy/BIMC, 100 MHz OPP, or build-kernel-audio.sh wiring is missing"
fi
for ko in "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst" \
"$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-analog.ko.zst"; do
@@ -2469,8 +2488,9 @@ for dts in \
"$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \
"$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do
artifact_matches_target "$dts" || continue
if [ "$(grep -c 'regulator-allow-set-load;' "$dts" 2>/dev/null || echo 0)" -lt 3 ]; then
fail "${dts#"$BASE_DIR/"} is missing regulator-allow-set-load on l8/l12"
if [ "$(grep -c 'regulator-allow-set-load;' "$dts" 2>/dev/null || echo 0)" -lt 3 ] || \
! grep -qF 'opp-99999975' "$dts"; then
fail "${dts#"$BASE_DIR/"} is missing regulator-allow-set-load on l8/l12 or opp-99999975"
fi
done
if ! grep -qF 'msm8905_cam_spmi_restore' "$BASE_DIR/src/msm8905-cam/msm8905-cam.c" || \
@@ -2480,6 +2500,12 @@ if ! grep -qF 'msm8905_cam_spmi_restore' "$BASE_DIR/src/msm8905-cam/msm8905-cam.
! grep -qF -- '--sig-hysteresis' "$BASE_DIR/src/bananarchy-daemons/bananarchy-dsds.c" || \
! grep -qF 'effective_blank_ms' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \
! grep -qF 'unpark-rat' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \
! grep -qF 'ipv6.method=ignore' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/conf.d/10-power.conf" || \
! grep -qF 'DISABLE_IPV6' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-power-policy.sh" || \
! grep -qF 'bt_enabled' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_bluetoothtoggle.sh" || \
! grep -qF 'bt_enabled' "$BASE_DIR/overlay/rootfs/etc/local.d/10-power-save.start" || \
grep -qE '^for svc in .*bluetooth' "$BASE_DIR/scripts/bootstrap-rootfs-container.sh" || \
! grep -qF 'runlevels/default/bluetooth' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
grep -qF 'wifi.scan-interval' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/conf.d/10-power.conf"; then
fail "one or more 72h standby optimization guards failed"
fi
@@ -2489,6 +2515,20 @@ elif ! "$BASE_DIR/scripts/test-standby-power-policy.py" >/dev/null 2>&1; then
fail "host standby power policy test failed"
fi
echo "[check] System-core keypad debouncer (patch 0014, DTS scan/debounce, X11 repeat)..."
if [ ! -f "$BASE_DIR/patches/kernel/0014-input-core-keypad-debouncer.patch" ] || \
! grep -qF '0014-input-core-keypad-debouncer.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \
! grep -qF 'ba_filter_key_bounce' "$BASE_DIR/patches/kernel/0014-input-core-keypad-debouncer.patch" || \
grep -qF 'a/include/linux/input.h' "$BASE_DIR/patches/kernel/0014-input-core-keypad-debouncer.patch" || \
! grep -qF '/sys/module/input_core/parameters/key_debounce_ms' "$BASE_DIR/overlay/rootfs/etc/local.d/10-power-save.start"; then
fail "0014 system-core keypad debouncer patch, build wiring, or boot tuning is missing"
fi
if [ ! -x "$BASE_DIR/scripts/test-keypad-debouncer.py" ]; then
fail "missing executable host test scripts/test-keypad-debouncer.py"
elif ! "$BASE_DIR/scripts/test-keypad-debouncer.py" >/dev/null 2>&1; then
fail "host keypad debouncer test failed"
fi
echo "[check] microSD sdhci@7864000 non-removable and zero-polling invariants..."
for dts in \
"$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \
@@ -2611,9 +2651,15 @@ if check_target nokia-sparkler nokia-leo; then
! grep -qF 'SND_PCM_FORMAT_FLOAT_LE' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \
! grep -qF 'pa_sw_volume_to_linear' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \
! grep -qF 'HAPTIC_REF_RX3_VOL' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \
! grep -qF 'isHapticAudioSpeakerDevice' "$BASE_DIR/src/dwm-plugins/music_plugin.cpp" || \
! grep -qF 'bandreject=f=157' "$BASE_DIR/src/dwm-plugins/music_plugin.cpp" || \
! grep -qF 'isHapticAudioSpeakerDevice' "$BASE_DIR/src/dwm-plugins/files_plugin.cpp" || \
! grep -qF 'isHapticAudioSpeakerDevice' "$BASE_DIR/src/dwm-plugins/ringtones_plugin.cpp" || \
! grep -qF 'AUDIO_ROUTE' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_audio.sh" || \
! grep -qF '/etc/mpv/mpv.conf' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
! grep -qF 'libpulse' "$BASE_DIR/scripts/build-dwm-plugins.sh" || \
! grep -qF 'libpulse' "$BASE_DIR/scripts/build-sxmo-x11.sh"; then
fail "sxmo_vibrate.c or plugin build lost volume-independent 157 Hz haptic audio support for nokia-sparkler"
fail "sxmo_vibrate.c, media player LRA isolation, or plugin build lost nokia-sparkler audio invariants"
fi
if ! grep -qF 'of_machine_is_compatible("nokia,sparkler")' "$TORCH_SRC" || \
! grep -qF 'MSM8905_TLMM_GPIO31_PHYS' "$TORCH_SRC" || \
+2
View File
@@ -56,6 +56,8 @@ def node(text, opening):
def appended_dtb_matches(dtb_bytes):
if "--for-rebuild" in sys.argv:
return True, "skipped (--for-rebuild)"
if not BOOT_IMAGE.is_file():
return True, "skipped (local build output absent)"
data = BOOT_IMAGE.read_bytes()
+310
View File
@@ -0,0 +1,310 @@
#!/usr/bin/env python3
"""Offline verification for the system-core keypad debouncer and DT/X11 settings."""
import os
import re
import shutil
import subprocess
import sys
import tempfile
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PATCH_0014 = os.path.join(BASE_DIR, "patches/kernel/0014-input-core-keypad-debouncer.patch")
BUILD_KERNEL = os.path.join(BASE_DIR, "scripts/build-kernel-audio.sh")
SYSMAP = os.path.join(BASE_DIR, "prebuilt/kernel-6.12.1-msm8916/System.map")
POWERSAVE = os.path.join(BASE_DIR, "overlay/rootfs/etc/local.d/10-power-save.start")
X11_SESSION = os.path.join(BASE_DIR, "overlay/rootfs/usr/bin/bananarchy-x11-session.sh")
DTS_EXPECT = {
"devices/nokia-argon/qcom-msm8905-nokia-argon.dts": (0x32, 0x12, 0x19, 2),
"devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts": (0x32, 0x12, 0x19, 1),
"devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts": (0x32, 0x12, 0x19, 1),
"devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts": (0x32, 0x0e, 0x14, 2),
"devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts": (0x32, 0x0e, 0x14, 2),
"devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts": (0x32, 0x0e, 0x14, 2),
}
def read_text(path):
with open(path, "r", encoding="utf-8") as handle:
return handle.read()
def fail(msg):
sys.stderr.write(f"[fail] {msg}\n")
return 1
def extract_debouncer_code(patch_text):
lines = []
in_block = False
for raw in patch_text.splitlines():
if raw.startswith("+static unsigned int ba_key_debounce_ms"):
in_block = True
if in_block:
if not raw.startswith("+"):
break
lines.append(raw[1:])
code = "\n".join(lines) + "\n"
if "ba_filter_key_bounce" not in code or "ba_clear_key_debounce_dev" not in code:
raise AssertionError("failed to extract debouncer C implementation from 0014")
return code
def run_c_debouncer_harness(patch_text):
gcc = shutil.which("gcc")
if not gcc:
print("[skip] host gcc unavailable; skipping compiled C debouncer behavioral test")
return
extracted = extract_debouncer_code(patch_text)
harness = r"""
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int64_t s64;
typedef int64_t ktime_t;
typedef int spinlock_t;
#define DEFINE_SPINLOCK(x) spinlock_t x = 0
#define DEFINE_MUTEX(x) int x = 0
#define READ_ONCE(x) (x)
#define module_param_named(a, b, c, d)
#define MODULE_PARM_DESC(a, b)
#define NSEC_PER_MSEC 1000000LL
#define BUS_HOST 0x19
#define BUS_USB 0x03
#define BUS_BLUETOOTH 0x05
#define BUS_VIRTUAL 0x06
#define EV_SYN 0x00
#define EV_KEY 0x01
#define EV_MSC 0x04
#define MSC_SCAN 0x04
#define BTN_MISC 0x100
#define BTN_LEFT 0x110
#define KEY_OK 0x160
#define KEY_1 2
#define KEY_2 3
#define KEY_POWER 116
#define KEY_PICKUP_PHONE 0x1bd
#define KEY_NUMERIC_STAR 0x20a
#define KEY_MAX 0x2ff
static ktime_t mock_now_ns = 0;
static inline ktime_t ktime_get(void) { return mock_now_ns; }
static inline s64 ktime_to_ns(ktime_t k) { return k; }
static inline ktime_t ktime_add_ns(ktime_t k, s64 ns) { return k + ns; }
static inline s64 ktime_sub(ktime_t a, ktime_t b) { return a - b; }
static inline bool ktime_before(ktime_t a, ktime_t b) { return a < b; }
static inline bool ktime_after(ktime_t a, ktime_t b) { return a > b; }
#define spin_lock_irqsave(l, f) do { (void)(l); (f) = 0; } while (0)
#define spin_unlock_irqrestore(l, f) do { (void)(l); (void)(f); } while (0)
#define min(a, b) ((a) < (b) ? (a) : (b))
struct input_value {
uint16_t type;
uint16_t code;
int32_t value;
};
struct input_dev {
struct { uint16_t bustype; } id;
unsigned long key[(KEY_MAX + 63) / 64];
struct input_value vals[64];
unsigned int num_vals;
};
static inline bool test_bit(unsigned int nr, const unsigned long *addr) {
return (addr[nr / 64] >> (nr % 64)) & 1UL;
}
static inline void set_bit(unsigned int nr, unsigned long *addr) {
addr[nr / 64] |= (1UL << (nr % 64));
}
static inline void clear_bit(unsigned int nr, unsigned long *addr) {
addr[nr / 64] &= ~(1UL << (nr % 64));
}
""" + extracted.replace("static DEFINE_MUTEX(input_mutex);\n", "") + r"""
static int feed_key(struct input_dev *dev, int64_t ms, uint32_t scancode,
unsigned int code, int value) {
mock_now_ns = ms * NSEC_PER_MSEC;
if (dev->num_vals + 2 > 64) {
dev->num_vals = 0;
}
dev->vals[dev->num_vals++] = (struct input_value){ EV_MSC, MSC_SCAN, (int32_t)scancode };
if (ba_filter_key_bounce(dev, code, value)) {
return 0;
}
if (value) set_bit(code, dev->key);
else clear_bit(code, dev->key);
dev->vals[dev->num_vals++] = (struct input_value){ EV_KEY, (uint16_t)code, value };
return 1;
}
int main(void) {
struct input_dev kpd = {0}, pwr = {0}, bt = {0}, uinp = {0}, mouse = {0};
kpd.id.bustype = BUS_HOST;
pwr.id.bustype = BUS_HOST;
bt.id.bustype = BUS_BLUETOOTH;
uinp.id.bustype = BUS_VIRTUAL;
mouse.id.bustype = BUS_USB;
ba_key_debounce_ms = 55;
/* 1. Immediate genuine press and release pass with 0 ms delay. */
if (!feed_key(&kpd, 1000, 1, KEY_1, 1) || !feed_key(&kpd, 1080, 1, KEY_1, 0)) {
fprintf(stderr, "genuine press/release dropped\n");
return 1;
}
/* 2. Dome chatter after release (bounce Down@1105 -> bounce Up@1112) must drop and pop MSC_SCAN. */
kpd.num_vals = 0;
if (feed_key(&kpd, 1105, 1, KEY_1, 1) || kpd.num_vals != 0) {
fprintf(stderr, "post-release bounce press not suppressed or MSC_SCAN left (%u)\n", kpd.num_vals);
return 2;
}
if (feed_key(&kpd, 1112, 1, KEY_1, 0) || kpd.num_vals != 0) {
fprintf(stderr, "suppressed bounce release not suppressed or MSC_SCAN left (%u)\n", kpd.num_vals);
return 3;
}
/* 3. Multi-ring chatter still suppressed inside extended settle, then genuine tap@1210 passes. */
if (feed_key(&kpd, 1132, 1, KEY_1, 1) || feed_key(&kpd, 1138, 1, KEY_1, 0)) {
fprintf(stderr, "secondary chatter ring passed\n");
return 4;
}
if (!feed_key(&kpd, 1210, 1, KEY_1, 1) || !feed_key(&kpd, 1270, 1, KEY_1, 0)) {
fprintf(stderr, "genuine second tap after debounce window dropped\n");
return 5;
}
/* 4. Two different physical keys pressed 5 ms apart both pass immediately. */
if (!feed_key(&kpd, 2000, 1, KEY_1, 1) || !feed_key(&kpd, 2005, 2, KEY_2, 1) ||
!feed_key(&kpd, 2040, 1, KEY_1, 0) || !feed_key(&kpd, 2045, 2, KEY_2, 0)) {
fprintf(stderr, "adjacent distinct key suppressed\n");
return 6;
}
/* 4b. High Nokia phone keycodes (> KEY_OK: Call 0x1bd, * 0x20a) DO get debounced. */
if (!feed_key(&kpd, 2500, 9, KEY_NUMERIC_STAR, 1) ||
!feed_key(&kpd, 2560, 9, KEY_NUMERIC_STAR, 0) ||
feed_key(&kpd, 2580, 9, KEY_NUMERIC_STAR, 1)) {
fprintf(stderr, "KEY_NUMERIC_STAR was not debounced\n");
return 7;
}
/* 4c. Separate built-in PMIC pwrkey input_dev debounces KEY_POWER independently. */
if (!feed_key(&pwr, 2600, 0, KEY_POWER, 1) ||
!feed_key(&pwr, 2640, 0, KEY_POWER, 0) ||
feed_key(&pwr, 2660, 0, KEY_POWER, 1)) {
fprintf(stderr, "KEY_POWER chatter on pwrkey dev was not debounced\n");
return 12;
}
/* 5. BUS_BLUETOOTH, BUS_VIRTUAL, BUS_USB and BTN_LEFT bypass debouncing completely. */
if (!feed_key(&bt, 3000, 1, KEY_1, 1) || !feed_key(&bt, 3010, 1, KEY_1, 0) ||
!feed_key(&bt, 3015, 1, KEY_1, 1)) {
fprintf(stderr, "Bluetooth keyboard was unexpectedly debounced\n");
return 8;
}
if (!feed_key(&uinp, 3000, 1, KEY_POWER, 1) || !feed_key(&uinp, 3010, 1, KEY_POWER, 0) ||
!feed_key(&uinp, 3015, 1, KEY_POWER, 1)) {
fprintf(stderr, "Virtual uinput device was unexpectedly debounced\n");
return 9;
}
if (!feed_key(&mouse, 3000, 0, BTN_LEFT, 1) || !feed_key(&mouse, 3005, 0, BTN_LEFT, 0) ||
!feed_key(&mouse, 3010, 0, BTN_LEFT, 1)) {
fprintf(stderr, "Pointer button BTN_LEFT was unexpectedly debounced\n");
return 10;
}
/* 6. Unregister cleanup releases slots matching device. */
ba_clear_key_debounce_dev(&kpd);
for (int i = 0; i < BA_KEY_DEBOUNCE_SLOTS; i++) {
if (ba_key_slots[i].dev == &kpd) {
fprintf(stderr, "ba_clear_key_debounce_dev leaked slot %d\n", i);
return 11;
}
}
return 0;
}
"""
with tempfile.TemporaryDirectory(prefix="ba_debounce_") as td:
src = os.path.join(td, "test_debounce.c")
exe = os.path.join(td, "test_debounce")
with open(src, "w", encoding="utf-8") as handle:
handle.write(harness)
subprocess.run([gcc, "-Wall", "-Wextra", "-Werror", "-O2", src, "-o", exe], check=True)
subprocess.run([exe], check=True)
def main():
if not os.path.isfile(PATCH_0014):
return fail("missing patches/kernel/0014-input-core-keypad-debouncer.patch")
patch_txt = read_text(PATCH_0014)
for tok in (
"ba_filter_key_bounce",
"ba_pop_trailing_msc_scan",
"ba_clear_key_debounce_dev",
"key_debounce_ms",
"drivers/input/misc/pm8941-pwrkey.c",
"pwrkey->sw_debounce_end_time",
"45000U",
):
if tok not in patch_txt:
return fail(f"0014 patch missing {tok}")
if "a/include/linux/input.h" in patch_txt or "b/include/linux/input.h" in patch_txt:
return fail("0014 patch must not modify include/linux/input.h (module ABI invariant)")
build_txt = read_text(BUILD_KERNEL)
if "0014-input-core-keypad-debouncer.patch" not in build_txt or \
"ba_filter_key_bounce" not in build_txt:
return fail("scripts/build-kernel-audio.sh missing 0014 patch guard")
if os.path.isfile(SYSMAP):
sysmap = read_text(SYSMAP)
for sym in ("ba_key_debounce_ms", "ba_key_slots"):
if sym not in sysmap:
return fail(f"System.map missing debouncer symbol {sym}")
run_c_debouncer_harness(patch_txt)
dtc = shutil.which("dtc")
for rel, (want_scan, want_db, want_gk_db, want_gk_cnt) in DTS_EXPECT.items():
dts_path = os.path.join(BASE_DIR, rel)
txt = read_text(dts_path)
if "col-scan-delay-ms" in txt:
return fail(f"{rel} still uses unsupported col-scan-delay-ms property")
if f"col-scan-delay-us = <0x{want_scan:02x}>;" not in txt:
return fail(f"{rel} missing col-scan-delay-us = <0x{want_scan:02x}>;")
if f"debounce-delay-ms = <0x{want_db:02x}>;" not in txt:
return fail(f"{rel} missing debounce-delay-ms = <0x{want_db:02x}>;")
if txt.count(f"debounce-interval = <0x{want_gk_db:02x}>;") < want_gk_cnt:
return fail(f"{rel} missing expected gpio-keys debounce-interval = <0x{want_gk_db:02x}>;")
dtb_path = dts_path[:-4] + ".dtb"
if dtc and os.path.isfile(dtb_path):
dec = subprocess.check_output([dtc, "-q", "-I", "dtb", "-O", "dts", dtb_path], text=True)
if "col-scan-delay-ms" in dec:
return fail(f"{dtb_path} still contains col-scan-delay-ms")
if f"col-scan-delay-us = <0x{want_scan:02x}>;" not in dec:
return fail(f"{dtb_path} missing col-scan-delay-us = <0x{want_scan:02x}>;")
ps_txt = read_text(POWERSAVE)
if "/sys/module/input_core/parameters/key_debounce_ms" not in ps_txt or \
"nokia,(argon|sparkler|leo)" not in ps_txt or \
"/etc/bananarchy/key-debounce.conf" not in ps_txt:
return fail("10-power-save.start missing per-target key_debounce_ms tuning")
x11_txt = read_text(X11_SESSION)
if "xset r rate 300 25" not in x11_txt:
return fail("bananarchy-x11-session.sh must set xset r rate 300 25")
print("[ok] 0014 input_core debouncer ABI/C harness, DT scan/debounce, runtime tuning, and X11 rate passed")
return 0
if __name__ == "__main__":
sys.exit(main())
+50
View File
@@ -211,6 +211,56 @@ class TestSparklerPort(unittest.TestCase):
self.assertEqual(spec["addrs"], (0x80008000, 0x82700000, 0x82500000))
self.assertEqual(bootfs_mod.DEVICE_DTB_NAMES["nokia-sparkler"], "qcom-msm8909-nokia-sparkler.dtb")
def test_vibrator_channel_media_isolation(self):
vib_c = read_text("src/dwm-plugins/sxmo_vibrate.c")
self.assertIn("157.0", vib_c)
self.assertIn("HAPTIC_REF_RX3_VOL", vib_c)
for rel in (
"src/dwm-plugins/music_plugin.cpp",
"src/dwm-plugins/files_plugin.cpp",
"src/dwm-plugins/ringtones_plugin.cpp",
):
src = read_text(rel)
for expected in (
"isHapticAudioSpeakerDevice",
"highpass=f=260",
"bandreject=f=157",
):
self.assertIn(expected, src, rel)
music_src = read_text("src/dwm-plugins/music_plugin.cpp")
self.assertIn('set_property', music_src)
self.assertIn(r'\"af\"', music_src)
self.assertIn('"AUDIO_ROUTE"', music_src)
for rel in (
"src/dwm-plugins/files_plugin.cpp",
"src/dwm-plugins/ringtones_plugin.cpp",
):
src = read_text(rel)
for expected in (
"Bluetooth",
"Headphones",
"Earpiece",
r'''cset \"name='RX3 MIX1 INP1'\" ''' + "'ZERO'",
r'''cset \"name='SPK DAC Switch'\" 0''',
):
self.assertIn(expected, src, rel)
audio_sh = read_text("overlay/rootfs/usr/bin/sxmo_audio.sh")
self.assertIn("cset \"name='SPK DAC Switch'\" 0", audio_sh)
self.assertIn("cset \"name='RX3 MIX1 INP1'\" 'ZERO'", audio_sh)
self.assertIn("dwm_plugin_music.fifo", audio_sh)
self.assertIn("AUDIO_ROUTE", audio_sh)
ov_sh = read_text("scripts/apply-bananarchy-overlay.sh")
self.assertIn("nokia-sparkler|nokia-leo", ov_sh)
self.assertIn("/etc/mpv/mpv.conf", ov_sh)
self.assertIn("highpass=f=260", ov_sh)
self.assertIn("bandreject=f=157", ov_sh)
self.assertIn('rm -f "$TARGET_ROOTFS/etc/mpv/mpv.conf"', ov_sh)
if __name__ == "__main__":
unittest.main()
+16 -8
View File
@@ -240,6 +240,9 @@ def test_power_policy_rat(tmp):
res = run_policy(env, "_park_rat")
if res.returncode != 0 or qmi_log.exists():
return fail("expected no QMI calls once gsm_unsupported exists")
if read_lines(dsds_log) != ["--sig-hysteresis dark", "--sig-hysteresis dark"]:
return fail(f"unexpected DSDS calls during GSM parking: {read_lines(dsds_log)}")
dsds_log.unlink()
# 4) screenoff / screenon invoke bananarchy-dsds --sig-hysteresis dark / wake.
res = run_policy(env, "screenoff")
@@ -284,18 +287,22 @@ def test_power_policy_rat(tmp):
ims_state = tmp / "ims_state.env"
ims_conf = tmp / "ims.conf"
accept_ra = tmp / "accept_ra"
disable_ipv6 = tmp / "disable_ipv6"
write_text(ims_conf, "keep_lte_on_screen_off=1\n")
write_text(ims_state, "VOLTE_ACTIVE=1\nVOWIFI_ACTIVE=0\nVOWIFI_IPV6_EPDG=0\n")
write_text(accept_ra, "1\n")
write_text(disable_ipv6, "0\n")
env["BANANARCHY_IMS_STATE_PATH"] = str(ims_state)
env["BANANARCHY_IMS_CONF_PATH"] = str(ims_conf)
env["BANANARCHY_ACCEPT_RA_PATH"] = str(accept_ra)
env["BANANARCHY_DISABLE_IPV6_PATH"] = str(disable_ipv6)
res = run_policy(env, "_park_rat")
if res.returncode != 0 or (rundir / "rat_parked").exists():
return fail("active VoLTE (without VoWiFi) must skip GSM RAT parking")
# 6b) Active VoWiFi allows GSM RAT parking; VOWIFI_IPV6_EPDG=0 mutes accept_ra,
# while VOWIFI_IPV6_EPDG=1 preserves wlan0 accept_ra across screenoff/screenon.
# 6b) Active VoWiFi allows GSM RAT parking; VOWIFI_IPV6_EPDG=0 mutes accept_ra
# and sets disable_ipv6=1, while VOWIFI_IPV6_EPDG=1 preserves both across
# screenoff/screenon.
mock_bin = tmp / "bin"
mock_ip = mock_bin / "ip"
write_text(mock_ip, """#!/bin/sh
@@ -310,9 +317,10 @@ exit 0
write_text(ims_state, "VOLTE_ACTIVE=1\nVOWIFI_ACTIVE=1\nVOWIFI_IPV6_EPDG=0\n")
write_text(accept_ra, "1\n")
write_text(disable_ipv6, "0\n")
res = run_policy(env, "screenoff")
if res.returncode != 0 or accept_ra.read_text().strip() != "0":
return fail("VOWIFI_IPV6_EPDG=0 must mute wlan0 accept_ra on screenoff")
if res.returncode != 0 or accept_ra.read_text().strip() != "0" or disable_ipv6.read_text().strip() != "1":
return fail("VOWIFI_IPV6_EPDG=0 must mute wlan0 accept_ra and set disable_ipv6=1 on screenoff")
deadline = time.monotonic() + 3.0
while time.monotonic() < deadline and not (rundir / "rat_parked").exists():
time.sleep(0.05)
@@ -320,13 +328,13 @@ exit 0
if not (rundir / "rat_parked").exists():
return fail("active VoWiFi screenoff should allow cellular GSM standby parking")
res = run_policy(env, "screenon")
if res.returncode != 0 or accept_ra.read_text().strip() != "1":
return fail("screenon must restore wlan0 accept_ra to 1")
if res.returncode != 0 or accept_ra.read_text().strip() != "1" or disable_ipv6.read_text().strip() != "0":
return fail("screenon must restore wlan0 accept_ra=1 and disable_ipv6=0")
write_text(ims_state, "VOLTE_ACTIVE=1\nVOWIFI_ACTIVE=1\nVOWIFI_IPV6_EPDG=1\n")
res = run_policy(env, "screenoff")
if res.returncode != 0 or accept_ra.read_text().strip() != "1":
return fail("VOWIFI_IPV6_EPDG=1 must keep wlan0 accept_ra unmuted")
if res.returncode != 0 or accept_ra.read_text().strip() != "1" or disable_ipv6.read_text().strip() != "0":
return fail("VOWIFI_IPV6_EPDG=1 must keep wlan0 accept_ra unmuted and disable_ipv6=0")
deadline = time.monotonic() + 3.0
while time.monotonic() < deadline and not (rundir / "rat_parked").exists():
time.sleep(0.05)
+1
View File
@@ -16,6 +16,7 @@ YEAR_LETTER="$(printf "\\$(printf '%03o' $(( 97 + LETTER_IDX )))")"
VERSION="${BANANARCHY_VERSION:-${YEAR_LETTER}${MONTH}${DAY}}"
case "$VERSION" in
a1125) DEFAULT_CODENAME=ampere ;;
a1120) DEFAULT_CODENAME=cocojamboo ;;
a1114) DEFAULT_CODENAME=carbonara ;;
a1111) DEFAULT_CODENAME=lennon ;;