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

+10 -9
View File
@@ -10,7 +10,8 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
- The stack is X11-only: Xlibre, patched `sxmo-de-dwm`, preloaded C/C++ DWM plugins, NeoUI, `fcitx5-t9`, and Adreno 304 - The stack is X11-only: Xlibre, patched `sxmo-de-dwm`, preloaded C/C++ DWM plugins, NeoUI, `fcitx5-t9`, and Adreno 304
Glamor/DRI3/GLX over `panel-mipi-dbi`. No Wayland compositor, backend, or viewer is shipped. Glamor/DRI3/GLX over `panel-mipi-dbi`. No Wayland compositor, backend, or viewer is shipped.
- Design targets are keypad-first 240x320 UI, <2 ms wake latency, and <95 MB idle RAM on 512 MB devices. The current - Design targets are keypad-first 240x320 UI, <2 ms wake latency, and <95 MB idle RAM on 512 MB devices. The current
public release is `a1120` / `cocojamboo`; `scripts/version.sh` and `scripts/check-rebuild.sh` are authoritative. public release is `a1120` / `cocojamboo` and the upcoming target build is `a1125` / `ampere`; `scripts/version.sh` and
`scripts/check-rebuild.sh` are authoritative.
## Source of truth and workflow ## Source of truth and workflow
@@ -30,12 +31,12 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
- Rootfs/image tools are `scripts/bootstrap-rootfs.sh`, `scripts/apply-bananarchy-overlay.sh`, - Rootfs/image tools are `scripts/bootstrap-rootfs.sh`, `scripts/apply-bananarchy-overlay.sh`,
`scripts/compile-gsettings-schemas.sh`, `rebuild-image.sh`, `scripts/sync-beatles-bootfs.py --check`, `scripts/compile-gsettings-schemas.sh`, `rebuild-image.sh`, `scripts/sync-beatles-bootfs.py --check`,
`prepare-release.sh`, and `flash-edl.sh`. `prepare-release.sh`, and `flash-edl.sh`.
- Rebuild the target images for `a1120` / `cocojamboo` with - Rebuild the target images for upcoming build `a1125` / `ampere` with
`BANANARCHY_VERSION=a1120 BANANARCHY_CODENAME=cocojamboo ./rebuild-image.sh nokia-argon --mkinitfs`, `BANANARCHY_VERSION=a1125 BANANARCHY_CODENAME=ampere ./rebuild-image.sh nokia-argon --mkinitfs`,
`BANANARCHY_VERSION=a1120 BANANARCHY_CODENAME=cocojamboo ./rebuild-image.sh nokia-beatles --mkinitfs`, `BANANARCHY_VERSION=a1125 BANANARCHY_CODENAME=ampere ./rebuild-image.sh nokia-beatles --mkinitfs`,
`BANANARCHY_VERSION=a1120 BANANARCHY_CODENAME=cocojamboo ./rebuild-image.sh nokia-coconut --mkinitfs`, and `BANANARCHY_VERSION=a1125 BANANARCHY_CODENAME=ampere ./rebuild-image.sh nokia-coconut --mkinitfs`, and
`BANANARCHY_VERSION=a1120 BANANARCHY_CODENAME=cocojamboo ./rebuild-image.sh nokia-sparkler --mkinitfs`, and package `BANANARCHY_VERSION=a1125 BANANARCHY_CODENAME=ampere ./rebuild-image.sh nokia-sparkler --mkinitfs`, and package
release archives with `BANANARCHY_VERSION=a1120 BANANARCHY_CODENAME=cocojamboo ./prepare-release.sh <target>`. After a release archives with `BANANARCHY_VERSION=a1125 BANANARCHY_CODENAME=ampere ./prepare-release.sh <target>`. After a
verified rebuild, update the pinned hashes in `scripts/check-rebuild.sh` and `CHANGELOG.md`; verify with `e2fsck -fn`, verified rebuild, update the pinned hashes in `scripts/check-rebuild.sh` and `CHANGELOG.md`; verify with `e2fsck -fn`,
`debugfs`, bootfs sync, artifact sync, and `check-rebuild.sh`. `debugfs`, bootfs sync, artifact sync, and `check-rebuild.sh`.
- Do not push to `origin` unless explicitly requested. Do not update pinned hashes or release claims without actual - Do not push to `origin` unless explicitly requested. Do not update pinned hashes or release claims without actual
@@ -111,7 +112,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
- Keep standby battery invariants from `0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch` and - Keep standby battery invariants from `0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch` and
`bananarchy-power-policy.conf`: `CPU_RPM_SLEEP=0`, `CPU_L2_SLEEP=0`, `MODEM_DRX_MODE=0`, `WIFI_LISTEN_INTERVAL=8`, `bananarchy-power-policy.conf`: `CPU_RPM_SLEEP=0`, `CPU_L2_SLEEP=0`, `MODEM_DRX_MODE=0`, `WIFI_LISTEN_INTERVAL=8`,
`WIFI_STANDBY_RAT=gsm`, `msm8916-wcd-analog` `s2` gating, `pm8916_bms_vm` `screen_off` S3 OCV mode, `sdhci-msm` `WIFI_STANDBY_RAT=gsm`, `msm8916-wcd-analog` `s2` gating, `pm8916_bms_vm` `screen_off` S3 OCV mode, `sdhci-msm`
`vmmc`/`vqmmc` `set_load` (`200 mA` / `20 mA` HPM in `sdhci_msm_register_vreg()`, `sdhci_msm_set_vmmc()`, `msm_toggle_vqmmc()`, and `sdhci_msm_runtime_resume()`; `2 mA` / `0 mA` LPM in `sdhci_msm_runtime_suspend()`, paired with `regulator-allow-set-load;` on `l8`/`l11`/`l12` across DTS/DTBs and no static `regulator-system-load` on `l11`), and `msm8905-cam.c` RPM `l6`/`l17` `vmmc`/`vqmmc` `set_load` (`200 mA` / `20 mA` HPM in `sdhci_msm_register_vreg()`, `sdhci_msm_set_vmmc()`, `msm_toggle_vqmmc()`, and `sdhci_msm_runtime_resume()`; `2 mA` / `0 mA` LPM in `sdhci_msm_runtime_suspend()`, paired with `regulator-allow-set-load;` on `l8`/`l11`/`l12` across DTS/DTBs and no static `regulator-system-load` on `l11`), removable-SD-only `MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE` in `sdhci_msm_probe()` (guarded against `mmc0` / `8-bit` / `no-sd` / `HS200`/`HS400`), `qcom_q6v5_mss` `"mem"` in `proxy_clk_names`, `gcc_mss_q6_bimc_axi_clk` on `gcc_xo_data` with bootloader `0x45000 BIT(2)` cleared in `gcc_msm8909_probe()`, `opp-99999975` (`100 MHz` dark floor) across `qcom-msm8909.dtsi` and all 6 DTS files, and `msm8905-cam.c` RPM `l6`/`l17`
regulator consumer voting (`regulator_get_optional`, never raw APSS SPMI writes on RPM LDOs). regulator consumer voting (`regulator_get_optional`, never raw APSS SPMI writes on RPM LDOs).
- Keep the zero-lag plugin model: preloaded resident daemons guarded by lock/FIFO, `poll()` at 0% CPU, offscreen - Keep the zero-lag plugin model: preloaded resident daemons guarded by lock/FIFO, `poll()` at 0% CPU, offscreen
`240x296` Pixmaps at `Y=24`, `PluginTheme`, `RELOAD_THEME`, idle blank/lock helpers, the 350 ms `dwm` wake guard, and `240x296` Pixmaps at `Y=24`, `PluginTheme`, `RELOAD_THEME`, idle blank/lock helpers, the 350 ms `dwm` wake guard, and
@@ -175,7 +176,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
keypad udev/Xorg rules, BusyBox applet lists, and `scripts/set-bananarchy-hostname.sh`. keypad udev/Xorg rules, BusyBox applet lists, and `scripts/set-bananarchy-hostname.sh`.
- The Power menu label is **Reboot to loader** and still calls `sxmo_power.sh bootloader`; `Logout` is removed from - The Power menu label is **Reboot to loader** and still calls `sxmo_power.sh bootloader`; `Logout` is removed from
`dmenu.c`, `dmenu.so`, `sxmo_appmenu.sh`, and `sxmo_hook_contextmenu.sh`. Keep the compact Power menu layout synchronized. `dmenu.c`, `dmenu.so`, `sxmo_appmenu.sh`, and `sxmo_hook_contextmenu.sh`. Keep the compact Power menu layout synchronized.
- Keep `quagr` (`quagr.so` / `xquagr`) receiver autostart strictly gated on `autostart_rx=1` plus a valid Rx passphrase or 64-char hex key, closed-flip `QUAGR` cover alerts dismissing on any side button (`scripts/test-quagr.py`), `msm8905-cam.c` 180-degree rotation enabled for `nokia,beatles`, `nokia,sparkler`, and `nokia,leo` alongside cached `row_buf` RAW10 demosaic; keep `patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch` (4-core SMP + `cpufreq` up to `1.267 GHz`), disabled `vibrator@c000` + volume-independent calibrated `157.0 Hz` haptic audio (`sxmo_vibrate.c`, `libpulse` + `SND_PCM_FORMAT_FLOAT_LE`, `HAPTIC_REF_RX3_VOL = 84`), `DEFAULT_USB_TIMEOUT_MS = 30000` (`--usb-timeout`), and `sxmo_timer.sh` / `dmenu.c` keypad cancellation (`scripts/test-timer.py`, `scripts/test-sparkler-port.py`, `scripts/test-edl-firehose-read.py`, `scripts/test-quagr.py`). - Keep `quagr` (`quagr.so` / `xquagr`) receiver autostart strictly gated on `autostart_rx=1` plus a valid Rx passphrase or 64-char hex key, closed-flip `QUAGR` cover alerts dismissing on any side button (`scripts/test-quagr.py`), `msm8905-cam.c` 180-degree rotation enabled for `nokia,beatles`, `nokia,sparkler`, and `nokia,leo` alongside cached `row_buf` RAW10 demosaic; keep `patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch` (4-core SMP + `cpufreq` up to `1.267 GHz`), `patches/kernel/0014-input-core-keypad-debouncer.patch` (ABI-preserving `input_core` `/sys/module/input_core/parameters/key_debounce_ms` debouncer without editing `include/linux/input.h`, `pm8941-pwrkey` chatter holdoff, `col-scan-delay-us = <0x32>` across all 6 DTS/DTBs, `xset r rate 300 25`, `scripts/test-keypad-debouncer.py`), disabled `vibrator@c000` + volume-independent calibrated `157.0 Hz` haptic audio (`sxmo_vibrate.c`, `libpulse` + `SND_PCM_FORMAT_FLOAT_LE`, `HAPTIC_REF_RX3_VOL = 84`), Sparkler/Leo `157 Hz` LRA media filtering (`highpass=f=260` + `bandreject=f=157` on Speaker + non-speaker `RX3` zeroing in `music.so`, `files.so`, `ringtones.so`, `sxmo_audio.sh`, and Sparkler-only `/etc/mpv/mpv.conf` via `apply-bananarchy-overlay.sh`), `DEFAULT_USB_TIMEOUT_MS = 30000` (`--usb-timeout`), and `sxmo_timer.sh` / `dmenu.c` keypad cancellation (`scripts/test-timer.py`, `scripts/test-sparkler-port.py`, `scripts/test-edl-firehose-read.py`, `scripts/test-quagr.py`).
- Bluetooth HOGP config and plugin load are verified, but full hardware sign-off still needs a wake-up paired keyboard - Bluetooth HOGP config and plugin load are verified, but full hardware sign-off still needs a wake-up paired keyboard
and **Connect Device** to confirm real HID key events. and **Connect Device** to confirm real HID key events.
+23
View File
@@ -1634,3 +1634,26 @@ After integrating the `a1120` 4-core SMP/cpufreq patch (`0013`), IMS/VoLTE/VoWiF
5. **Dark-screen NetworkManager status spawner (`30-bananarchy-network-status.sh`)**: 5. **Dark-screen NetworkManager status spawner (`30-bananarchy-network-status.sh`)**:
- Every `dhcp4-change`, `dhcp6-change`, `dns-change`, or `connectivity-change` event spawned `su user -s /bin/sh -c /usr/bin/bananarchy-network-event.sh` even when dark. - Every `dhcp4-change`, `dhcp6-change`, `dns-change`, or `connectivity-change` event spawned `su user -s /bin/sh -c /usr/bin/bananarchy-network-event.sh` even when dark.
- **Fix**: Gated noisy change events in `30-bananarchy-network-status.sh` behind `is_screen_dark()` while keeping `up`/`down`/`vpn-*` transitions unconditional. - **Fix**: Gated noisy change events in `30-bananarchy-network-status.sh` behind `is_screen_dark()` while keeping `up`/`down`/`vpn-*` transitions unconditional.
## 25. Live Nokia 2720 Hardware Audit: <48h Regression Root Causes & Fixes (2026-11-23)
Live telemetry collected from a flashed `a1120` `nokia-beatles` unit running DSDS + Wi-Fi ON + a 128 GB UHS-I `SDR104` microSD card measured well over `31 mA` (`<48 h` standby) and pinpointed six remaining hardware/userspace drains:
1. **Bluetooth powered ON out-of-the-box (`~5-10 mA`)**:
- `scripts/bootstrap-rootfs-container.sh` enabled `bluetooth` in the OpenRC `default` runlevel. On a fresh rootfs without an existing `/var/lib/rfkill` block state, `hci0` booted unblocked, so `sxmo_hook_start.sh` observed `sxmo_bluetoothtoggle.sh status == "on"` and launched `bananarchy-bt-obex`, `[krfcommd]`, and `bluetoothd` with `bredr + le + pairable on` (`PairableTimeout = 0`).
- **Fix**: Removed `bluetooth` from `enable_service default` in `scripts/bootstrap-rootfs-container.sh` and added `rm -f "$TARGET_ROOTFS/etc/runlevels/default/bluetooth"` in `scripts/apply-bananarchy-overlay.sh`; persisted explicit user intent in `/home/user/.config/sxmo/bt_enabled` from `sxmo_bluetoothtoggle.sh` (`on()`/`off()`); enforced `rfkill block bluetooth` and service stop in `/etc/local.d/10-power-save.start` when `bt_enabled` is unset; and switched all three `sxmo_hook_start.sh` copies to check `bt_enabled` instead of raw `rfkill` status.
2. **microSD (`mmc1`) `SDR104` `vmmc`/`vqmmc` kept active 24/7 (`~6-12 mA`)**:
- `sdhci@7864000` (`mmc1`) lacked `MMC_CAP_AGGRESSIVE_PM` (`caps = 0x405f030f`), causing `mmc_sd_runtime_suspend()` to return `0` without powering off the card. While idle, PM8909 `L11` (`2.9 V`, `0x4a46=0x80`) and `L12` (`1.8 V`, `0x4b46=0x80`, `0x4b45=0x80` NPM) stayed active continuously with an `SDR104` card in `tran` state.
- **Fix**: Extended `patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch` (`drivers/mmc/host/sdhci-msm.c`) to set `MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE` exclusively on non-`mmc0`, non-8-bit, SD-capable hosts (`of_alias_get_id(node, "mmc") != 0 && !(caps & MMC_CAP_8_BIT_DATA) && !(caps2 & (MMC_CAP2_NO_SD | MMC_CAP2_HS200_1_8V_SDR | MMC_CAP2_HS400_1_8V))`), leaving rootfs eMMC `mmc0` (`sdhci@7824000`, which omits `no-sd;` in DTS) strictly excluded while powering off both `L11` and `L12` during removable microSD idle.
3. **Modem `qcom_q6v5_mss` pinning `BIMC_PLL` and `gcc_boot_rom_ahb_clk` on APSS (`~3-6 mA`)**:
- `4080000.remoteproc` (`msm8909_mss` / `msm8916_mss`) kept `"mem"` (`gcc_boot_rom_ahb_clk`) in `.active_clk_names` indefinitely and enabled `gcc_mss_q6_bimc_axi_clk`, whose clock parent `&bimc_ddr_clk_src -> bimc_pll -> bimc_pll_early` held APSS `GCC_APCS_GPLL_ENA_VOTE` (`0x45000` `BIT(2)`) asserted 24/7.
- **Fix**: Updated `0012` across `drivers/remoteproc/qcom_q6v5_mss.c` (moving `"mem"` from `.active_clk_names` into `.proxy_clk_names` released at `qcom_msa_handover()`) and `drivers/clk/qcom/gcc-msm8909.c` (re-parenting `gcc_mss_q6_bimc_axi_clk` to `gcc_xo_data`, adding `CLK_GET_RATE_NOCACHE` to `pcnoc_bfdcd_clk_src` and `system_noc_bfdcd_clk_src`, and clearing the bootloader APSS `BIT(2)` vote in `gcc_msm8909_probe()`).
4. **Dark-screen CPU/L2/SCU `powersave` floor stuck at `200 MHz` (`~2-3 mA`)**:
- With `CPU_L2_SLEEP=0` (`L2_ON`), `powersave` kept Cortex-A7 + shared L2/SCU clocked at `199,999,951 Hz` (`gpll0 / 4`).
- **Fix**: Added `opp-99999975` (`99,999,975 Hz` = `gpll0 / 8`, `hid_div = 15`, supported directly by the 5-bit `apcs-msm8916` mux-divider) to `qcom-msm8909.dtsi` in `0012` and to all 6 standalone `devices/*/*.dts` OPP tables, cutting dark-screen CPU/L2 clock power in half while preserving `schedutil` peak boost rates (`1.094` / `1.267 GHz`).
5. **Wi-Fi IPv6 link-local/MLDv2 background traffic & post-`_park_rat` DSDS hysteresis (`~2-4 mA`)**:
- NetworkManager Wi-Fi profiles defaulted to `ipv6.method=auto`, overriding `net.ipv6.conf.default.disable_ipv6=1` and leaving `fe80::` link-local + `kworker/R-mld` active on `wlan0`; separately, `park_wifi_rat()` in `bananarchy-power-policy.sh` switched Primary GW from UMTS to GSM 45 s after `screenoff` without re-sending `bananarchy-dsds --sig-hysteresis dark` for the newly camped RAT.
- **Fix**: Added `ipv6.method=ignore` under `[connection]` in `10-power.conf` (keeping `wifi.scan-interval` absent); extended `mute_wifi_ipv6_ra()` / `restore_wifi_ipv6_ra()` in `bananarchy-power-policy.sh` to toggle `BANANARCHY_DISABLE_IPV6_PATH` (`wlan0/disable_ipv6`) when `VOWIFI_ACTIVE && VOWIFI_IPV6_EPDG` is inactive; and invoked `"$DSDS_BIN" --sig-hysteresis dark` after `: > "$RAT_PARKED"` in `park_wifi_rat()`.
6. **Desktop `superd` `pipewire` / `wireplumber` startup race**:
- Checking `pidof -s pipewire` matched unmanaged/pulse instances, leaving `superctl status pipewire` as `failed` and `wireplumber` as `stopped`.
- **Fix**: Updated all three `sxmo_hook_start.sh` copies to verify `superctl status pipewire`, clean up stale unmanaged `pipewire` PIDs and socket/lock files before starting `pipewire` under `superd`, and retry `superctl start wireplumber` if `stopped`.
+17 -9
View File
@@ -12,7 +12,9 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
--- ---
## Unreleased ## Upcoming build `a1125` — codename `ampere`
Upcoming release build (`a1125` / `ampere` via `scripts/version.sh`) targeting **Nokia 8110 4G (`nokia-argon`)**, **Nokia 2720 Flip (`nokia-beatles`)**, **Nokia 800 Tough (`nokia-coconut`)**, and **Nokia 8000 4G (`nokia-sparkler`)** while keeping `a1120` (`cocojamboo`) as the current published release.
### Cellular PS attach, Dual-SIM QMI WDS subscription binding (`libmm-wds-bind.so`), and mobile data (`wwan0`) fixes across all targets ### Cellular PS attach, Dual-SIM QMI WDS subscription binding (`libmm-wds-bind.so`), and mobile data (`wwan0`) fixes across all targets
@@ -33,16 +35,22 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
- **IMS Combined EPS/IMSI detection, QRTR idle sleep, and VoWiFi backoff (`src/bananarchy-daemons/ims_qrtr.h`, `bananarchy-imsd.c`, `src/dwm-plugins/bananarchy_vowifi.cpp`, `overlay/rootfs/etc/NetworkManager/dispatcher.d/40-bananarchy-ims.sh`)**: inspected TLV `0x01` `cs_attach` in `ims_qmi_nas_get_serving()` (plus PS-attach/registered checks) so standard Combined EPS/IMSI (`cs_attach == 1`) LTE+CSFB cells stay `NETWORK_4G_ONLY=0` under `volte_mode=auto` / `vowifi_mode=auto` rather than keeping VoLTE/VoWiFi active and blocking GSM Wi-Fi standby RAT parking; added `close_qrtr()` when idle, deduplicated `ims_state_write()` updates via `ims_state_equal()`, bounded child sync/check retries so `bananarchy-imsd` returns to `poll(..., -1)` instead of waking every `2,000 ms`, skipped NAS QRTR probes on Wi-Fi events while parked or inactive, skipped `40-bananarchy-ims.sh` `dhcp4-change` / `dhcp6-change` / `connectivity-change` notifications when both `VOLTE_ACTIVE` and `VOWIFI_ACTIVE` are `0`, guarded `openCtlSocket()` rebinds in `bananarchy-vowifi`, and replaced its `1.5 s` / `10 s` retry storm with capped exponential backoff (`5 s` to `300 s`). - **IMS Combined EPS/IMSI detection, QRTR idle sleep, and VoWiFi backoff (`src/bananarchy-daemons/ims_qrtr.h`, `bananarchy-imsd.c`, `src/dwm-plugins/bananarchy_vowifi.cpp`, `overlay/rootfs/etc/NetworkManager/dispatcher.d/40-bananarchy-ims.sh`)**: inspected TLV `0x01` `cs_attach` in `ims_qmi_nas_get_serving()` (plus PS-attach/registered checks) so standard Combined EPS/IMSI (`cs_attach == 1`) LTE+CSFB cells stay `NETWORK_4G_ONLY=0` under `volte_mode=auto` / `vowifi_mode=auto` rather than keeping VoLTE/VoWiFi active and blocking GSM Wi-Fi standby RAT parking; added `close_qrtr()` when idle, deduplicated `ims_state_write()` updates via `ims_state_equal()`, bounded child sync/check retries so `bananarchy-imsd` returns to `poll(..., -1)` instead of waking every `2,000 ms`, skipped NAS QRTR probes on Wi-Fi events while parked or inactive, skipped `40-bananarchy-ims.sh` `dhcp4-change` / `dhcp6-change` / `connectivity-change` notifications when both `VOLTE_ACTIVE` and `VOWIFI_ACTIVE` are `0`, guarded `openCtlSocket()` rebinds in `bananarchy-vowifi`, and replaced its `1.5 s` / `10 s` retry storm with capped exponential backoff (`5 s` to `300 s`).
- **Display/lockscreen/cover power-policy sync & idempotency (`overlay/rootfs/usr/bin/bananarchy-display-power-sync`, `bananarchy-power-policy.sh`, `src/dwm-plugins/locker_plugin.cpp`, `30-bananarchy-network-status.sh`)**: synced `CPU_GOV_PATH` (`powersave` when dark or cover-lit, `schedutil` on interactive wake) and `sync_standby_policy()` across both flip and non-flip branches of `bananarchy-display-power-sync`, wired `blankScreenBacklight()` / `wakeScreenBacklight()` in `locker.so` to `/usr/bin/bananarchy-power-policy.sh screenoff|screenon`, made `screenoff()`, `screenon()`, and `arm_rat_park_timer()` idempotent via `$RUNDIR/standby.mode` and `$RUNDIR/rat_timer.pid` across dark/cover-lit/dark cycles, and suppressed `30-bananarchy-network-status.sh` `su user` spawns for noisy `dhcp4-change` / `dhcp6-change` / `dns-change` / `connectivity-change` events while dark. - **Display/lockscreen/cover power-policy sync & idempotency (`overlay/rootfs/usr/bin/bananarchy-display-power-sync`, `bananarchy-power-policy.sh`, `src/dwm-plugins/locker_plugin.cpp`, `30-bananarchy-network-status.sh`)**: synced `CPU_GOV_PATH` (`powersave` when dark or cover-lit, `schedutil` on interactive wake) and `sync_standby_policy()` across both flip and non-flip branches of `bananarchy-display-power-sync`, wired `blankScreenBacklight()` / `wakeScreenBacklight()` in `locker.so` to `/usr/bin/bananarchy-power-policy.sh screenoff|screenon`, made `screenoff()`, `screenon()`, and `arm_rat_park_timer()` idempotent via `$RUNDIR/standby.mode` and `$RUNDIR/rat_timer.pid` across dark/cover-lit/dark cycles, and suppressed `30-bananarchy-network-status.sh` `su user` spawns for noisy `dhcp4-change` / `dhcp6-change` / `dns-change` / `connectivity-change` events while dark.
- **QMI NAS signal hysteresis wire-protocol fix (`src/bananarchy-daemons/bananarchy-dsds.c`)**: corrected `apply_sig_hysteresis()` from wrong opcodes `0x006F` (`4`-byte sub) and `0x004F` (`GET_SIGNAL_INFO`) + TLV `0x13` to `QMI_NAS_BIND_SUBSCRIPTION` (`0x0045`, `1`-byte TLV `0x01`) and `QMI_NAS_CONFIG_SIGNAL_INFO` (`0x0050`) with `RSSI` (`0x10`), WCDMA `RSCP` (`0x18`), LTE `RSRP` (`0x16`, 16-bit LE), and `lte_report` (`0x17`, `rate=0`, `avg=5 s` dark / `1 s` wake) verified against `libqmi-glib.so.5.12.0`, suppressing minor standby RF fluctuations from waking APSS over QRTR. - **QMI NAS signal hysteresis wire-protocol fix (`src/bananarchy-daemons/bananarchy-dsds.c`)**: corrected `apply_sig_hysteresis()` from wrong opcodes `0x006F` (`4`-byte sub) and `0x004F` (`GET_SIGNAL_INFO`) + TLV `0x13` to `QMI_NAS_BIND_SUBSCRIPTION` (`0x0045`, `1`-byte TLV `0x01`) and `QMI_NAS_CONFIG_SIGNAL_INFO` (`0x0050`) with `RSSI` (`0x10`), WCDMA `RSCP` (`0x18`), LTE `RSRP` (`0x16`, 16-bit LE), and `lte_report` (`0x17`, `rate=0`, `avg=5 s` dark / `1 s` wake) verified against `libqmi-glib.so.5.12.0`, suppressing minor standby RF fluctuations from waking APSS over QRTR.
- **Disabled-by-default Bluetooth, removable microSD `MMC_CAP_AGGRESSIVE_PM`, MSS/BIMC clock unpinning, `100 MHz` idle OPP, IPv6 standby mute, and `pipewire`/`wireplumber` startup race fix (`0012`, `devices/*/*.dts`, `bootstrap-rootfs-container.sh`, `apply-bananarchy-overlay.sh`, `sxmo_bluetoothtoggle.sh`, `10-power-save.start`, `sxmo_hook_start.sh`, `10-power.conf`, `bananarchy-power-policy.sh`)**: removed `bluetooth` from OpenRC `default` runlevel (`rm -f /etc/runlevels/default/bluetooth`), tracked user opt-in via `/home/user/.config/sxmo/bt_enabled`, enforced `rfkill block bluetooth` + daemon stop at boot when unset, and switched `sxmo_hook_start.sh` to check `bt_enabled`; added `MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE` in `sdhci-msm.c` strictly for removable SD hosts (excluding `mmc0` / `8-bit` / `no-sd` / `HS200`/`HS400`) so `L11`/`L12` power off during microSD idle; moved `"mem"` (`gcc_boot_rom_ahb_clk`) to `.proxy_clk_names` in `qcom_q6v5_mss.c`, re-parented `gcc_mss_q6_bimc_axi_clk` to `gcc_xo_data`, added `CLK_GET_RATE_NOCACHE` to `pcnoc_bfdcd_clk_src`/`system_noc_bfdcd_clk_src`, and cleared bootloader APSS `0x45000 BIT(2)` (`bimc_pll_early`) in `gcc_msm8909_probe()`; added `opp-99999975` (`100 MHz` = `gpll0 / 8`) across `qcom-msm8909.dtsi` and all 6 device DTS files to halve dark `powersave` L2/SCU clock draw; added `ipv6.method=ignore` in `10-power.conf`, `wlan0/disable_ipv6` standby toggling (preserving IPv6 ePDG VoWiFi), and post-`_park_rat` `--sig-hysteresis dark` in `bananarchy-power-policy.sh`; and guarded `superctl` `pipewire`/`wireplumber` startup in `sxmo_hook_start.sh`.
### System-core keypad debouncer (`0014`) and Nokia 8000 (`nokia-sparkler`) LRA vibrator isolation during media playback
- **System-core `input_core` key debouncer, PMIC release chatter guard, matrix column settle fix, and X11 repeat tuning (`0014-input-core-keypad-debouncer.patch`, `devices/*/*.dts`, `10-power-save.start`, `bananarchy-x11-session.sh`, `scripts/test-keypad-debouncer.py`)**: added an ABI-preserving post-release chatter debouncer (`ba_filter_key_bounce`, `ba_pop_trailing_msc_scan`, `ba_clear_key_debounce_dev`) inside `drivers/input/input.c` without altering `include/linux/input.h`, exposing `/sys/module/input_core/parameters/key_debounce_ms` (booting to `55 ms` on `nokia-argon`/`nokia-sparkler`/`nokia-leo`, `45 ms` on `nokia-beatles`/`nokia-coconut`, overrideable in `/etc/bananarchy/key-debounce.conf`) with `0 ms` press/release latency and bypassing `BUS_VIRTUAL`, `BUS_BLUETOOTH`, `BUS_USB`, and pointer buttons; added symmetric press + `45 ms` post-release chatter holdoff in `pm8941-pwrkey.c`; replaced ignored KaiOS `col-scan-delay-ms` with `col-scan-delay-us = <0x32>` (`50 us`) and raised `gpio-matrix-keypad` / `gpio-keys` debounce intervals across all 6 DTS/DTB files (`18 ms` / `25 ms` on `argon`/`sparkler`/`leo`; `14 ms` / `20 ms` on `beatles`/`coconut`); raised `xset r rate` from `180 30` to `300 25` to eliminate short-press auto-repeat doubles; and added offline C/DTS verification in `scripts/test-keypad-debouncer.py`.
- **Nokia 8000 4G (`nokia-sparkler`) media player LRA isolation (`music_plugin.cpp`, `files_plugin.cpp`, `ringtones_plugin.cpp`, `sxmo_audio.sh`, `scripts/apply-bananarchy-overlay.sh`, `scripts/test-sparkler-port.py`)**: isolated `xmusic` (`music.so` dynamic IPC `af` switching + `AUDIO_ROUTE` FIFO notification), `xfiles` / `xringtones` previews, and standalone `mpv` (`/etc/mpv/mpv.conf` installed per-target on `nokia-sparkler` and `nokia-leo` only) from the `157 Hz` speaker-LRA band (`highpass=f=260` 4th-order + `bandreject=f=157`) when outputting via `Speaker`, while preserving full bass on `Headphones` and `Bluetooth` and explicitly zeroing `RX3 MIX1 INP1` (`'ZERO'`) / `SPK DAC Switch` (`0`) across `Earpiece`, `Headphones`, and `Bluetooth` routes in `sxmo_audio.sh`, `files_plugin.cpp`, and `ringtones_plugin.cpp`.
- **microSD PM8909 `l11` static `200 mA` load removal & `sdhci-msm` probe/active HPM + standby LPM `set_load` (`patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch`, `devices/*/*.dts`, `prebuilt/kernel-6.12.1-msm8916/`)**: removed static `regulator-system-load = <0x30d40>;` from PM8909 `l11` across all 6 DTS files while extending `sdhci-msm.c` (`sdhci_msm_register_vreg()`, `sdhci_msm_set_vmmc()`, `msm_toggle_vqmmc()`, `sdhci_msm_runtime_resume()`, `sdhci_msm_runtime_suspend()`) and rebuilding `vmlinuz`/modules/DTBs so microSD probe and UHS-I tuning receive full `200 mA` / `20 mA` HPM without brownout (`-5`/`-110`) and idle runtime suspend drops `vmmc`/`vqmmc` to `2 mA`/`0 mA` PM8909 LPM. - **microSD PM8909 `l11` static `200 mA` load removal & `sdhci-msm` probe/active HPM + standby LPM `set_load` (`patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch`, `devices/*/*.dts`, `prebuilt/kernel-6.12.1-msm8916/`)**: removed static `regulator-system-load = <0x30d40>;` from PM8909 `l11` across all 6 DTS files while extending `sdhci-msm.c` (`sdhci_msm_register_vreg()`, `sdhci_msm_set_vmmc()`, `msm_toggle_vqmmc()`, `sdhci_msm_runtime_resume()`, `sdhci_msm_runtime_suspend()`) and rebuilding `vmlinuz`/modules/DTBs so microSD probe and UHS-I tuning receive full `200 mA` / `20 mA` HPM without brownout (`-5`/`-110`) and idle runtime suspend drops `vmmc`/`vqmmc` to `2 mA`/`0 mA` PM8909 LPM.
- **Offline verification (`scripts/test-imsd-volte.py`, `scripts/test-standby-power-policy.py`, `scripts/check-rebuild.sh`, `BATTERY-OPTIMIZATION-ANALYSIS.md`)**: added host regression tests for Combined EPS/IMSI (`cs_attach=1`), `searching_lte`, and 0-packet `2.2 s` QRTR idle silence in `test-imsd-volte.py`; added host tests for `CPU_GOV_PATH` + idempotent `screenoff`/`screenon` across dark/cover-lit/open, `standby.mode`/`rat_timer.pid`, `bananarchy-dsds --sig-hysteresis` QMI `0x0045`/`0x0050` wire framing over `AF_UNIX` `SOCK_SEQPACKET`, and `30-bananarchy-network-status.sh` dark gating in `test-standby-power-policy.py`; guarded DTS/DTBs against `regulator-system-load` in `check-rebuild.sh`; and documented Section 24 in `BATTERY-OPTIMIZATION-ANALYSIS.md`. - **Offline verification (`scripts/test-imsd-volte.py`, `scripts/test-standby-power-policy.py`, `scripts/check-rebuild.sh`, `BATTERY-OPTIMIZATION-ANALYSIS.md`)**: added host regression tests for Combined EPS/IMSI (`cs_attach=1`), `searching_lte`, and 0-packet `2.2 s` QRTR idle silence in `test-imsd-volte.py`; added host tests for `CPU_GOV_PATH` + idempotent `screenoff`/`screenon` across dark/cover-lit/open, `standby.mode`/`rat_timer.pid`, `bananarchy-dsds --sig-hysteresis` QMI `0x0045`/`0x0050` wire framing over `AF_UNIX` `SOCK_SEQPACKET`, and `30-bananarchy-network-status.sh` dark gating in `test-standby-power-policy.py`; guarded DTS/DTBs against `regulator-system-load` in `check-rebuild.sh`; and documented Section 24 in `BATTERY-OPTIMIZATION-ANALYSIS.md`.
- **Rebuilt local image SHA-256 checksums (`--mkinitfs`, no release `.zip` archives built yet)**: - **Rebuilt local `a1125` (`ampere`) image SHA-256 checksums (`--mkinitfs`, no release `.zip` archives built yet)**:
- `images/bananarchy-nokia-argon.img`: `4f72a1156a2e9144386d82f10fc8078e90c69ed60446d0259dfbdf66362f47bc` - `images/bananarchy-nokia-argon.img`: `a0a02a8502736fae9c25de54cb8043231b2fd3ac488e123676cc8c3a35577ea1`
- `images/bananarchy-nokia-beatles.img`: `ac29427c8582049bc5fbaa504685442a997e260eb3f74d7b92d5b999f0f4a4fa` - `images/bananarchy-nokia-beatles.img`: `9703ab732bac535ad83862a89c71931a4c16704b685f1bca45c23d7ac066c341`
- `images/boot-bananarchy-nokia-beatles.img`: `35aa314d1d21a401412794820416c21d1d22457671489dcf05410d39daf9f7da` - `images/boot-bananarchy-nokia-beatles.img`: `7eab3dcf44ba01f044e9b6dba3f786aebe80a3380884966e6ecd5dafc455c16a`
- `images/bananarchy-nokia-coconut.img`: `d7bcfffdc33fefa12f173b4b3664ae02ecb4850b9f7ccf096719f2d19a799772` - `images/bananarchy-nokia-coconut.img`: `5158dc6e545c975387ba29c44593afe2758a4cd926e0c43df90e8b79b72a6b37`
- `images/boot-bananarchy-nokia-coconut.img`: `8ffc67df915d27b286aaf0d82186f2d52719d27c67f954f7abafbd206331efc1` - `images/boot-bananarchy-nokia-coconut.img`: `d79b51d86344441f170b1ddf205b721b54ce8c995a66bb611670065911768347`
- `images/bananarchy-nokia-sparkler.img`: `d3da5d807c8c53c4c6e153fa3a03155ec2d9e1a854ba29ed18d61dba77fb0174` - `images/bananarchy-nokia-sparkler.img`: `90ff40226f344d280b7a9cca1d23fb587cc987255c375b57969b3fd415c786b4`
- `images/boot-bananarchy-nokia-sparkler.img`: `b46341849e509e71272a946829d3742881dbdb8ed33a58f6a6316288cbb8bb36` - `images/boot-bananarchy-nokia-sparkler.img`: `4e1ddbfd5acc8335cb3e3e50b3fef46b9c6fe93afdaa9c2c0826500e63b60adf`
--- ---
+6 -1
View File
@@ -237,7 +237,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
15. **Music and tracker module player (`music.so` / `xmusic` / `xplayer`)**: 15. **Music and tracker module player (`music.so` / `xmusic` / `xplayer`)**:
- **Open**: select **Music** from the System, Applications, or Audio menu, open any audio/tracker file from **Files (`xfiles`)**, or run `xmusic [file_or_dir]`. - **Open**: select **Music** from the System, Applications, or Audio menu, open any audio/tracker file from **Files (`xfiles`)**, or run `xmusic [file_or_dir]`.
- **Supported formats**: plays standard audio (`.wav`, `.mp3`, `.ogg`, `.flac`, `.opus`, `.m4a`, `.aac`) as well as classic chiptune/tracker modules (`.mod`, `.xm`, `.it`, `.s3m`, `.mptm`, `.stm`, `.med`, `.okt`, `.669`, `.ult`, `.far`, `.mtm`, `.ptm`, `.amf`, `.dsm`, `.imf`, `.gdm`, `.stx`, `.umx`, `.mo3`) via an embedded `mpv` + `FFmpeg` + `libopenmpt` backend that automatically pauses on incoming calls. - **Supported formats**: plays standard audio (`.wav`, `.mp3`, `.ogg`, `.flac`, `.opus`, `.m4a`, `.aac`) as well as classic chiptune/tracker modules (`.mod`, `.xm`, `.it`, `.s3m`, `.mptm`, `.stm`, `.med`, `.okt`, `.669`, `.ult`, `.far`, `.mtm`, `.ptm`, `.amf`, `.dsm`, `.imf`, `.gdm`, `.stx`, `.umx`, `.mo3`) via an embedded `mpv` + `FFmpeg` + `libopenmpt` backend that automatically pauses on incoming calls. On **Nokia 8000 4G (`nokia-sparkler`)** and **Nokia 6300 4G (`nokia-leo`)**, where speaker and haptic feedback share the `157 Hz` LRA transducer (`RX3`), loudspeaker playback automatically applies a `260 Hz` high-pass + `157 Hz` notch filter (`highpass=f=260`, `bandreject=f=157`) so bass frequencies do not rattle the vibrator, while full-range bass is restored whenever switching to **Headphones** or **Bluetooth**.
- **Three tabs (`1:Player`, `2:Queue`, `3:Files` — switch with `1`–`3` or `Left`/`Right` in Queue/Files)**: - **Three tabs (`1:Player`, `2:Queue`, `3:Files` — switch with `1`–`3` or `Left`/`Right` in Queue/Files)**:
- **`1:Player`**: displays format badge (`MOD`, `XM`, `MP3`, etc.), scrolling track title, artist/metadata, animated equalizer bars, elapsed/total progress bar, repeat mode (`Off`, `All`, `One`), shuffle state, and volume. Press `Return` or `5` to **Play/Pause**, `Left`/`Right` (`4`/`6`) to **Seek `-5s`/`+5s`**, `Up`/`Down` (`2`/`8`) to adjust **Volume**, `7`/`9` for **Prev/Next track**, `*` to cycle **Repeat**, `#` to toggle **Shuffle**, `0` to **Stop**, or **Left softkey (`Options`)** to install the current track as the phone ringtone. - **`1:Player`**: displays format badge (`MOD`, `XM`, `MP3`, etc.), scrolling track title, artist/metadata, animated equalizer bars, elapsed/total progress bar, repeat mode (`Off`, `All`, `One`), shuffle state, and volume. Press `Return` or `5` to **Play/Pause**, `Left`/`Right` (`4`/`6`) to **Seek `-5s`/`+5s`**, `Up`/`Down` (`2`/`8`) to adjust **Volume**, `7`/`9` for **Prev/Next track**, `*` to cycle **Repeat**, `#` to toggle **Shuffle**, `0` to **Stop**, or **Left softkey (`Options`)** to install the current track as the phone ringtone.
- **`2:Queue`**: browse the active playlist queue, filter with `0`–`9`, press `Return` to jump to a track, `*` to remove a track, `#` to shuffle, or **Left softkey (`Actions`)** to set the selected track as ringtone or clear the queue. - **`2:Queue`**: browse the active playlist queue, filter with `0`–`9`, press `Return` to jump to a track, `*` to remove a track, `#` to shuffle, or **Left softkey (`Actions`)** to set the selected track as ringtone or clear the queue.
@@ -567,6 +567,11 @@ Both the rear loudspeaker (`Speaker`, with boosted `RX3 Digital Volume` for loud
sxmo_vibrate 350 2 # medium sxmo_vibrate 350 2 # medium
sxmo_vibrate 350 3 # strong sxmo_vibrate 350 3 # strong
``` ```
- **Tune physical keypad chatter debouncer (`key_debounce_ms`)**: the kernel `input_core` debouncer defaults at boot to `55 ms` on `nokia-argon`/`nokia-sparkler`/`nokia-leo` and `45 ms` on `nokia-beatles`/`nokia-coconut` (zero press/release latency; post-release dome bounce suppression). Override persistently by setting `KEY_DEBOUNCE_MS=<ms>` (`0` to disable, max `250`) in `/etc/bananarchy/key-debounce.conf`, or live via:
```bash
cat /sys/module/input_core/parameters/key_debounce_ms
echo 55 | doas tee /sys/module/input_core/parameters/key_debounce_ms
```
- **Timer countdown and keypad cancellation (`sxmo_timer.sh`)**: open **Applications -> Timer** to start a timer or stopwatch (`Stopwatch`, `1h`, `30m`..`30s`). While counting down inside the terminal, press **Center `OK` (`Enter`)**, **`0`**, **`q`**, or **`BackSpace`** to cancel cleanly; once the timer expires (bounded 30 s alert with sound, vibration, and notification), press any keypad key inside the terminal or open **System menu -> Stop Timer** (or **Applications -> Timer -> Stop Timer**) to silence and close it immediately without rebooting. - **Timer countdown and keypad cancellation (`sxmo_timer.sh`)**: open **Applications -> Timer** to start a timer or stopwatch (`Stopwatch`, `1h`, `30m`..`30s`). While counting down inside the terminal, press **Center `OK` (`Enter`)**, **`0`**, **`q`**, or **`BackSpace`** to cancel cleanly; once the timer expires (bounded 30 s alert with sound, vibration, and notification), press any keypad key inside the terminal or open **System menu -> Stop Timer** (or **Applications -> Timer -> Stop Timer**) to silence and close it immediately without rebooting.
### 5.4 Cellular modem, Dual-SIM, and QMI UIM helper ### 5.4 Cellular modem, Dual-SIM, and QMI UIM helper
+2 -1
View File
@@ -20,7 +20,8 @@
### System and hardware support ### System and hardware support
- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm **Adreno 304 (`FD304`, 96 KB GMEM)** 3D GPU acceleration (`drm/msm` + `qcom-iommu`), Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff. The kernel image is built from `config-bananarchy-msm8909.armv7` with the known-good pmaports module ABI, and ships with idle-blanking power management; `BATTERY-OPTIMIZATION-ANALYSIS.md` records the measured idle state and explains why suspend-to-RAM is unavailable on this firmware (PSCI `SYSTEM_SUSPEND` missing) and why a full custom module tree rebuild is not worthwhile. Section 17 adds the `a1108` re-analysis and two low-risk wins: the active zram swap now uses `lz4` instead of `zramstart`'s `zstd` default, and `vm.compaction_proactiveness=0` removes ~2 `kcompactd0` wakeups/s. Section 18 replaces the idle `nmcli device monitor` poller with NetworkManager dispatcher hooks and records the kernel/VFS tweaks that were A/B tested and rejected, while sections 19-21 add event-driven compiled C11 idle and autostart daemons, MSM8909 RPM interconnect bus scaling (`BIMC`/`PCNOC`/`SNOC`), live WCN3620 screen-off firmware offloads, ChipIdea USB runtime PM while unplugged, `panel-mipi-dbi` DPMS sleep, and dual-port DSDS standby power policy (with opt-in `AT$QCDRX` paging). Runtime Wi-Fi listen-interval, modem DRX and DSDS secondary-SIM power policies are configurable in `/etc/bananarchy-power-policy.conf`; see `MANUAL.md`. - **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm **Adreno 304 (`FD304`, 96 KB GMEM)** 3D GPU acceleration (`drm/msm` + `qcom-iommu`), Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff. The kernel image is built from `config-bananarchy-msm8909.armv7` with the known-good pmaports module ABI, and ships with idle-blanking power management; `BATTERY-OPTIMIZATION-ANALYSIS.md` records the measured idle state and explains why suspend-to-RAM is unavailable on this firmware (PSCI `SYSTEM_SUSPEND` missing) and why a full custom module tree rebuild is not worthwhile. Section 17 adds the `a1108` re-analysis and two low-risk wins: the active zram swap now uses `lz4` instead of `zramstart`'s `zstd` default, and `vm.compaction_proactiveness=0` removes ~2 `kcompactd0` wakeups/s. Section 18 replaces the idle `nmcli device monitor` poller with NetworkManager dispatcher hooks and records the kernel/VFS tweaks that were A/B tested and rejected, while sections 19-21 add event-driven compiled C11 idle and autostart daemons, MSM8909 RPM interconnect bus scaling (`BIMC`/`PCNOC`/`SNOC`), live WCN3620 screen-off firmware offloads, ChipIdea USB runtime PM while unplugged, `panel-mipi-dbi` DPMS sleep, and dual-port DSDS standby power policy (with opt-in `AT$QCDRX` paging). Runtime Wi-Fi listen-interval, modem DRX and DSDS secondary-SIM power policies are configurable in `/etc/bananarchy-power-policy.conf`; see `MANUAL.md`.
- **Target-correct camera orientation**: the V4L2 demosaic path rotates frames 180 degrees on `nokia-beatles`, `nokia-sparkler`, and `nokia-leo`, correcting those targets' sensor mounting directly at `/dev/video0` for the viewfinder, saved photos, and third-party V4L2 consumers without an extra frame-buffer copy, while `nokia-argon` and `nokia-coconut` retain their upright orientation. - **Target-correct camera orientation and system-core keypad debouncing**: the V4L2 demosaic path rotates frames 180 degrees on `nokia-beatles`, `nokia-sparkler`, and `nokia-leo`, correcting those targets' sensor mounting directly at `/dev/video0` for the viewfinder, saved photos, and third-party V4L2 consumers without an extra frame-buffer copy, while `nokia-argon` and `nokia-coconut` retain their upright orientation. At the kernel `input_core` layer (`0014-input-core-keypad-debouncer.patch`), a zero-latency post-release chatter debouncer (`/sys/module/input_core/parameters/key_debounce_ms`, defaulting at boot to `55 ms` on `nokia-argon`/`nokia-sparkler`/`nokia-leo` and `45 ms` on `nokia-beatles`/`nokia-coconut`), combined with `col-scan-delay-us = <50>` (`matrix_keypad`), `pm8941-pwrkey` release chatter holdoff, and `xset r rate 300 25`, suppresses mechanical dome double-presses while keeping `uinput`, Bluetooth HOGP/AVRCP, and USB HID untouched.
- **Speaker-LRA haptic isolation on Nokia 8000 4G (`nokia-sparkler`)**: on devices that drive haptics over `SPK_DRV` (`RX3`) with a 157 Hz speaker-LRA (`nokia,sparkler`, `nokia,leo`), `xmusic`, `xfiles`, `xringtones`, and standalone `mpv` dynamically notch out the 157 Hz LRA resonance (`highpass=f=260` + `bandreject=f=157`) when outputting on `Speaker` while keeping full-range bass on `Headphones` and `Bluetooth` and zeroing `RX3` on `Earpiece`/`Headphones`/`Bluetooth` (`sxmo_audio.sh`), leaving `sxmo_vibrate` (`157.0 Hz`) calibration untouched.
- **High-brightness display and reliable flip handling**: the 2720 Flip internal panel uses a live-verified 25 MHz SPI clock to prevent corruption when backlight PWM exceeds the former 71% threshold, without reducing the brightness range. The compiled lid daemon combines event-driven `EV_SW` handling with 200 ms raw-hall reconciliation, so missed edges or stale switch state cannot leave the phone awake when closed. - **High-brightness display and reliable flip handling**: the 2720 Flip internal panel uses a live-verified 25 MHz SPI clock to prevent corruption when backlight PWM exceeds the former 71% threshold, without reducing the brightness range. The compiled lid daemon combines event-driven `EV_SW` handling with 200 ms raw-hall reconciliation, so missed edges or stale switch state cannot leave the phone awake when closed.
- **Stock-signed Wi-Fi, Bluetooth, and modem firmware**: `msm-firmware-loader` mounts the phone's `modem` and `persist` partitions before udev, supplies `wcnss.mdt`, `mba.mbn`, and the device-specific WCNSS NV data to the mainline remote processors, and preserves the factory radio calibration and MAC addresses. The sysinit and boot service links are shipped explicitly so clean, `--no-scripts` image builds bring up both `wlan0`/`wcn36xx` and `hci0`/`btqcomsmd` without packaging device-specific firmware blobs. - **Stock-signed Wi-Fi, Bluetooth, and modem firmware**: `msm-firmware-loader` mounts the phone's `modem` and `persist` partitions before udev, supplies `wcnss.mdt`, `mba.mbn`, and the device-specific WCNSS NV data to the mainline remote processors, and preserves the factory radio calibration and MAC addresses. The sysinit and boot service links are shipped explicitly so clean, `--no-scripts` image builds bring up both `wlan0`/`wcn36xx` and `hci0`/`btqcomsmd` without packaging device-specific firmware blobs.
- **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box. - **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box.
Binary file not shown.
@@ -139,6 +139,14 @@
opp-shared; opp-shared;
phandle = <0x05>; phandle = <0x05>;
opp-99999975 {
opp-hz = <0x00 0x5f5e0e7>;
clock-latency-ns = <100000>;
opp-peak-kBps = <0x25800>;
required-opps = <0x10>;
opp-supported-hw = <0xff>;
};
opp-199999951 { opp-199999951 {
opp-hz = <0x00 0xbebc1cf>; opp-hz = <0x00 0xbebc1cf>;
clock-latency-ns = <100000>; clock-latency-ns = <100000>;
@@ -2363,7 +2371,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x5a 0x01>; gpios = <0x27 0x5a 0x01>;
linux,code = <0x67>; linux,code = <0x67>;
debounce-interval = <0x0f>; debounce-interval = <0x19>;
linux,can-disable; linux,can-disable;
}; };
@@ -2371,7 +2379,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x62 0x01>; gpios = <0x27 0x62 0x01>;
linux,code = <0x0e>; linux,code = <0x0e>;
debounce-interval = <0x0f>; debounce-interval = <0x19>;
linux,can-disable; linux,can-disable;
}; };
@@ -2391,8 +2399,8 @@
keypad { keypad {
compatible = "gpio-matrix-keypad"; compatible = "gpio-matrix-keypad";
col-scan-delay-ms = <0x07>; col-scan-delay-us = <0x32>;
debounce-delay-ms = <0x0a>; debounce-delay-ms = <0x12>;
gpio-activelow; gpio-activelow;
pinctrl-0 = <0x88 0x89>; pinctrl-0 = <0x88 0x89>;
pinctrl-names = "default"; pinctrl-names = "default";
@@ -140,6 +140,14 @@
opp-shared; opp-shared;
phandle = <0x05>; phandle = <0x05>;
opp-99999975 {
opp-hz = <0x00 0x5f5e0e7>;
clock-latency-ns = <0x186a0>;
opp-peak-kBps = <0x25800>;
required-opps = <0x10>;
opp-supported-hw = <0xff>;
};
opp-199999951 { opp-199999951 {
opp-hz = <0x00 0xbebc1cf>; opp-hz = <0x00 0xbebc1cf>;
clock-latency-ns = <0x186a0>; clock-latency-ns = <0x186a0>;
@@ -2449,7 +2457,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x5a 0x01>; gpios = <0x27 0x5a 0x01>;
linux,code = <0x73>; linux,code = <0x73>;
debounce-interval = <0x0f>; debounce-interval = <0x14>;
linux,can-disable; linux,can-disable;
}; };
@@ -2457,7 +2465,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x62 0x01>; gpios = <0x27 0x62 0x01>;
linux,code = <0x74>; linux,code = <0x74>;
debounce-interval = <0x0f>; debounce-interval = <0x14>;
linux,can-disable; linux,can-disable;
}; };
@@ -2478,8 +2486,8 @@
keypad { keypad {
compatible = "gpio-matrix-keypad"; compatible = "gpio-matrix-keypad";
col-scan-delay-ms = <0x07>; col-scan-delay-us = <0x32>;
debounce-delay-ms = <0x0a>; debounce-delay-ms = <0x0e>;
gpio-activelow; gpio-activelow;
pinctrl-0 = <0x88 0x89>; pinctrl-0 = <0x88 0x89>;
pinctrl-names = "default"; pinctrl-names = "default";
Binary file not shown.
@@ -140,6 +140,14 @@
opp-shared; opp-shared;
phandle = <0x05>; phandle = <0x05>;
opp-99999975 {
opp-hz = <0x00 0x5f5e0e7>;
clock-latency-ns = <0x186a0>;
opp-peak-kBps = <0x25800>;
required-opps = <0x10>;
opp-supported-hw = <0xff>;
};
opp-199999951 { opp-199999951 {
opp-hz = <0x00 0xbebc1cf>; opp-hz = <0x00 0xbebc1cf>;
clock-latency-ns = <0x186a0>; clock-latency-ns = <0x186a0>;
@@ -2385,7 +2393,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x5a 0x01>; gpios = <0x27 0x5a 0x01>;
linux,code = <0x73>; linux,code = <0x73>;
debounce-interval = <0x0f>; debounce-interval = <0x14>;
linux,can-disable; linux,can-disable;
}; };
@@ -2393,7 +2401,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x62 0x01>; gpios = <0x27 0x62 0x01>;
linux,code = <0x74>; linux,code = <0x74>;
debounce-interval = <0x0f>; debounce-interval = <0x14>;
linux,can-disable; linux,can-disable;
}; };
@@ -2414,8 +2422,8 @@
keypad { keypad {
compatible = "gpio-matrix-keypad"; compatible = "gpio-matrix-keypad";
col-scan-delay-ms = <0x07>; col-scan-delay-us = <0x32>;
debounce-delay-ms = <0x0a>; debounce-delay-ms = <0x0e>;
gpio-activelow; gpio-activelow;
pinctrl-0 = <0x88 0x89>; pinctrl-0 = <0x88 0x89>;
pinctrl-names = "default"; pinctrl-names = "default";
Binary file not shown.
@@ -142,6 +142,14 @@
opp-shared; opp-shared;
phandle = <0x05>; phandle = <0x05>;
opp-99999975 {
opp-hz = <0x00 0x5f5e0e7>;
clock-latency-ns = <100000>;
opp-peak-kBps = <0x25800>;
required-opps = <0x10>;
opp-supported-hw = <0xff>;
};
opp-199999951 { opp-199999951 {
opp-hz = <0x00 0xbebc1cf>; opp-hz = <0x00 0xbebc1cf>;
clock-latency-ns = <100000>; clock-latency-ns = <100000>;
@@ -2358,7 +2366,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x5a 0x01>; gpios = <0x27 0x5a 0x01>;
linux,code = <0x67>; linux,code = <0x67>;
debounce-interval = <0x0f>; debounce-interval = <0x14>;
linux,can-disable; linux,can-disable;
}; };
@@ -2366,15 +2374,15 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x62 0x01>; gpios = <0x27 0x62 0x01>;
linux,code = <0x74>; linux,code = <0x74>;
debounce-interval = <0x0f>; debounce-interval = <0x14>;
linux,can-disable; linux,can-disable;
}; };
}; };
keypad { keypad {
compatible = "gpio-matrix-keypad"; compatible = "gpio-matrix-keypad";
col-scan-delay-ms = <0x07>; col-scan-delay-us = <0x32>;
debounce-delay-ms = <0x0a>; debounce-delay-ms = <0x0e>;
gpio-activelow; gpio-activelow;
pinctrl-0 = <0x88 0x89>; pinctrl-0 = <0x88 0x89>;
pinctrl-names = "default"; pinctrl-names = "default";
Binary file not shown.
@@ -143,6 +143,14 @@
opp-shared; opp-shared;
phandle = <0x05>; phandle = <0x05>;
opp-99999975 {
opp-hz = <0x00 0x5f5e0e7>;
clock-latency-ns = <100000>;
opp-peak-kBps = <0x25800>;
required-opps = <0x10>;
opp-supported-hw = <0xff>;
};
opp-199999951 { opp-199999951 {
opp-hz = <0x00 0xbebc1cf>; opp-hz = <0x00 0xbebc1cf>;
clock-latency-ns = <100000>; clock-latency-ns = <100000>;
@@ -2061,7 +2069,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x5a 0x01>; gpios = <0x27 0x5a 0x01>;
linux,code = <0x20a>; linux,code = <0x20a>;
debounce-interval = <0x0f>; debounce-interval = <0x19>;
linux,can-disable; linux,can-disable;
}; };
}; };
@@ -2069,8 +2077,8 @@
keypad { keypad {
status = "okay"; status = "okay";
compatible = "gpio-matrix-keypad"; compatible = "gpio-matrix-keypad";
col-scan-delay-us = <0x07>; col-scan-delay-us = <0x32>;
debounce-delay-ms = <0x0a>; debounce-delay-ms = <0x12>;
gpio-activelow; gpio-activelow;
pinctrl-0 = <0x7c 0x7d>; pinctrl-0 = <0x7c 0x7d>;
pinctrl-names = "default"; pinctrl-names = "default";
@@ -146,6 +146,14 @@
opp-shared; opp-shared;
phandle = <0x05>; phandle = <0x05>;
opp-99999975 {
opp-hz = <0x00 0x5f5e0e7>;
clock-latency-ns = <100000>;
opp-peak-kBps = <0x25800>;
required-opps = <0x10>;
opp-supported-hw = <0xff>;
};
opp-199999951 { opp-199999951 {
opp-hz = <0x00 0xbebc1cf>; opp-hz = <0x00 0xbebc1cf>;
clock-latency-ns = <100000>; clock-latency-ns = <100000>;
@@ -2357,7 +2365,7 @@
wakeup-source; wakeup-source;
gpios = <0x27 0x5a 0x01>; gpios = <0x27 0x5a 0x01>;
linux,code = <0x20a>; linux,code = <0x20a>;
debounce-interval = <0x0f>; debounce-interval = <0x19>;
linux,can-disable; linux,can-disable;
}; };
}; };
@@ -2365,8 +2373,8 @@
keypad { keypad {
status = "okay"; status = "okay";
compatible = "gpio-matrix-keypad"; compatible = "gpio-matrix-keypad";
col-scan-delay-us = <0x07>; col-scan-delay-us = <0x32>;
debounce-delay-ms = <0x0a>; debounce-delay-ms = <0x12>;
gpio-activelow; gpio-activelow;
pinctrl-0 = <0x7c 0x7d>; pinctrl-0 = <0x7c 0x7d>;
pinctrl-names = "default"; pinctrl-names = "default";
+38716 -38712
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@ level=OFF
[connection] [connection]
wifi.powersave=3 wifi.powersave=3
ipv6.method=ignore
# Associated multi-channel background roam scans are suppressed in kernel # Associated multi-channel background roam scans are suppressed in kernel
# wcn36xx while screen_off_offload=Y and RSSI is healthy. # wcn36xx while screen_off_offload=Y and RSSI is healthy.
@@ -78,11 +78,38 @@ fi
# K10: no IPv6 on interfaces created after boot (also in sysctl.d). # K10: no IPv6 on interfaces created after boot (also in sysctl.d).
{ printf '1\n' > /proc/sys/net/ipv6/conf/default/disable_ipv6; } 2>/dev/null || true { printf '1\n' > /proc/sys/net/ipv6/conf/default/disable_ipv6; } 2>/dev/null || true
# Configure system-core physical keypad bounce debounce window (in ms).
if [ -w /sys/module/input_core/parameters/key_debounce_ms ]; then
_kdb_ms=45
if [ -r /sys/firmware/devicetree/base/compatible ] && \
tr '\0' '\n' < /sys/firmware/devicetree/base/compatible 2>/dev/null | \
grep -qxE 'nokia,(argon|sparkler|leo)'; then
_kdb_ms=55
fi
if [ -r /etc/bananarchy/key-debounce.conf ]; then
_kdb_cfg="$(sed -n 's/^[[:space:]]*KEY_DEBOUNCE_MS=\([0-9][0-9]*\).*/\1/p' /etc/bananarchy/key-debounce.conf | tail -n 1)"
[ -n "$_kdb_cfg" ] && _kdb_ms="$_kdb_cfg"
fi
printf '%s\n' "$_kdb_ms" > /sys/module/input_core/parameters/key_debounce_ms 2>/dev/null || true
fi
# Wi-Fi power save is enabled by NetworkManager (wifi.powersave=3) and by the # Wi-Fi power save is enabled by NetworkManager (wifi.powersave=3) and by the
# wcn36xx WIPHY_FLAG_PS_ON_BY_DEFAULT / dynamic_ps_timeout=200 kernel patch. # wcn36xx WIPHY_FLAG_PS_ON_BY_DEFAULT / dynamic_ps_timeout=200 kernel patch.
# Verified on-device: "iw dev wlan0 get power_save" reports "Power save: on". # Verified on-device: "iw dev wlan0 get power_save" reports "Power save: on".
# No iw binary is shipped, so no userspace iw call belongs here. # No iw binary is shipped, so no userspace iw call belongs here.
# Keep Bluetooth RF-killed and stopped at boot unless explicitly enabled
bt_want=0
if [ -r /home/user/.config/sxmo/bt_enabled ]; then
IFS= read -r bt_val < /home/user/.config/sxmo/bt_enabled 2>/dev/null || bt_val=""
case "$bt_val" in 1|on|ON|yes|YES|true|TRUE) bt_want=1 ;; esac
fi
if [ "$bt_want" = "0" ]; then
rfkill block bluetooth >/dev/null 2>&1 || true
rc-service bluetooth status >/dev/null 2>&1 && rc-service bluetooth stop >/dev/null 2>&1 || true
rc-update del bluetooth default >/dev/null 2>&1 || true
fi
# Restore any persistent Engineering Menu Wi-Fi/BT MAC and IMEI override state # Restore any persistent Engineering Menu Wi-Fi/BT MAC and IMEI override state
if [ -x /usr/bin/bananarchy-engmenu-ctl ]; then if [ -x /usr/bin/bananarchy-engmenu-ctl ]; then
/usr/bin/bananarchy-engmenu-ctl apply-boot >/dev/null 2>&1 || true /usr/bin/bananarchy-engmenu-ctl apply-boot >/dev/null 2>&1 || true
@@ -46,7 +46,14 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
if [ "$(command -v pulseaudio)" ]; then if [ "$(command -v pulseaudio)" ]; then
superctl start pulseaudio superctl start pulseaudio
elif [ "$(command -v pipewire)" ]; then elif [ "$(command -v pipewire)" ]; then
if ! pidof -s pipewire >/dev/null 2>&1; then if ! superctl status pipewire 2>/dev/null | grep -q started; then
# Clean up any unmanaged pipewire instance / stale socket before superd launch.
stale_pw=0
for pw_pid in $(pidof pipewire 2>/dev/null); do
[ -n "$pw_pid" ] && kill "$pw_pid" 2>/dev/null && stale_pw=1 || true
done
[ "$stale_pw" = "1" ] && sleep 0.1
rm -f "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0.lock" 2>/dev/null || true
superctl start pipewire superctl start pipewire
pw_wait=0 pw_wait=0
while [ ! -S "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" ] && [ "$pw_wait" -lt 30 ]; do while [ ! -S "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" ] && [ "$pw_wait" -lt 30 ]; do
@@ -55,7 +62,13 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
done done
fi fi
superctl start pipewire-pulse superctl start pipewire-pulse
pidof -s wireplumber >/dev/null 2>&1 || superctl start wireplumber if ! superctl status wireplumber 2>/dev/null | grep -q started; then
superctl start wireplumber
sleep 0.2
if ! superctl status wireplumber 2>/dev/null | grep -q started; then
superctl start wireplumber
fi
fi
fi fi
fi fi
@@ -145,8 +158,14 @@ superctl start sxmo_notificationmonitor
( (
sxmo_hook_apps.sh >/dev/null 2>&1 || true sxmo_hook_apps.sh >/dev/null 2>&1 || true
sxmo_hook_scripts.sh >/dev/null 2>&1 || true sxmo_hook_scripts.sh >/dev/null 2>&1 || true
if [ "$(/usr/bin/sxmo_bluetoothtoggle.sh status 2>/dev/null)" = "on" ]; then bt_cfg="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/bt_enabled"
SXMO_OS=alpine doas -n /usr/bin/sxmo_bluetoothtoggle.sh on >/dev/null 2>&1 || true if [ -r "$bt_cfg" ]; then
IFS= read -r bt_val < "$bt_cfg" 2>/dev/null || bt_val=""
case "$bt_val" in
1|on|ON|yes|YES|true|TRUE)
SXMO_OS=alpine doas -n /usr/bin/sxmo_bluetoothtoggle.sh on >/dev/null 2>&1 || true
;;
esac
fi fi
) & ) &
) )
@@ -46,7 +46,14 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
if [ "$(command -v pulseaudio)" ]; then if [ "$(command -v pulseaudio)" ]; then
superctl start pulseaudio superctl start pulseaudio
elif [ "$(command -v pipewire)" ]; then elif [ "$(command -v pipewire)" ]; then
if ! pidof -s pipewire >/dev/null 2>&1; then if ! superctl status pipewire 2>/dev/null | grep -q started; then
# Clean up any unmanaged pipewire instance / stale socket before superd launch.
stale_pw=0
for pw_pid in $(pidof pipewire 2>/dev/null); do
[ -n "$pw_pid" ] && kill "$pw_pid" 2>/dev/null && stale_pw=1 || true
done
[ "$stale_pw" = "1" ] && sleep 0.1
rm -f "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0.lock" 2>/dev/null || true
superctl start pipewire superctl start pipewire
pw_wait=0 pw_wait=0
while [ ! -S "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" ] && [ "$pw_wait" -lt 30 ]; do while [ ! -S "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" ] && [ "$pw_wait" -lt 30 ]; do
@@ -55,7 +62,13 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
done done
fi fi
superctl start pipewire-pulse superctl start pipewire-pulse
pidof -s wireplumber >/dev/null 2>&1 || superctl start wireplumber if ! superctl status wireplumber 2>/dev/null | grep -q started; then
superctl start wireplumber
sleep 0.2
if ! superctl status wireplumber 2>/dev/null | grep -q started; then
superctl start wireplumber
fi
fi
fi fi
fi fi
@@ -144,8 +157,14 @@ superctl start sxmo_notificationmonitor
( (
sxmo_hook_apps.sh >/dev/null 2>&1 || true sxmo_hook_apps.sh >/dev/null 2>&1 || true
sxmo_hook_scripts.sh >/dev/null 2>&1 || true sxmo_hook_scripts.sh >/dev/null 2>&1 || true
if [ "$(/usr/bin/sxmo_bluetoothtoggle.sh status 2>/dev/null)" = "on" ]; then bt_cfg="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/bt_enabled"
SXMO_OS=alpine doas -n /usr/bin/sxmo_bluetoothtoggle.sh on >/dev/null 2>&1 || true if [ -r "$bt_cfg" ]; then
IFS= read -r bt_val < "$bt_cfg" 2>/dev/null || bt_val=""
case "$bt_val" in
1|on|ON|yes|YES|true|TRUE)
SXMO_OS=alpine doas -n /usr/bin/sxmo_bluetoothtoggle.sh on >/dev/null 2>&1 || true
;;
esac
fi fi
) & ) &
) )
@@ -17,10 +17,12 @@ RAT_PIDFILE="$RUNDIR/rat_timer.pid"
STANDBY_MODE="$RUNDIR/standby.mode" STANDBY_MODE="$RUNDIR/standby.mode"
GSM_UNSUPPORTED="$RUNDIR/gsm_unsupported" GSM_UNSUPPORTED="$RUNDIR/gsm_unsupported"
IPV6_RA_SAVED="$RUNDIR/wlan0_accept_ra" IPV6_RA_SAVED="$RUNDIR/wlan0_accept_ra"
IPV6_DISABLE_SAVED="$RUNDIR/wlan0_disable_ipv6"
BOOTTOKEN="$RUNDIR/boot.token" BOOTTOKEN="$RUNDIR/boot.token"
READYSTAMP="$RUNDIR/modem_ready.stamp" READYSTAMP="$RUNDIR/modem_ready.stamp"
DRXLOCK="$RUNDIR/lock.drx" DRXLOCK="$RUNDIR/lock.drx"
ACCEPT_RA="${BANANARCHY_ACCEPT_RA_PATH:-/proc/sys/net/ipv6/conf/wlan0/accept_ra}" ACCEPT_RA="${BANANARCHY_ACCEPT_RA_PATH:-/proc/sys/net/ipv6/conf/wlan0/accept_ra}"
DISABLE_IPV6="${BANANARCHY_DISABLE_IPV6_PATH:-/proc/sys/net/ipv6/conf/wlan0/disable_ipv6}"
SPM_PARAM_DIR="${BANANARCHY_SPM_PARAM_DIR:-/sys/module/cpuidle_qcom_spm/parameters}" SPM_PARAM_DIR="${BANANARCHY_SPM_PARAM_DIR:-/sys/module/cpuidle_qcom_spm/parameters}"
WLAN_OPERSTATE_PATH="${BANANARCHY_WLAN_OPERSTATE_PATH:-/sys/class/net/wlan0/operstate}" WLAN_OPERSTATE_PATH="${BANANARCHY_WLAN_OPERSTATE_PATH:-/sys/class/net/wlan0/operstate}"
WIFI_OFFLOAD_PATH="${BANANARCHY_WIFI_OFFLOAD_PATH:-/sys/module/wcn36xx/parameters/screen_off_offload}" WIFI_OFFLOAD_PATH="${BANANARCHY_WIFI_OFFLOAD_PATH:-/sys/module/wcn36xx/parameters/screen_off_offload}"
@@ -209,27 +211,48 @@ ims_conf_val() {
mute_wifi_ipv6_ra() { mute_wifi_ipv6_ra() {
[ "$WIFI_SCREEN_OFF_IPV6_MUTE" = "1" ] || return 0 [ "$WIFI_SCREEN_OFF_IPV6_MUTE" = "1" ] || return 0
[ -w "$ACCEPT_RA" ] || return 0 if [ ! -w "$ACCEPT_RA" ] && [ ! -w "$DISABLE_IPV6" ]; then
return 0
fi
ip -4 addr show dev wlan0 2>/dev/null | grep -q 'inet ' || return 0 ip -4 addr show dev wlan0 2>/dev/null | grep -q 'inet ' || return 0
if [ "$(ims_state_val VOWIFI_ACTIVE)" = "1" ] && [ "$(ims_state_val VOWIFI_IPV6_EPDG)" = "1" ]; then if [ "$(ims_state_val VOWIFI_ACTIVE)" = "1" ] && [ "$(ims_state_val VOWIFI_IPV6_EPDG)" = "1" ]; then
return 0 return 0
fi fi
if [ ! -f "$IPV6_RA_SAVED" ]; then if [ -w "$ACCEPT_RA" ]; then
cur_ra="" if [ ! -f "$IPV6_RA_SAVED" ]; then
IFS= read -r cur_ra < "$ACCEPT_RA" 2>/dev/null || cur_ra="" cur_ra=""
case "$cur_ra" in ''|*[!0-9]*) cur_ra=1 ;; esac IFS= read -r cur_ra < "$ACCEPT_RA" 2>/dev/null || cur_ra=""
printf '%s\n' "$cur_ra" > "$IPV6_RA_SAVED" 2>/dev/null || true case "$cur_ra" in ''|*[!0-9]*) cur_ra=1 ;; esac
printf '%s\n' "$cur_ra" > "$IPV6_RA_SAVED" 2>/dev/null || true
fi
printf '0\n' > "$ACCEPT_RA" 2>/dev/null || true
fi
if [ -w "$DISABLE_IPV6" ]; then
if [ ! -f "$IPV6_DISABLE_SAVED" ]; then
cur_dis=""
IFS= read -r cur_dis < "$DISABLE_IPV6" 2>/dev/null || cur_dis=""
case "$cur_dis" in ''|*[!0-9]*) cur_dis=0 ;; esac
printf '%s\n' "$cur_dis" > "$IPV6_DISABLE_SAVED" 2>/dev/null || true
fi
printf '1\n' > "$DISABLE_IPV6" 2>/dev/null || true
fi fi
printf '0\n' > "$ACCEPT_RA" 2>/dev/null || true
} }
restore_wifi_ipv6_ra() { restore_wifi_ipv6_ra() {
[ -f "$IPV6_RA_SAVED" ] || return 0 if [ -f "$IPV6_RA_SAVED" ]; then
saved_ra=1 saved_ra=1
IFS= read -r saved_ra < "$IPV6_RA_SAVED" 2>/dev/null || saved_ra=1 IFS= read -r saved_ra < "$IPV6_RA_SAVED" 2>/dev/null || saved_ra=1
case "$saved_ra" in ''|*[!0-9]*) saved_ra=1 ;; esac case "$saved_ra" in ''|*[!0-9]*) saved_ra=1 ;; esac
[ -w "$ACCEPT_RA" ] && printf '%s\n' "$saved_ra" > "$ACCEPT_RA" 2>/dev/null || true [ -w "$ACCEPT_RA" ] && printf '%s\n' "$saved_ra" > "$ACCEPT_RA" 2>/dev/null || true
rm -f "$IPV6_RA_SAVED" 2>/dev/null || true rm -f "$IPV6_RA_SAVED" 2>/dev/null || true
fi
if [ -f "$IPV6_DISABLE_SAVED" ]; then
saved_dis=0
IFS= read -r saved_dis < "$IPV6_DISABLE_SAVED" 2>/dev/null || saved_dis=0
case "$saved_dis" in ''|*[!0-9]*) saved_dis=0 ;; esac
[ -w "$DISABLE_IPV6" ] && printf '%s\n' "$saved_dis" > "$DISABLE_IPV6" 2>/dev/null || true
rm -f "$IPV6_DISABLE_SAVED" 2>/dev/null || true
fi
} }
has_active_call() { has_active_call() {
@@ -306,6 +329,7 @@ park_wifi_rat() {
fi fi
if [ "$reg_ok" -eq 1 ]; then if [ "$reg_ok" -eq 1 ]; then
: > "$RAT_PARKED" : > "$RAT_PARKED"
[ -x "$DSDS_BIN" ] && "$DSDS_BIN" --sig-hysteresis dark >/dev/null 2>&1 || true
log "Wi-Fi standby RAT parked to gsm (saved: $saved_rat)" log "Wi-Fi standby RAT parked to gsm (saved: $saved_rat)"
return 0 return 0
fi fi
@@ -151,7 +151,7 @@ else
xset +dpms >/dev/null 2>&1 || true xset +dpms >/dev/null 2>&1 || true
xset dpms 0 0 0 >/dev/null 2>&1 || true xset dpms 0 0 0 >/dev/null 2>&1 || true
fi fi
xset r rate 180 30 >/dev/null 2>&1 || true xset r rate 300 25 >/dev/null 2>&1 || true
SESSION_PID_FILE="/tmp/bananarchy-x11-session.pid" SESSION_PID_FILE="/tmp/bananarchy-x11-session.pid"
printf "%s\n" "$$" > "$SESSION_PID_FILE" printf "%s\n" "$$" > "$SESSION_PID_FILE"
+25
View File
@@ -611,12 +611,23 @@ apply_vol_out() {
Earpiece) Earpiece)
if [ "$eff_pct" -gt 0 ]; then if [ "$eff_pct" -gt 0 ]; then
amixer -c 0 -s >/dev/null 2>&1 <<EOF || true amixer -c 0 -s >/dev/null 2>&1 <<EOF || true
cset "name='SPK DAC Switch'" 0
cset "name='RX3 MIX1 INP1'" 'ZERO'
cset "name='RX3 Digital Volume'" 0
cset "name='HPHL'" 'ZERO'
cset "name='HPHR'" 'ZERO'
cset "name='RX2 MIX1 INP1'" 'ZERO'
cset "name='RX2 Digital Volume'" 0
cset "name='RX1 MIX1 INP1'" 'RX1' cset "name='RX1 MIX1 INP1'" 'RX1'
cset "name='RDAC2 MUX'" 'RX1'
cset "name='EAR_S'" 'Switch' cset "name='EAR_S'" 'Switch'
cset "name='RX1 Digital Volume'" $hw cset "name='RX1 Digital Volume'" $hw
EOF EOF
else else
amixer -c 0 -s >/dev/null 2>&1 <<EOF || true amixer -c 0 -s >/dev/null 2>&1 <<EOF || true
cset "name='SPK DAC Switch'" 0
cset "name='RX3 MIX1 INP1'" 'ZERO'
cset "name='RX3 Digital Volume'" 0
cset "name='EAR_S'" 'ZERO' cset "name='EAR_S'" 'ZERO'
cset "name='RX1 Digital Volume'" 0 cset "name='RX1 Digital Volume'" 0
EOF EOF
@@ -625,6 +636,11 @@ EOF
Headphones) Headphones)
if [ "$eff_pct" -gt 0 ]; then if [ "$eff_pct" -gt 0 ]; then
amixer -c 0 -s >/dev/null 2>&1 <<EOF || true amixer -c 0 -s >/dev/null 2>&1 <<EOF || true
cset "name='SPK DAC Switch'" 0
cset "name='RX3 MIX1 INP1'" 'ZERO'
cset "name='RX3 Digital Volume'" 0
cset "name='EAR_S'" 'ZERO'
cset "name='RDAC2 MUX'" 'RX2'
cset "name='RX1 MIX1 INP1'" 'RX1' cset "name='RX1 MIX1 INP1'" 'RX1'
cset "name='RX2 MIX1 INP1'" 'RX2' cset "name='RX2 MIX1 INP1'" 'RX2'
cset "name='HPHL'" 'Switch' cset "name='HPHL'" 'Switch'
@@ -634,6 +650,9 @@ cset "name='RX2 Digital Volume'" $hw
EOF EOF
else else
amixer -c 0 -s >/dev/null 2>&1 <<EOF || true amixer -c 0 -s >/dev/null 2>&1 <<EOF || true
cset "name='SPK DAC Switch'" 0
cset "name='RX3 MIX1 INP1'" 'ZERO'
cset "name='RX3 Digital Volume'" 0
cset "name='HPHL'" 'ZERO' cset "name='HPHL'" 'ZERO'
cset "name='HPHR'" 'ZERO' cset "name='HPHR'" 'ZERO'
cset "name='RX1 Digital Volume'" 0 cset "name='RX1 Digital Volume'" 0
@@ -1070,6 +1089,9 @@ deviceset() {
out_vol="$(read_dev_vol "$out_dev")" out_vol="$(read_dev_vol "$out_dev")"
apply_alsa_out "$out_dev" "$out_vol" apply_alsa_out "$out_dev" "$out_vol"
apply_alsa_in "$in_dev" "$(read_mic_vol)" apply_alsa_in "$in_dev" "$(read_mic_vol)"
if [ -p /tmp/dwm_plugin_music.fifo ]; then
( printf 'AUDIO_ROUTE\n' > /tmp/dwm_plugin_music.fifo ) 2>/dev/null &
fi
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 & sxmo_hook_statusbar.sh volume >/dev/null 2>&1 &
} }
@@ -1148,6 +1170,9 @@ deviceapply() {
sync_pipewire_profile "$out_dev" "$in_dev" sync_pipewire_profile "$out_dev" "$in_dev"
apply_alsa_out "$out_dev" "$(read_dev_vol "$out_dev")" apply_alsa_out "$out_dev" "$(read_dev_vol "$out_dev")"
apply_alsa_in "$in_dev" "$(read_mic_vol)" apply_alsa_in "$in_dev" "$(read_mic_vol)"
if [ -p /tmp/dwm_plugin_music.fifo ]; then
( printf 'AUDIO_ROUTE\n' > /tmp/dwm_plugin_music.fifo ) 2>/dev/null &
fi
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 & sxmo_hook_statusbar.sh volume >/dev/null 2>&1 &
} }
@@ -56,6 +56,9 @@ on() {
;; ;;
esac esac
mkdir -p /home/user/.config/sxmo
printf '1\n' > /home/user/.config/sxmo/bt_enabled
chown 10000:10000 /home/user/.config/sxmo /home/user/.config/sxmo/bt_enabled 2>/dev/null || true
/usr/bin/bananarchy-bt-obex start >/dev/null 2>&1 || true /usr/bin/bananarchy-bt-obex start >/dev/null 2>&1 || true
} }
@@ -75,7 +78,7 @@ off() {
kill -KILL $(pidof bluetoothd) 2>/dev/null || true kill -KILL $(pidof bluetoothd) 2>/dev/null || true
fi fi
rfkill block bluetooth rfkill block bluetooth
rm -f /run/bananarchy/bt-obex/ctrl_ready /run/bananarchy/bt-obex/bt_state.tsv 2>/dev/null || true rm -f /home/user/.config/sxmo/bt_enabled /run/bananarchy/bt-obex/ctrl_ready /run/bananarchy/bt-obex/bt_state.tsv 2>/dev/null || true
} }
case "${1:-toggle}" in case "${1:-toggle}" in
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -54,7 +54,14 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
if [ "$(command -v pulseaudio)" ]; then if [ "$(command -v pulseaudio)" ]; then
superctl start pulseaudio superctl start pulseaudio
elif [ "$(command -v pipewire)" ]; then elif [ "$(command -v pipewire)" ]; then
if ! pidof -s pipewire >/dev/null 2>&1; then if ! superctl status pipewire 2>/dev/null | grep -q started; then
# Clean up any unmanaged pipewire instance / stale socket before superd launch.
stale_pw=0
for pw_pid in $(pidof pipewire 2>/dev/null); do
[ -n "$pw_pid" ] && kill "$pw_pid" 2>/dev/null && stale_pw=1 || true
done
[ "$stale_pw" = "1" ] && sleep 0.1
rm -f "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0.lock" 2>/dev/null || true
superctl start pipewire superctl start pipewire
pw_wait=0 pw_wait=0
while [ ! -S "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" ] && [ "$pw_wait" -lt 30 ]; do while [ ! -S "${XDG_RUNTIME_DIR:-/run/user/10000}/pipewire-0" ] && [ "$pw_wait" -lt 30 ]; do
@@ -63,7 +70,13 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
done done
fi fi
superctl start pipewire-pulse superctl start pipewire-pulse
pidof -s wireplumber >/dev/null 2>&1 || superctl start wireplumber if ! superctl status wireplumber 2>/dev/null | grep -q started; then
superctl start wireplumber
sleep 0.2
if ! superctl status wireplumber 2>/dev/null | grep -q started; then
superctl start wireplumber
fi
fi
fi fi
fi fi
@@ -153,8 +166,14 @@ superctl start sxmo_notificationmonitor
( (
sxmo_hook_apps.sh >/dev/null 2>&1 || true sxmo_hook_apps.sh >/dev/null 2>&1 || true
sxmo_hook_scripts.sh >/dev/null 2>&1 || true sxmo_hook_scripts.sh >/dev/null 2>&1 || true
if [ "$(/usr/bin/sxmo_bluetoothtoggle.sh status 2>/dev/null)" = "on" ]; then bt_cfg="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/bt_enabled"
SXMO_OS=alpine doas -n /usr/bin/sxmo_bluetoothtoggle.sh on >/dev/null 2>&1 || true if [ -r "$bt_cfg" ]; then
IFS= read -r bt_val < "$bt_cfg" 2>/dev/null || bt_val=""
case "$bt_val" in
1|on|ON|yes|YES|true|TRUE)
SXMO_OS=alpine doas -n /usr/bin/sxmo_bluetoothtoggle.sh on >/dev/null 2>&1 || true
;;
esac
fi fi
) & ) &
) )
@@ -54,7 +54,28 @@ diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
sdhci_msm_set_regulator_caps(msm_host); sdhci_msm_set_regulator_caps(msm_host);
return 0; return 0;
@@ -2704,6 +2713,10 @@ @@ -2628,6 +2637,20 @@
msm_host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
+ /*
+ * Enable aggressive runtime PM (power-cycle off during idle) strictly
+ * on removable SD slots. Never enable it on eMMC (mmc0 / 8-bit /
+ * no-sd / HS200/HS400) because the rootfs lives on mmc0.
+ */
+ if (of_alias_get_id(node, "mmc") != 0 &&
+ !(msm_host->mmc->caps & MMC_CAP_8_BIT_DATA) &&
+ !(msm_host->mmc->caps2 & (MMC_CAP2_NO_SD |
+ MMC_CAP2_HS200_1_8V_SDR |
+ MMC_CAP2_HS400_1_8V))) {
+ msm_host->mmc->caps |= MMC_CAP_AGGRESSIVE_PM;
+ msm_host->mmc->caps2 |= MMC_CAP2_FULL_PWR_CYCLE;
+ }
+
/* Set the timeout value to max possible */
host->max_timeout_count = 0xF;
@@ -2704,6 +2727,10 @@
dev_pm_opp_set_rate(dev, 0); dev_pm_opp_set_rate(dev, 0);
clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
msm_host->bulk_clks); msm_host->bulk_clks);
@@ -65,7 +86,7 @@ diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
return sdhci_msm_ice_suspend(msm_host); return sdhci_msm_ice_suspend(msm_host);
} }
@@ -2716,6 +2729,11 @@ @@ -2716,6 +2743,11 @@
unsigned long flags; unsigned long flags;
int ret; int ret;
@@ -685,3 +706,106 @@ index b0934faa7..257f78057 100644
ret = pm8916_wcd_analog_parse_dt(dev, priv); ret = pm8916_wcd_analog_parse_dt(dev, priv);
if (ret < 0) if (ret < 0)
return ret; return ret;
diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
--- a/drivers/remoteproc/qcom_q6v5_mss.c
+++ b/drivers/remoteproc/qcom_q6v5_mss.c
@@ -2359,12 +2359,12 @@
},
.proxy_clk_names = (char*[]){
"xo",
+ "mem",
NULL
},
.active_clk_names = (char*[]){
"iface",
"bus",
- "mem",
NULL
},
.proxy_pd_names = (char*[]){
@@ -2404,12 +2404,12 @@
},
.proxy_clk_names = (char*[]){
"xo",
+ "mem",
NULL
},
.active_clk_names = (char*[]){
"iface",
"bus",
- "mem",
NULL
},
.proxy_pd_names = (char*[]){
diff --git a/drivers/clk/qcom/gcc-msm8909.c b/drivers/clk/qcom/gcc-msm8909.c
--- a/drivers/clk/qcom/gcc-msm8909.c
+++ b/drivers/clk/qcom/gcc-msm8909.c
@@ -844,6 +844,7 @@
.parent_data = gcc_xo_gpll0_bimc_data,
.num_parents = ARRAY_SIZE(gcc_xo_gpll0_bimc_data),
.ops = &clk_rcg2_ops,
+ .flags = CLK_GET_RATE_NOCACHE,
},
};
@@ -914,6 +915,7 @@
.parent_data = gcc_xo_gpll0_bimc_data,
.num_parents = ARRAY_SIZE(gcc_xo_gpll0_bimc_data),
.ops = &clk_rcg2_ops,
+ .flags = CLK_GET_RATE_NOCACHE,
},
};
@@ -2151,10 +2153,8 @@
.enable_mask = BIT(0),
.hw.init = &(struct clk_init_data) {
.name = "gcc_mss_q6_bimc_axi_clk",
- .parent_hws = (const struct clk_hw*[]) {
- &bimc_ddr_clk_src.clkr.hw,
- },
- .num_parents = 1,
+ .parent_data = gcc_xo_data,
+ .num_parents = ARRAY_SIZE(gcc_xo_data),
.ops = &clk_branch2_ops,
}
}
@@ -2716,7 +2716,22 @@
static int gcc_msm8909_probe(struct platform_device *pdev)
{
- return qcom_cc_probe(pdev, &gcc_msm8909_desc);
+ struct regmap *regmap;
+ int ret;
+
+ ret = qcom_cc_probe(pdev, &gcc_msm8909_desc);
+ if (ret)
+ return ret;
+
+ /*
+ * Clear the bootloader APSS vote on bimc_pll_early (BIT(2)) so
+ * BIMC PLL can gate when neither APSS nor MSS needs it.
+ */
+ regmap = dev_get_regmap(&pdev->dev, NULL);
+ if (regmap)
+ regmap_update_bits(regmap, 0x45000, BIT(2), 0);
+
+ return 0;
}
static struct platform_driver gcc_msm8909_driver = {
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8909.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8909.dtsi
--- a/arch/arm/boot/dts/qcom/qcom-msm8909.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8909.dtsi
@@ -137,6 +137,12 @@
* 800 MHz. However, they are generated from GPLL0 which does
* not run at exactly 800 MHz but rather 799999804 Hz.
*/
+ opp-99999975 {
+ opp-hz = /bits/ 64 <99999975>;
+ clock-latency-ns = <100000>;
+ required-opps = <&rpmpd_opp_ret>;
+ opp-supported-hw = <0xff>;
+ };
opp-199999951 {
opp-hz = /bits/ 64 <199999951>;
clock-latency-ns = <100000>;
@@ -0,0 +1,213 @@
diff --git a/drivers/input/input.c b/drivers/input/input.c
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -25,6 +25,8 @@
#include <linux/kstrtox.h>
#include <linux/mutex.h>
#include <linux/rcupdate.h>
+#include <linux/ktime.h>
+#include <linux/moduleparam.h>
#include "input-compat.h"
#include "input-core-private.h"
#include "input-poller.h"
@@ -48,6 +50,155 @@
*/
static DEFINE_MUTEX(input_mutex);
+static unsigned int ba_key_debounce_ms = 45;
+module_param_named(key_debounce_ms, ba_key_debounce_ms, uint, 0644);
+MODULE_PARM_DESC(key_debounce_ms,
+ "Post-release chatter debounce window in ms for built-in physical keys (0=off)");
+
+#define BA_KEY_DEBOUNCE_SLOTS 64
+
+struct ba_key_debounce_slot {
+ const struct input_dev *dev;
+ unsigned int code;
+ ktime_t last_press;
+ ktime_t last_release;
+ ktime_t settle_until;
+ bool suppressed_press;
+};
+
+static struct ba_key_debounce_slot ba_key_slots[BA_KEY_DEBOUNCE_SLOTS];
+static DEFINE_SPINLOCK(ba_key_debounce_lock);
+
+static bool ba_should_debounce_key(const struct input_dev *dev,
+ unsigned int code)
+{
+ if (!READ_ONCE(ba_key_debounce_ms))
+ return false;
+
+ if (dev->id.bustype == BUS_VIRTUAL ||
+ dev->id.bustype == BUS_BLUETOOTH ||
+ dev->id.bustype == BUS_USB)
+ return false;
+
+ if (code >= BTN_MISC && code < KEY_OK)
+ return false;
+
+ return true;
+}
+
+static void ba_pop_trailing_msc_scan(struct input_dev *dev)
+{
+ if (dev->num_vals > 0 &&
+ dev->vals[dev->num_vals - 1].type == EV_MSC &&
+ dev->vals[dev->num_vals - 1].code == MSC_SCAN)
+ dev->num_vals--;
+}
+
+static bool ba_filter_key_bounce(struct input_dev *dev, unsigned int code,
+ int value)
+{
+ unsigned int db_ms = min(READ_ONCE(ba_key_debounce_ms), 250U);
+ struct ba_key_debounce_slot *slot = NULL;
+ struct ba_key_debounce_slot *empty = NULL;
+ struct ba_key_debounce_slot *oldest = NULL;
+ ktime_t oldest_ts = 0;
+ ktime_t now;
+ s64 db_ns;
+ unsigned long flags;
+ bool was_down;
+ int i;
+
+ if (!db_ms || !ba_should_debounce_key(dev, code))
+ return false;
+
+ now = ktime_get();
+ db_ns = (s64)db_ms * NSEC_PER_MSEC;
+ was_down = test_bit(code, dev->key);
+
+ spin_lock_irqsave(&ba_key_debounce_lock, flags);
+
+ for (i = 0; i < BA_KEY_DEBOUNCE_SLOTS; i++) {
+ struct ba_key_debounce_slot *s = &ba_key_slots[i];
+
+ if (s->dev == dev && s->code == code) {
+ slot = s;
+ break;
+ }
+ if (!s->dev && !empty)
+ empty = s;
+ if (s->dev) {
+ ktime_t ts = ktime_after(s->last_release, s->last_press) ?
+ s->last_release : s->last_press;
+ if (!oldest || ktime_before(ts, oldest_ts)) {
+ oldest = s;
+ oldest_ts = ts;
+ }
+ }
+ }
+
+ if (!slot) {
+ slot = empty ? empty : oldest;
+ memset(slot, 0, sizeof(*slot));
+ slot->dev = dev;
+ slot->code = code;
+ }
+
+ if (value) {
+ if (was_down) {
+ spin_unlock_irqrestore(&ba_key_debounce_lock, flags);
+ return false;
+ }
+ if ((ktime_to_ns(slot->settle_until) != 0 &&
+ ktime_before(now, slot->settle_until)) ||
+ (ktime_to_ns(slot->last_press) != 0 &&
+ ktime_sub(now, slot->last_press) < db_ns)) {
+ slot->suppressed_press = true;
+ spin_unlock_irqrestore(&ba_key_debounce_lock, flags);
+ ba_pop_trailing_msc_scan(dev);
+ return true;
+ }
+ slot->last_press = now;
+ slot->suppressed_press = false;
+ spin_unlock_irqrestore(&ba_key_debounce_lock, flags);
+ return false;
+ }
+
+ if (was_down) {
+ slot->last_release = now;
+ slot->settle_until = ktime_add_ns(now, db_ns);
+ slot->suppressed_press = false;
+ spin_unlock_irqrestore(&ba_key_debounce_lock, flags);
+ return false;
+ }
+
+ if (slot->suppressed_press) {
+ ktime_t ext = ktime_add_ns(now, db_ns / 2);
+ ktime_t cap = ktime_add_ns(slot->last_release, db_ns + db_ns / 2);
+
+ if (ktime_after(ext, cap))
+ ext = cap;
+ if (ktime_after(ext, slot->settle_until))
+ slot->settle_until = ext;
+ slot->suppressed_press = false;
+ }
+ spin_unlock_irqrestore(&ba_key_debounce_lock, flags);
+ ba_pop_trailing_msc_scan(dev);
+ return true;
+}
+
+static void ba_clear_key_debounce_dev(const struct input_dev *dev)
+{
+ unsigned long flags;
+ int i;
+
+ spin_lock_irqsave(&ba_key_debounce_lock, flags);
+ for (i = 0; i < BA_KEY_DEBOUNCE_SLOTS; i++) {
+ if (ba_key_slots[i].dev == dev)
+ memset(&ba_key_slots[i], 0, sizeof(ba_key_slots[i]));
+ }
+ spin_unlock_irqrestore(&ba_key_debounce_lock, flags);
+}
+
static const struct input_value input_value_sync = { EV_SYN, SYN_REPORT, 1 };
static const unsigned int input_max_code[EV_CNT] = {
@@ -240,6 +391,9 @@
break;
}
+ if (ba_filter_key_bounce(dev, code, value))
+ break;
+
if (!!test_bit(code, dev->key) != !!value) {
__change_bit(code, dev->key);
@@ -2267,6 +2421,7 @@
{
struct input_handle *handle, *next;
+ ba_clear_key_debounce_dev(dev);
input_disconnect_device(dev);
mutex_lock(&input_mutex);
diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -151,7 +151,7 @@
unsigned int sts;
int err;
- if (pwrkey->sw_debounce_time_us) {
+ if (ktime_to_ns(pwrkey->sw_debounce_end_time)) {
if (ktime_before(ktime_get(), pwrkey->sw_debounce_end_time)) {
dev_dbg(pwrkey->dev,
"ignoring key event received before debounce end %llu us\n",
@@ -166,9 +166,12 @@
sts &= pwrkey->data->status_bit;
- if (pwrkey->sw_debounce_time_us && !sts)
+ if (!sts)
pwrkey->sw_debounce_end_time = ktime_add_us(ktime_get(),
- pwrkey->sw_debounce_time_us);
+ max_t(u32, pwrkey->sw_debounce_time_us, 45000U));
+ else
+ pwrkey->sw_debounce_end_time = ktime_add_us(ktime_get(),
+ min_t(u32, max_t(u32, pwrkey->sw_debounce_time_us, 15000U), 25000U));
/*
* Simulate a press event in case a release event occurred without a
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+17
View File
@@ -600,6 +600,8 @@ chmod 644 "$TARGET_ROOTFS/etc/pam.d/sshd" \
2>/dev/null || true 2>/dev/null || true
chown 0:0 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" \ chown 0:0 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" \
"$TARGET_ROOTFS/etc/conf.d/bluetooth" 2>/dev/null || true "$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" \ chmod 0644 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" \
"$TARGET_ROOTFS/etc/conf.d/bluetooth" 2>/dev/null || true "$TARGET_ROOTFS/etc/conf.d/bluetooth" 2>/dev/null || true
chown 0:0 "$TARGET_ROOTFS/etc/pam.d/sshd" \ 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" \ chown -R 0:0 "$TARGET_ROOTFS/etc/skel/.ssh" "$TARGET_ROOTFS/root/.ssh" \
2>/dev/null || true 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" "$BASE_DIR/scripts/compile-gsettings-schemas.sh" "$TARGET_ROOTFS"
echo "Bananarchy overlay applied to $TARGET_ROOTFS for device $DEVICE." 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 swclock-offset-boot sysctl tmpfs; do
enable_service boot "$svc" enable_service boot "$svc"
done 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 \ modemmanager msm8909-modem-wwan-port msm-modem-uim-selection networkmanager \
postmarketos-zram-swap q6voiced rfkill rmtfs sshd tinydm udev-postmount \ postmarketos-zram-swap q6voiced rfkill rmtfs sshd tinydm udev-postmount \
wpa_supplicant; do wpa_supplicant; do
+6
View File
@@ -108,6 +108,10 @@ EOF
echo "[2l/5] Applying MSM8909 early-SCM SMP boot address and cpufreq 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 patch -p1 < /bananarchy/patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch
fi 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 ] || \ if [ ! -f include/config/auto.conf ] || \
! grep -q "CONFIG_NETFILTER_XT_MATCH_OWNER=m" .config 2>/dev/null || \ ! grep -q "CONFIG_NETFILTER_XT_MATCH_OWNER=m" .config 2>/dev/null || \
! grep -q "CONFIG_INTERCONNECT_QCOM_MSM8909=y" .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 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..." 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 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..." echo "[3/5] Preparing kernel configuration and Module.symvers..."
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config 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..." echo "[check] Known-good flashable image set..."
for pair in \ for pair in \
"4f72a1156a2e9144386d82f10fc8078e90c69ed60446d0259dfbdf66362f47bc images/bananarchy-nokia-argon.img" \ "a0a02a8502736fae9c25de54cb8043231b2fd3ac488e123676cc8c3a35577ea1 images/bananarchy-nokia-argon.img" \
"ac29427c8582049bc5fbaa504685442a997e260eb3f74d7b92d5b999f0f4a4fa images/bananarchy-nokia-beatles.img" \ "9703ab732bac535ad83862a89c71931a4c16704b685f1bca45c23d7ac066c341 images/bananarchy-nokia-beatles.img" \
"35aa314d1d21a401412794820416c21d1d22457671489dcf05410d39daf9f7da images/boot-bananarchy-nokia-beatles.img" \ "7eab3dcf44ba01f044e9b6dba3f786aebe80a3380884966e6ecd5dafc455c16a images/boot-bananarchy-nokia-beatles.img" \
"f13db705a714aaebd2d8fcc2e0f7266d0e40268c0a276208117dfdf9d8f45351 images/boot-lk2nd-nokia-beatles-display.img" \ "f13db705a714aaebd2d8fcc2e0f7266d0e40268c0a276208117dfdf9d8f45351 images/boot-lk2nd-nokia-beatles-display.img" \
"d7bcfffdc33fefa12f173b4b3664ae02ecb4850b9f7ccf096719f2d19a799772 images/bananarchy-nokia-coconut.img" \ "5158dc6e545c975387ba29c44593afe2758a4cd926e0c43df90e8b79b72a6b37 images/bananarchy-nokia-coconut.img" \
"8ffc67df915d27b286aaf0d82186f2d52719d27c67f954f7abafbd206331efc1 images/boot-bananarchy-nokia-coconut.img" \ "d79b51d86344441f170b1ddf205b721b54ce8c995a66bb611670065911768347 images/boot-bananarchy-nokia-coconut.img" \
"9a5bd2da6cfd95c745d9c1acb2e3bc61afa339824810e3d160bf079e17b23192 images/boot-lk2nd-nokia-coconut-display.img" \ "9a5bd2da6cfd95c745d9c1acb2e3bc61afa339824810e3d160bf079e17b23192 images/boot-lk2nd-nokia-coconut-display.img" \
"d3da5d807c8c53c4c6e153fa3a03155ec2d9e1a854ba29ed18d61dba77fb0174 images/bananarchy-nokia-sparkler.img" \ "90ff40226f344d280b7a9cca1d23fb587cc987255c375b57969b3fd415c786b4 images/bananarchy-nokia-sparkler.img" \
"b46341849e509e71272a946829d3742881dbdb8ed33a58f6a6316288cbb8bb36 images/boot-bananarchy-nokia-sparkler.img" \ "4e1ddbfd5acc8335cb3e3e50b3fef46b9c6fe93afdaa9c2c0826500e63b60adf images/boot-bananarchy-nokia-sparkler.img" \
"120ade81bc5416263a1afd95a29981675358b98516e105e5ed611edf258a29f7 images/boot-lk2nd-nokia-sparkler-display.img"; do "120ade81bc5416263a1afd95a29981675358b98516e105e5ed611edf258a29f7 images/boot-lk2nd-nokia-sparkler-display.img"; do
set -- $pair set -- $pair
want=$1 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" fail "$svc does not start its compiled daemon"
fi fi
done 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 "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh"; then
fail "the X session no longer lowers keypad auto-repeat delay" fail "the X session no longer lowers keypad auto-repeat delay"
fi fi
@@ -941,19 +941,23 @@ if check_target nokia-beatles; then
if ! grep -qF 'reg = <0x80000000 0x20000000>;' "$BEATLES_DTS"; then if ! grep -qF 'reg = <0x80000000 0x20000000>;' "$BEATLES_DTS"; then
fail "nokia-beatles DTS lost the 512 MiB memory fallback" fail "nokia-beatles DTS lost the 512 MiB memory fallback"
fi fi
if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-beatles.img" ]; then if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then
if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py"; then echo "[skip] --for-rebuild: skipping pre-rebuild 2720 boot/raw image checks"
fail "2720 boot image validation failed"
fi
else else
echo "[skip] local build output images/boot-bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it" if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-beatles.img" ]; then
fi if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py"; then
if [ -f "$BASE_DIR/images/bananarchy-nokia-beatles.img" ]; then fail "2720 boot image validation failed"
if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --raw-image "$BASE_DIR/images/bananarchy-nokia-beatles.img"; then fi
fail "2720 raw image pmOS_boot filesystem is damaged or stale" 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 fi
else
echo "[skip] local build output images/bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it"
fi fi
fi fi
@@ -975,14 +979,18 @@ if check_target nokia-coconut; then
if grep -q 'switch-lid-' "$COCONUT_DTS"; then if grep -q 'switch-lid-' "$COCONUT_DTS"; then
fail "nokia-coconut DTS still carries phantom slider lid-switch nodes" fail "nokia-coconut DTS still carries phantom slider lid-switch nodes"
fi 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 if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py" --device nokia-coconut; then
fail "800 Tough boot image validation failed" fail "800 Tough boot image validation failed"
fi fi
else else
echo "[skip] local build output images/boot-bananarchy-nokia-coconut.img is absent; prepare-release.sh will rebuild it" echo "[skip] local build output images/boot-bananarchy-nokia-coconut.img is absent; prepare-release.sh will rebuild it"
fi 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 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" fail "800 Tough raw image pmOS_boot filesystem is damaged or stale"
fi fi
@@ -1011,14 +1019,18 @@ if check_target nokia-sparkler nokia-leo; then
fail "nokia-sparkler DTS is missing $node" fail "nokia-sparkler DTS is missing $node"
fi fi
done 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 if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py" --device nokia-sparkler; then
fail "8000 4G boot image validation failed" fail "8000 4G boot image validation failed"
fi fi
else else
echo "[skip] local build output images/boot-bananarchy-nokia-sparkler.img is absent; prepare-release.sh will rebuild it" echo "[skip] local build output images/boot-bananarchy-nokia-sparkler.img is absent; prepare-release.sh will rebuild it"
fi 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 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" fail "8000 4G raw image pmOS_boot filesystem is damaged or stale"
fi 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 \ usr/bin/bananarchy-x11-session.sh etc/init.d/bananarchy-lid \
etc/init.d/bananarchy-sshd-debug etc/init.d/local \ etc/init.d/bananarchy-sshd-debug etc/init.d/local \
etc/local.d/20-bananarchy-sshd-debug.start; do 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 [ -e "$BASE_DIR/rootfs/$f" ] || continue
if ! cmp -s "$BASE_DIR/overlay/rootfs/$f" "$BASE_DIR/rootfs/$f"; then if ! cmp -s "$BASE_DIR/overlay/rootfs/$f" "$BASE_DIR/rootfs/$f"; then
fail "live rootfs copy drifted from overlay: $f" 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-sparkler.dts" \
"$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do
artifact_matches_target "$dts" || continue artifact_matches_target "$dts" || continue
if [ "$(grep -c 'clock-latency-ns' "$dts" 2>/dev/null || echo 0)" -ne 8 ]; then 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 8 opp nodes" fail "${dts#"$BASE_DIR/"} must declare clock-latency-ns on all 9 opp nodes"
fi fi
done done
for dts in \ for dts in \
@@ -1886,7 +1899,7 @@ fi
echo "[check] Version helper..." echo "[check] Version helper..."
# Pin the release under test so the check does not break when the wall clock # 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). # 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 set -- $pair
want_ver=$1 want_ver=$1
want_codename=$2 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 if ! "$BASE_DIR/scripts/build-beatles-cover-panel.py" --check >/dev/null 2>&1; then
fail "opt-in two-panel DTB validation failed" fail "opt-in two-panel DTB validation failed"
fi 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" fail "host 2720 Flip DT wiring validation failed"
fi fi
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 '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(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(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 ! grep -qF 'regulator_set_load(host->mmc->supply.vmmc, 2000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \
fail "kernel patch 0012, sdhci-msm HPM/LPM regulator_set_load hunks, or build-kernel-audio.sh wiring is missing" ! 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 fi
for ko in "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst" \ 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 "$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-sparkler.dts" \
"$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do
artifact_matches_target "$dts" || continue artifact_matches_target "$dts" || continue
if [ "$(grep -c 'regulator-allow-set-load;' "$dts" 2>/dev/null || echo 0)" -lt 3 ]; then if [ "$(grep -c 'regulator-allow-set-load;' "$dts" 2>/dev/null || echo 0)" -lt 3 ] || \
fail "${dts#"$BASE_DIR/"} is missing regulator-allow-set-load on l8/l12" ! grep -qF 'opp-99999975' "$dts"; then
fail "${dts#"$BASE_DIR/"} is missing regulator-allow-set-load on l8/l12 or opp-99999975"
fi fi
done done
if ! grep -qF 'msm8905_cam_spmi_restore' "$BASE_DIR/src/msm8905-cam/msm8905-cam.c" || \ 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 -- '--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 '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 '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 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" fail "one or more 72h standby optimization guards failed"
fi 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" fail "host standby power policy test failed"
fi 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..." echo "[check] microSD sdhci@7864000 non-removable and zero-polling invariants..."
for dts in \ for dts in \
"$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$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 '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 '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 '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-dwm-plugins.sh" || \
! grep -qF 'libpulse' "$BASE_DIR/scripts/build-sxmo-x11.sh"; then ! 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 fi
if ! grep -qF 'of_machine_is_compatible("nokia,sparkler")' "$TORCH_SRC" || \ if ! grep -qF 'of_machine_is_compatible("nokia,sparkler")' "$TORCH_SRC" || \
! grep -qF 'MSM8905_TLMM_GPIO31_PHYS' "$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): def appended_dtb_matches(dtb_bytes):
if "--for-rebuild" in sys.argv:
return True, "skipped (--for-rebuild)"
if not BOOT_IMAGE.is_file(): if not BOOT_IMAGE.is_file():
return True, "skipped (local build output absent)" return True, "skipped (local build output absent)"
data = BOOT_IMAGE.read_bytes() 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(spec["addrs"], (0x80008000, 0x82700000, 0x82500000))
self.assertEqual(bootfs_mod.DEVICE_DTB_NAMES["nokia-sparkler"], "qcom-msm8909-nokia-sparkler.dtb") 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__": if __name__ == "__main__":
unittest.main() unittest.main()
+16 -8
View File
@@ -240,6 +240,9 @@ def test_power_policy_rat(tmp):
res = run_policy(env, "_park_rat") res = run_policy(env, "_park_rat")
if res.returncode != 0 or qmi_log.exists(): if res.returncode != 0 or qmi_log.exists():
return fail("expected no QMI calls once gsm_unsupported 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. # 4) screenoff / screenon invoke bananarchy-dsds --sig-hysteresis dark / wake.
res = run_policy(env, "screenoff") res = run_policy(env, "screenoff")
@@ -284,18 +287,22 @@ def test_power_policy_rat(tmp):
ims_state = tmp / "ims_state.env" ims_state = tmp / "ims_state.env"
ims_conf = tmp / "ims.conf" ims_conf = tmp / "ims.conf"
accept_ra = tmp / "accept_ra" accept_ra = tmp / "accept_ra"
disable_ipv6 = tmp / "disable_ipv6"
write_text(ims_conf, "keep_lte_on_screen_off=1\n") 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(ims_state, "VOLTE_ACTIVE=1\nVOWIFI_ACTIVE=0\nVOWIFI_IPV6_EPDG=0\n")
write_text(accept_ra, "1\n") write_text(accept_ra, "1\n")
write_text(disable_ipv6, "0\n")
env["BANANARCHY_IMS_STATE_PATH"] = str(ims_state) env["BANANARCHY_IMS_STATE_PATH"] = str(ims_state)
env["BANANARCHY_IMS_CONF_PATH"] = str(ims_conf) env["BANANARCHY_IMS_CONF_PATH"] = str(ims_conf)
env["BANANARCHY_ACCEPT_RA_PATH"] = str(accept_ra) env["BANANARCHY_ACCEPT_RA_PATH"] = str(accept_ra)
env["BANANARCHY_DISABLE_IPV6_PATH"] = str(disable_ipv6)
res = run_policy(env, "_park_rat") res = run_policy(env, "_park_rat")
if res.returncode != 0 or (rundir / "rat_parked").exists(): if res.returncode != 0 or (rundir / "rat_parked").exists():
return fail("active VoLTE (without VoWiFi) must skip GSM RAT parking") 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, # 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. # and sets disable_ipv6=1, while VOWIFI_IPV6_EPDG=1 preserves both across
# screenoff/screenon.
mock_bin = tmp / "bin" mock_bin = tmp / "bin"
mock_ip = mock_bin / "ip" mock_ip = mock_bin / "ip"
write_text(mock_ip, """#!/bin/sh 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(ims_state, "VOLTE_ACTIVE=1\nVOWIFI_ACTIVE=1\nVOWIFI_IPV6_EPDG=0\n")
write_text(accept_ra, "1\n") write_text(accept_ra, "1\n")
write_text(disable_ipv6, "0\n")
res = run_policy(env, "screenoff") res = run_policy(env, "screenoff")
if res.returncode != 0 or accept_ra.read_text().strip() != "0": 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 on screenoff") return fail("VOWIFI_IPV6_EPDG=0 must mute wlan0 accept_ra and set disable_ipv6=1 on screenoff")
deadline = time.monotonic() + 3.0 deadline = time.monotonic() + 3.0
while time.monotonic() < deadline and not (rundir / "rat_parked").exists(): while time.monotonic() < deadline and not (rundir / "rat_parked").exists():
time.sleep(0.05) time.sleep(0.05)
@@ -320,13 +328,13 @@ exit 0
if not (rundir / "rat_parked").exists(): if not (rundir / "rat_parked").exists():
return fail("active VoWiFi screenoff should allow cellular GSM standby parking") return fail("active VoWiFi screenoff should allow cellular GSM standby parking")
res = run_policy(env, "screenon") res = run_policy(env, "screenon")
if res.returncode != 0 or accept_ra.read_text().strip() != "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 to 1") 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") write_text(ims_state, "VOLTE_ACTIVE=1\nVOWIFI_ACTIVE=1\nVOWIFI_IPV6_EPDG=1\n")
res = run_policy(env, "screenoff") res = run_policy(env, "screenoff")
if res.returncode != 0 or accept_ra.read_text().strip() != "1": 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") return fail("VOWIFI_IPV6_EPDG=1 must keep wlan0 accept_ra unmuted and disable_ipv6=0")
deadline = time.monotonic() + 3.0 deadline = time.monotonic() + 3.0
while time.monotonic() < deadline and not (rundir / "rat_parked").exists(): while time.monotonic() < deadline and not (rundir / "rat_parked").exists():
time.sleep(0.05) 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}}" VERSION="${BANANARCHY_VERSION:-${YEAR_LETTER}${MONTH}${DAY}}"
case "$VERSION" in case "$VERSION" in
a1125) DEFAULT_CODENAME=ampere ;;
a1120) DEFAULT_CODENAME=cocojamboo ;; a1120) DEFAULT_CODENAME=cocojamboo ;;
a1114) DEFAULT_CODENAME=carbonara ;; a1114) DEFAULT_CODENAME=carbonara ;;
a1111) DEFAULT_CODENAME=lennon ;; a1111) DEFAULT_CODENAME=lennon ;;
+133 -11
View File
@@ -7,15 +7,90 @@
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <pango/pangoxft.h> #include <pango/pangoxft.h>
#include <fcntl.h>
#include <poll.h> #include <poll.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h>
#include <clocale> #include <clocale>
namespace { namespace {
using namespace bananarchy; using namespace bananarchy;
constexpr const char* kSparklerSpeakerAf =
"lavfi=[highpass=f=260:poles=2,highpass=f=260:poles=2,"
"bandreject=f=157:width_type=h:w=80]";
bool isHapticAudioSpeakerDevice() {
const char* env = std::getenv("BANANARCHY_HAPTIC_AUDIO_GUARD");
if (env && *env == '1') return true;
if (env && *env == '0') return false;
static int cached = -1;
if (cached >= 0) return cached == 1;
int fd = ::open("/sys/firmware/devicetree/base/compatible",
O_RDONLY | O_CLOEXEC);
if (fd < 0) {
cached = 0;
return false;
}
char buf[256];
ssize_t n = ::read(fd, buf, sizeof(buf) - 1);
::close(fd);
if (n <= 0) {
cached = 0;
return false;
}
buf[n] = '\0';
const char* p = buf;
const char* end = buf + n;
while (p < end && *p) {
if (std::strcmp(p, "nokia,sparkler") == 0 ||
std::strcmp(p, "nokia,leo") == 0) {
cached = 1;
return true;
}
p += std::strlen(p) + 1;
}
cached = 0;
return false;
}
std::string normalizeAudioRoute(const std::string& raw) {
std::string low = toLowerStr(raw);
if (low.find("bluetooth") != std::string::npos ||
low.find("bluez") != std::string::npos) {
return "Bluetooth";
}
if (low.find("headphone") != std::string::npos ||
low.find("headset") != std::string::npos) {
return "Headphones";
}
if (low.find("earpiece") != std::string::npos) {
return "Earpiece";
}
return "Speaker";
}
std::string readActiveAudioRoute(const std::string& cfgDir) {
std::string outDev;
{
std::ifstream ifs("/tmp/sxmo_audio_out_device");
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
return normalizeAudioRoute(outDev);
}
}
{
std::ifstream ifs(cfgDir + "/audio_out_device");
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
return normalizeAudioRoute(outDev);
}
}
return "Speaker";
}
volatile sig_atomic_t gRunning = 1; volatile sig_atomic_t gRunning = 1;
void handleSignal(int) { void handleSignal(int) {
@@ -829,25 +904,62 @@ int runFilesApp(int argc, char** argv) {
int rvol = std::clamp(readRingVolumePct(), 0, 100); int rvol = std::clamp(readRingVolumePct(), 0, 100);
int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100); int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100);
int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100); int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
int ear = (rvol <= 0) ? 0 : (60 + (rvol * 32 + 50) / 100);
std::string cfgDir = homeDir + "/.config/sxmo";
const char* xdgCfg = std::getenv("XDG_CONFIG_HOME");
if (xdgCfg && *xdgCfg) cfgDir = std::string(xdgCfg) + "/sxmo";
bool useSparklerAf = isHapticAudioSpeakerDevice() &&
readActiveAudioRoute(cfgDir) == "Speaker";
std::string afOpt =
useSparklerAf ? (std::string("--af=") + kSparklerSpeakerAf) : "";
runAsyncCmd("outdev=$(cat /tmp/sxmo_audio_out_device 2>/dev/null); " runAsyncCmd("outdev=$(cat /tmp/sxmo_audio_out_device 2>/dev/null); "
"if [ \"$outdev\" = \"Bluetooth\" ]; then " "if [ \"$outdev\" = \"Bluetooth\" ]; then "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; " " pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ " + std::to_string(rvol) + "% >/dev/null 2>&1; " " pactl set-sink-volume @DEFAULT_SINK@ " + std::to_string(rvol) + "% >/dev/null 2>&1; "
"elif [ \"$outdev\" = \"Headphones\" ]; then " "elif [ \"$outdev\" = \"Headphones\" ]; then "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='EAR_S'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; " " amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RDAC2 MUX'\" 'RX2' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'RX2' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHL'\" 'Switch' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHR'\" 'Switch' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX2 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; " " pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; " " pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
"elif [ \"$outdev\" = \"Earpiece\" ]; then "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHL'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHR'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RDAC2 MUX'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='EAR_S'\" 'Switch' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(ear) + " >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
"else " "else "
" amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='EAR_S'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='HPHL'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHR'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; " " amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 1 >/dev/null 2>&1; " " amixer -c 0 cset \"name='SPK DAC Switch'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 3 >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" " + std::to_string(rx3) + " >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX3 Digital Volume'\" " + std::to_string(rx3) + " >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; " " pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; " " pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
@@ -868,13 +980,23 @@ int runFilesApp(int argc, char** argv) {
::dup2(devNull, STDERR_FILENO); ::dup2(devNull, STDERR_FILENO);
if (devNull > 2) ::close(devNull); if (devNull > 2) ::close(devNull);
} }
::execlp("mpv", "mpv", "--no-config", "--no-terminal", if (!afOpt.empty()) {
"--no-resume-playback", "--quiet", "--vo=null", ::execlp("mpv", "mpv", "--no-config", "--no-terminal",
"--no-video", "--ao=pipewire,pulse,alsa", "--no-resume-playback", "--quiet", "--vo=null",
"--audio-channels=stereo", "--audio-samplerate=48000", "--no-video", "--ao=pipewire,pulse,alsa",
"--volume-max=150", "--volume=100", "--audio-channels=stereo", "--audio-samplerate=48000",
"--loop=2", playTarget.c_str(), "--volume-max=150", "--volume=100", afOpt.c_str(),
static_cast<char*>(nullptr)); "--loop=2", playTarget.c_str(),
static_cast<char*>(nullptr));
} else {
::execlp("mpv", "mpv", "--no-config", "--no-terminal",
"--no-resume-playback", "--quiet", "--vo=null",
"--no-video", "--ao=pipewire,pulse,alsa",
"--audio-channels=stereo", "--audio-samplerate=48000",
"--volume-max=150", "--volume=100",
"--loop=2", playTarget.c_str(),
static_cast<char*>(nullptr));
}
::_exit(127); ::_exit(127);
} else if (pid > 0) { } else if (pid > 0) {
ringPreviewPid = pid; ringPreviewPid = pid;
+114 -5
View File
@@ -77,6 +77,45 @@ struct BrowserItem {
}; };
constexpr const char* kMpvSockPath = "/tmp/xmusic_mpv.sock"; constexpr const char* kMpvSockPath = "/tmp/xmusic_mpv.sock";
constexpr const char* kSparklerSpeakerAf =
"lavfi=[highpass=f=260:poles=2,highpass=f=260:poles=2,"
"bandreject=f=157:width_type=h:w=80]";
bool isHapticAudioSpeakerDevice() {
const char* env = std::getenv("BANANARCHY_HAPTIC_AUDIO_GUARD");
if (env && *env == '1') return true;
if (env && *env == '0') return false;
static int cached = -1;
if (cached >= 0) return cached == 1;
int fd = ::open("/sys/firmware/devicetree/base/compatible",
O_RDONLY | O_CLOEXEC);
if (fd < 0) {
cached = 0;
return false;
}
char buf[256];
ssize_t n = ::read(fd, buf, sizeof(buf) - 1);
::close(fd);
if (n <= 0) {
cached = 0;
return false;
}
buf[n] = '\0';
const char* p = buf;
const char* end = buf + n;
while (p < end && *p) {
if (std::strcmp(p, "nokia,sparkler") == 0 ||
std::strcmp(p, "nokia,leo") == 0) {
cached = 1;
return true;
}
p += std::strlen(p) + 1;
}
cached = 0;
return false;
}
std::string getExtLower(const std::string& name) { std::string getExtLower(const std::string& name) {
size_t dot = name.rfind('.'); size_t dot = name.rfind('.');
@@ -258,6 +297,39 @@ std::string getConfigDirPath() {
return getHomePath() + "/.config/sxmo"; return getHomePath() + "/.config/sxmo";
} }
std::string normalizeAudioRoute(const std::string& raw) {
std::string low = toLowerStr(raw);
if (low.find("bluetooth") != std::string::npos ||
low.find("bluez") != std::string::npos) {
return "Bluetooth";
}
if (low.find("headphone") != std::string::npos ||
low.find("headset") != std::string::npos) {
return "Headphones";
}
if (low.find("earpiece") != std::string::npos) {
return "Earpiece";
}
return "Speaker";
}
std::string readActiveAudioRoute() {
std::string outDev;
{
std::ifstream ifs("/tmp/sxmo_audio_out_device");
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
return normalizeAudioRoute(outDev);
}
}
{
std::ifstream ifs(getConfigDirPath() + "/audio_out_device");
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
return normalizeAudioRoute(outDev);
}
}
return "Speaker";
}
int readSavedSpeakerVol() { int readSavedSpeakerVol() {
std::string outDev = "Speaker"; std::string outDev = "Speaker";
{ {
@@ -371,6 +443,7 @@ int runMusicApp(int argc, char** argv) {
int ipcFd = -1; int ipcFd = -1;
std::string ipcReadBuf; std::string ipcReadBuf;
std::string pendingLoadPath; std::string pendingLoadPath;
std::string appliedMpvAf;
bool isPlaying = false; bool isPlaying = false;
bool isPaused = false; bool isPaused = false;
double timePosSec = 0.0; double timePosSec = 0.0;
@@ -401,12 +474,24 @@ int runMusicApp(int argc, char** argv) {
return w == static_cast<ssize_t>(msg.size()); return w == static_cast<ssize_t>(msg.size());
}; };
auto syncSparklerMpvFilter = [&](bool force = false) {
if (!isHapticAudioSpeakerDevice() || ipcFd < 0) return;
std::string wantAf =
(readActiveAudioRoute() == "Speaker") ? kSparklerSpeakerAf : "";
if (!force && wantAf == appliedMpvAf) return;
if (sendIpcRaw("{\"command\":[\"set_property\",\"af\",\"" +
jsonEscape(wantAf) + "\"]}")) {
appliedMpvAf = wantAf;
}
};
auto stopMpvDaemon = [&]() { auto stopMpvDaemon = [&]() {
if (ipcFd >= 0) { if (ipcFd >= 0) {
::close(ipcFd); ::close(ipcFd);
ipcFd = -1; ipcFd = -1;
} }
ipcReadBuf.clear(); ipcReadBuf.clear();
appliedMpvAf.clear();
if (mpvPid > 0) { if (mpvPid > 0) {
::kill(mpvPid, SIGTERM); ::kill(mpvPid, SIGTERM);
for (int i = 0; i < 15; ++i) { for (int i = 0; i < 15; ++i) {
@@ -430,9 +515,16 @@ int runMusicApp(int argc, char** argv) {
::close(ipcFd); ::close(ipcFd);
ipcFd = -1; ipcFd = -1;
} }
appliedMpvAf.clear();
} }
} }
if (mpvPid <= 0) { if (mpvPid <= 0) {
bool wantSpeakerFilter =
isHapticAudioSpeakerDevice() && readActiveAudioRoute() == "Speaker";
std::string afOpt = wantSpeakerFilter
? (std::string("--af=") + kSparklerSpeakerAf)
: "";
appliedMpvAf = wantSpeakerFilter ? kSparklerSpeakerAf : "";
::unlink(kMpvSockPath); ::unlink(kMpvSockPath);
pid_t pid = ::fork(); pid_t pid = ::fork();
if (pid == 0) { if (pid == 0) {
@@ -452,11 +544,21 @@ int runMusicApp(int argc, char** argv) {
} }
std::string ipcArg = std::string ipcArg =
std::string("--input-ipc-server=") + kMpvSockPath; std::string("--input-ipc-server=") + kMpvSockPath;
::execlp("mpv", "mpv", "--no-video", "--no-terminal", "--quiet", if (!afOpt.empty()) {
"--ao=pipewire,pulse,alsa", "--audio-channels=stereo", ::execlp("mpv", "mpv", "--no-config", "--no-video", "--no-terminal",
"--audio-samplerate=48000", "--idle=yes", "--keep-open=no", "--quiet", "--ao=pipewire,pulse,alsa",
"--volume-max=150", "--volume=100", ipcArg.c_str(), "--audio-channels=stereo", "--audio-samplerate=48000",
static_cast<char*>(nullptr)); "--idle=yes", "--keep-open=no", "--volume-max=150",
"--volume=100", afOpt.c_str(), ipcArg.c_str(),
static_cast<char*>(nullptr));
} else {
::execlp("mpv", "mpv", "--no-config", "--no-video", "--no-terminal",
"--quiet", "--ao=pipewire,pulse,alsa",
"--audio-channels=stereo", "--audio-samplerate=48000",
"--idle=yes", "--keep-open=no", "--volume-max=150",
"--volume=100", ipcArg.c_str(),
static_cast<char*>(nullptr));
}
::_exit(127); ::_exit(127);
} else if (pid > 0) { } else if (pid > 0) {
mpvPid = pid; mpvPid = pid;
@@ -482,6 +584,7 @@ int runMusicApp(int argc, char** argv) {
sendIpcRaw("{\"command\":[\"observe_property\",2,\"duration\"]}"); sendIpcRaw("{\"command\":[\"observe_property\",2,\"duration\"]}");
sendIpcRaw("{\"command\":[\"observe_property\",3,\"pause\"]}"); sendIpcRaw("{\"command\":[\"observe_property\",3,\"pause\"]}");
sendIpcRaw("{\"command\":[\"observe_property\",4,\"media-title\"]}"); sendIpcRaw("{\"command\":[\"observe_property\",4,\"media-title\"]}");
syncSparklerMpvFilter(true);
if (!pendingLoadPath.empty()) { if (!pendingLoadPath.empty()) {
std::string p = pendingLoadPath; std::string p = pendingLoadPath;
pendingLoadPath.clear(); pendingLoadPath.clear();
@@ -532,6 +635,7 @@ int runMusicApp(int argc, char** argv) {
ensureMpvRunning(); ensureMpvRunning();
if (tryConnectIpc()) { if (tryConnectIpc()) {
syncSparklerMpvFilter(false);
sendIpcRaw("{\"command\":[\"loadfile\",\"" + jsonEscape(loadTarget) + sendIpcRaw("{\"command\":[\"loadfile\",\"" + jsonEscape(loadTarget) +
"\",\"replace\"]}"); "\",\"replace\"]}");
sendIpcRaw("{\"command\":[\"set_property\",\"pause\",false]}"); sendIpcRaw("{\"command\":[\"set_property\",\"pause\",false]}");
@@ -1481,6 +1585,9 @@ int runMusicApp(int argc, char** argv) {
if (mpvPid > 0 && ipcFd < 0) { if (mpvPid > 0 && ipcFd < 0) {
tryConnectIpc(); tryConnectIpc();
} }
if (isPlaying && !isPaused && ipcFd >= 0) {
syncSparklerMpvFilter(false);
}
if (drainIpcSocket() && visible) { if (drainIpcSocket() && visible) {
render(); render();
} }
@@ -1559,6 +1666,8 @@ int runMusicApp(int argc, char** argv) {
for (const auto& cmd : readFifoLines(fifoFd)) { for (const auto& cmd : readFifoLines(fifoFd)) {
if (cmd == "CLOSE") { if (cmd == "CLOSE") {
hideWindow(); hideWindow();
} else if (cmd == "AUDIO_ROUTE") {
syncSparklerMpvFilter(false);
} else if (cmd == "RELOAD_THEME") { } else if (cmd == "RELOAD_THEME") {
pt.reload(); pt.reload();
if (visible) render(); if (visible) render();
+143 -16
View File
@@ -10,9 +10,11 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <pango/pangoxft.h> #include <pango/pangoxft.h>
#include <dirent.h> #include <dirent.h>
#include <fcntl.h>
#include <poll.h> #include <poll.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h>
#include <clocale> #include <clocale>
#ifdef None #ifdef None
@@ -23,6 +25,79 @@ namespace {
using namespace bananarchy; using namespace bananarchy;
constexpr const char* kSparklerSpeakerAf =
"lavfi=[highpass=f=260:poles=2,highpass=f=260:poles=2,"
"bandreject=f=157:width_type=h:w=80]";
bool isHapticAudioSpeakerDevice() {
const char* env = std::getenv("BANANARCHY_HAPTIC_AUDIO_GUARD");
if (env && *env == '1') return true;
if (env && *env == '0') return false;
static int cached = -1;
if (cached >= 0) return cached == 1;
int fd = ::open("/sys/firmware/devicetree/base/compatible",
O_RDONLY | O_CLOEXEC);
if (fd < 0) {
cached = 0;
return false;
}
char buf[256];
ssize_t n = ::read(fd, buf, sizeof(buf) - 1);
::close(fd);
if (n <= 0) {
cached = 0;
return false;
}
buf[n] = '\0';
const char* p = buf;
const char* end = buf + n;
while (p < end && *p) {
if (std::strcmp(p, "nokia,sparkler") == 0 ||
std::strcmp(p, "nokia,leo") == 0) {
cached = 1;
return true;
}
p += std::strlen(p) + 1;
}
cached = 0;
return false;
}
std::string normalizeAudioRoute(const std::string& raw) {
std::string low = toLowerStr(raw);
if (low.find("bluetooth") != std::string::npos ||
low.find("bluez") != std::string::npos) {
return "Bluetooth";
}
if (low.find("headphone") != std::string::npos ||
low.find("headset") != std::string::npos) {
return "Headphones";
}
if (low.find("earpiece") != std::string::npos) {
return "Earpiece";
}
return "Speaker";
}
std::string readActiveAudioRoute(const std::string& cfgDir) {
std::string outDev;
{
std::ifstream ifs("/tmp/sxmo_audio_out_device");
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
return normalizeAudioRoute(outDev);
}
}
{
std::ifstream ifs(cfgDir + "/audio_out_device");
if (ifs && std::getline(ifs, outDev) && !outDev.empty()) {
return normalizeAudioRoute(outDev);
}
}
return "Speaker";
}
volatile sig_atomic_t gRunning = 1; volatile sig_atomic_t gRunning = 1;
void handleSignal(int) { void handleSignal(int) {
@@ -501,27 +576,61 @@ int runRingtonesApp(int argc, char** argv) {
int rvol = std::clamp(settings.ringVol, 0, 100); int rvol = std::clamp(settings.ringVol, 0, 100);
int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100); int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100);
int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100); int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
int ear = (rvol <= 0) ? 0 : (60 + (rvol * 32 + 50) / 100);
std::string volArg = "--volume=100"; std::string volArg = "--volume=100";
std::string loopArg = singleShot ? "--loop=no" : "--loop=2"; std::string loopArg = singleShot ? "--loop=no" : "--loop=2";
bool useSparklerAf = isHapticAudioSpeakerDevice() &&
readActiveAudioRoute(getConfigDir()) == "Speaker";
std::string afOpt =
useSparklerAf ? (std::string("--af=") + kSparklerSpeakerAf) : "";
runAsyncCmd("outdev=$(cat /tmp/sxmo_audio_out_device 2>/dev/null); " runAsyncCmd("outdev=$(cat /tmp/sxmo_audio_out_device 2>/dev/null); "
"if [ \"$outdev\" = \"Bluetooth\" ]; then " "if [ \"$outdev\" = \"Bluetooth\" ]; then "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; " " pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ " + std::to_string(rvol) + "% >/dev/null 2>&1; " " pactl set-sink-volume @DEFAULT_SINK@ " + std::to_string(rvol) + "% >/dev/null 2>&1; "
"elif [ \"$outdev\" = \"Headphones\" ]; then " "elif [ \"$outdev\" = \"Headphones\" ]; then "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='EAR_S'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; " " amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RDAC2 MUX'\" 'RX2' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'RX2' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHL'\" 'Switch' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHR'\" 'Switch' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX2 Digital Volume'\" " + std::to_string(hp) + " >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; " " pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; " " pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
"elif [ \"$outdev\" = \"Earpiece\" ]; then "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHL'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHR'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RDAC2 MUX'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='EAR_S'\" 'Switch' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 Digital Volume'\" " + std::to_string(ear) + " >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
"else " "else "
" amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='EAR_S'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 0 >/dev/null 2>&1; " " amixer -c 0 cset \"name='HPHL'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='HPHR'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 MIX1 INP1'\" 'ZERO' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX1 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX2 Digital Volume'\" 0 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; " " amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='SPK DAC Switch'\" 1 >/dev/null 2>&1; " " amixer -c 0 cset \"name='SPK DAC Switch'\" 1 >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 3 >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 'RX1' >/dev/null 2>&1; "
" amixer -c 0 cset \"name='RX3 Digital Volume'\" " + std::to_string(rx3) + " >/dev/null 2>&1; " " amixer -c 0 cset \"name='RX3 Digital Volume'\" " + std::to_string(rx3) + " >/dev/null 2>&1; "
" pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; " " pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1; "
" pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; " " pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1; "
@@ -545,19 +654,37 @@ int runRingtonesApp(int argc, char** argv) {
if (devNull > 2) ::close(devNull); if (devNull > 2) ::close(devNull);
} }
if (singleShot) { if (singleShot) {
::execlp("mpv", "mpv", "--no-config", "--no-terminal", if (!afOpt.empty()) {
"--no-resume-playback", "--quiet", "--vo=null", ::execlp("mpv", "mpv", "--no-config", "--no-terminal",
"--no-video", "--ao=pipewire,pulse,alsa", "--no-resume-playback", "--quiet", "--vo=null",
"--audio-channels=stereo", "--audio-samplerate=48000", "--no-video", "--ao=pipewire,pulse,alsa",
"--volume-max=150", volArg.c_str(), "--audio-channels=stereo", "--audio-samplerate=48000",
"--end=6", loopArg.c_str(), playTarget.c_str(), nullptr); "--volume-max=150", volArg.c_str(), afOpt.c_str(),
"--end=6", loopArg.c_str(), playTarget.c_str(), nullptr);
} else {
::execlp("mpv", "mpv", "--no-config", "--no-terminal",
"--no-resume-playback", "--quiet", "--vo=null",
"--no-video", "--ao=pipewire,pulse,alsa",
"--audio-channels=stereo", "--audio-samplerate=48000",
"--volume-max=150", volArg.c_str(),
"--end=6", loopArg.c_str(), playTarget.c_str(), nullptr);
}
} else { } else {
::execlp("mpv", "mpv", "--no-config", "--no-terminal", if (!afOpt.empty()) {
"--no-resume-playback", "--quiet", "--vo=null", ::execlp("mpv", "mpv", "--no-config", "--no-terminal",
"--no-video", "--ao=pipewire,pulse,alsa", "--no-resume-playback", "--quiet", "--vo=null",
"--audio-channels=stereo", "--audio-samplerate=48000", "--no-video", "--ao=pipewire,pulse,alsa",
"--volume-max=150", volArg.c_str(), "--audio-channels=stereo", "--audio-samplerate=48000",
loopArg.c_str(), playTarget.c_str(), nullptr); "--volume-max=150", volArg.c_str(), afOpt.c_str(),
loopArg.c_str(), playTarget.c_str(), nullptr);
} else {
::execlp("mpv", "mpv", "--no-config", "--no-terminal",
"--no-resume-playback", "--quiet", "--vo=null",
"--no-video", "--ao=pipewire,pulse,alsa",
"--audio-channels=stereo", "--audio-samplerate=48000",
"--volume-max=150", volArg.c_str(),
loopArg.c_str(), playTarget.c_str(), nullptr);
}
} }
::_exit(127); ::_exit(127);
} else if (pid > 0) { } else if (pid > 0) {