Restore unconditional BAM-DMUX wwan0 open for ModemManager and add primary-SIM QMI VOICE USSD fallback
MMPluginQcomSoc requires net/wwan0 to export /org/freedesktop/ModemManager1/Modem/0, so gating --dpm-open-port on type=gsm NetworkManager profiles left ModemManager with 'No modems were found' on Wi-Fi-only setups while bam-dmux already runtime-suspends in 1000 ms (pc_state=0) when idle. - Always open the BAM-DMUX QMI DPM port in msm8909-modem-wwan-port before ModemManager starts and keep wwan0 registered across NetworkManager down events. - Add -d qrtr://0 fallback and late-open mmcli rescan handling in bananarchy-dpm.sh and msm-modem-uim-selection provision_slot(). - Resolve mm_modem via mmcli -L in msm-modem-uim-selection ussd and fall back to direct AF_QIPCRTR QMI VOICE USSD (sub=0) on the primary SIM alongside sub=1 on the secondary SIM. - Rebuild and pin nokia-argon and nokia-beatles a1114 (carbonara) images and update guards and docs.
This commit is contained in:
1 parent
c95a84c69c
commit
b2cf028808
8 files changed
+246
-120
No files matched your search
@@ -358,7 +358,7 @@ few places where the regression checks mandated by the analysis changed the impl
|
||||
| K8 | `earlycon` and `console=ttyMSM0,115200` removed from all `devices/*/kernel-cmdline.conf` and from `usr/lib/kernel-cmdline.d/50-device-*.conf` in the overlay. |
|
||||
| K9 | Unused built-in input classes and LED triggers disabled; netfilter/IPv6/cgroups deliberately retained (see K7); `msm8905-cam` retained in `/etc/modules` because its out-of-tree platform driver has no udev autoload path — removing it would break `xcamera`. |
|
||||
| K10 | `net.ipv6.conf.default.disable_ipv6=1` in `etc/sysctl.d/99-bananarchy-power.conf` and `10-power-save.start`; the `ipv6` module stays loaded for WireGuard/Tor and `::1` on `lo`. |
|
||||
| K11 | On-demand QMI DPM port (`bananarchy-dpm.sh` + NM dispatcher + conditional boot open); `wakeup-source` on pronto. QMI NAS DRX/MICO withdrawn (C17). |
|
||||
| K11 | `wakeup-source` on pronto; unconditional boot-time QMI DPM `--dpm-open-port` restored in `a1114` (section 20.3) because `MMPluginQcomSoc` requires `net/wwan0` to create `/org/freedesktop/ModemManager1/Modem/0` while `bam-dmux.c` already runtime-suspends in `1000 ms` (`pc_state=0`, DMA channels released) whenever idle. QMI NAS DRX/MICO withdrawn (C17); AT `$QCDRX=6` shipped in section 20. |
|
||||
| K12 | **Deferred with justification**: damage/partial-window updates in `panel-mipi-dbi` need panel-specific GC9305/GC9307 commands and risk display corruption. The equivalent userspace win (no full-frame redraw on every statusbar tick) is delivered by U3. |
|
||||
| K13 | `CONFIG_ZRAM_DEF_COMP_LZ4=y`, `zram-init` `algo*=lz4`, `/tmp` mounted as `tmpfs` via `etc/fstab`. |
|
||||
| K14 | `CONFIG_ENERGY_MODEL` enabled; `CONFIG_RCU_NOCB_CPU`/`CONFIG_RCU_LAZY` are dependency-gated (`RCU_EXPERT || NO_HZ_FULL`) and were dropped by `olddefconfig`, so they are not active. `rcu_nocbs=all` deliberately **not** added to the cmdline: on a 2-core MSM8905 it would add always-running `rcuo` kthreads, trading away the idle saving. |
|
||||
@@ -370,7 +370,7 @@ few places where the regression checks mandated by the analysis changed the impl
|
||||
| U6 | `etc/chrony/chrony.conf` uses `minpoll 12 maxpoll 16` with `iburst` restored; `bananarchy-time-sync.sh` refreshes the pool on network-up (section 16). |
|
||||
| U7 | Withdrawn (C1); the cosmetic `yesno` typo in `etc/init.d/wpa_supplicant` was fixed anyway. |
|
||||
| U8 | `[device] wifi.scan-interval=600` in `10-power.conf`; IPv6 disabled on new interfaces (K10). |
|
||||
| U9 | On-demand DPM port; `dsds-daemon` 600 s -> 1800 s poll and 2 s -> 30 s error backoff; `sxmo_modemmonitor.sh` 10/120 s -> 30/600 s. |
|
||||
| U9 | `dsds-daemon` 600 s -> 1800 s poll (and `poll_timeout = None` while dark in section 20) plus 2 s -> 30 s error backoff; `sxmo_modemmonitor.sh` 10/120 s -> 30/600 s. Conditional DPM port gating reverted in section 20.3 (`bam-dmux` already runtime-suspends in `1000 ms` when idle, whereas omitting `net/wwan0` broke `ModemManager` on Wi-Fi-only setups). |
|
||||
| U10 | Withdrawn (C3); the outer `pactl subscribe` restart backoff raised 2 s -> 10 s. |
|
||||
| U11 | `sip_plugin.cpp` 15 s -> 60 s poll; `tox_plugin.cpp` iteration clamp 250-1000 ms -> 1000-2000 ms. `locker_plugin.cpp` already blocks indefinitely when blanked; `gps_plugin.cpp`'s `usleep(300000)` is in the `--test` CLI path only. |
|
||||
| U12 | `tmpfs` on `/tmp`; zram `lz4`, `noatime`, `size1=256`. |
|
||||
@@ -463,9 +463,10 @@ worth doing to unlock them.
|
||||
(`SLOT1_REG_STATE=registered / lte / -67 dBm`,
|
||||
`SLOT2_REG_STATE=registered / gsm / -66 dBm`), so DSDS RF was active during
|
||||
the measurement. Caveat: `mmcli -L` reported `No modems were found` in this
|
||||
session even though QMI NAS showed both SIMs registered; the ModemManager
|
||||
modem object was absent. That is a separate functional issue and does not
|
||||
remove the modem RF drain.
|
||||
session even though QMI NAS showed both SIMs registered; as root-caused and
|
||||
fixed in section 20.3, `U9`'s conditional `--dpm-open-port` gating left
|
||||
`net/wwan0` unregistered on Wi-Fi-only setups, causing `MMPluginQcomSoc` to
|
||||
abort modem probing without affecting modem RF registration.
|
||||
- Idle windows ran with the panel forced dark (`brightness=0`, `bl_power=4`,
|
||||
DPMS `Off`) via `bananarchy-idle-blank.sh off`.
|
||||
- **Session incident**: at ~22 min uptime the phone stopped responding (blank
|
||||
@@ -1302,3 +1303,34 @@ display controller active continuously without `CONFIG_SUSPEND`:
|
||||
(`msleep(50)`) under `drm_dev_enter()` after `backlight_disable()`, halting
|
||||
the panel boost converter and 60 Hz GRAM scan while leaving the 2720 Flip
|
||||
`backend = kernel` cover path (`DPMS On` during closed cover wake) intact.
|
||||
|
||||
### 20.3 Post-test fix: unconditional BAM-DMUX `wwan0` registration for `ModemManager` and QMI VOICE USSD fallback
|
||||
|
||||
Live testing on a Nokia 2720 Flip (`nokia-beatles`) running on Wi-Fi without an
|
||||
existing `type=gsm` NetworkManager connection profile surfaced `error: couldn't
|
||||
find modem` when sending USSD queries on SIM 1:
|
||||
|
||||
- **Root cause**: `MMPluginQcomSoc` (`libmm-plugin-qcom-soc.so`) sets
|
||||
`base-modem-data-net-supported = TRUE` and
|
||||
`base-modem-data-tty-supported = FALSE`, so `ModemManager` refuses to export
|
||||
`/org/freedesktop/ModemManager1/Modem/0` (`"Failed to find a data port in the
|
||||
modem"`) unless `bam-dmux` has registered `net/wwan0`. `bam-dmux` only
|
||||
creates `net/wwan0` after MPSS sends `BAM_DMUX_CMD_OPEN` in response to
|
||||
`qmicli --dpm-open-port=hw-data-ep-type=bam-dmux,...`. Gating `--dpm-open-port`
|
||||
on `type=gsm` `.nmconnection` files (`U9` / `K11`) broke `ModemManager`
|
||||
discovery on Wi-Fi-only setups (the same `"No modems were found"` symptom
|
||||
noted in section 14.1). Meanwhile, inspecting `drivers/net/ethernet/qualcomm/bam-dmux.c`
|
||||
confirmed that `bam-dmux` already uses `BAM_DMUX_AUTOSUSPEND_DELAY = 1000` ms
|
||||
runtime PM autosuspend, dropping `bam_dmux_pc_vote(dmux, false)` (`pc_state=0`)
|
||||
and releasing TX/RX BAM DMA channels after 1 s of inactivity — so keeping the
|
||||
DPM port open at boot adds zero idle power draw.
|
||||
- **Fix**: `etc/init.d/msm8909-modem-wwan-port` (and `provision_slot()` /
|
||||
`bananarchy-dpm.sh open`) now opens the BAM-DMUX QMI DPM port unconditionally
|
||||
before `ModemManager` starts and waits for `/sys/class/net/wwan0` (triggering
|
||||
`mmcli -S` if `wwan0` is opened late while `ModemManager` has no modem), and
|
||||
`10-bananarchy-dpm.sh` no longer closes the DPM port on NetworkManager `down`
|
||||
events. In addition, `msm-modem-uim-selection ussd` resolves `mm_modem` via
|
||||
`mmcli -L` instead of `mmcli -m any` and falls back to direct QMI VOICE USSD
|
||||
over `AF_QIPCRTR` (`QMI_SERVICE_VOICE = 9`, `sub = 0`) for the primary SIM
|
||||
just like `sub = 1` on the secondary SIM, preserving interactive multi-step
|
||||
`/tmp/sxmo_ussd_session_state` sessions even if `ModemManager` is unavailable.
|
||||
+2
-1
@@ -21,12 +21,13 @@ Upcoming release build (`a1114` / `carbonara` via `scripts/version.sh`) targetin
|
||||
- **ChipIdea USB runtime PM while unplugged (`ci_hdrc_msm`)**: enabled `CI_HDRC_SUPPORTS_RUNTIME_PM`, wrapped `ci_hdrc_msm_por_reset()` in `pm_runtime_resume_and_get()`/`pm_runtime_put()`, gated `iface_clk` (`100 MHz`) and `core_clk` (`80 MHz`) via `RUNTIME_PM_OPS` whenever `vbus_extcon` is disconnected, and skipped `ULPI_SYNC_STATE` viewport polling in `ci_ulpi_resume()` when `CI_HDRC_OVERRIDE_PHY_CONTROL` is set so USB RNDIS (`172.16.42.1`) hotplug and plugged boots resume cleanly.
|
||||
- **Default dual-port DSDS `MODEM_DRX_MODE=6` and dark-screen `dsds-daemon` sleep**: `bananarchy-power-policy.conf` now defaults to `MODEM_DRX_MODE=6` while keeping `DSDS_SECONDARY_MODE=active` so both SIMs remain reachable; `msm-modem-uim-selection` adds `at all` multi-port queries and `screen_is_idle()` in `dsds-daemon` (`poll_timeout = None` whenever locked, cover-lit, or backlight off); and `bananarchy-power-policy.sh` serializes AT access via `flock`, waits past `ModemManager`'s startup AT port probe, and re-applies `AT$QCDRX=6` across every `/dev/wwan0at*` port on `modem-ready` (`sxmo_hook_modem.sh` `registered`/`connected` and post-PIN/switch registration) with per-port inode caching in `/run/bananarchy-power-policy/drx.<port>`.
|
||||
- **MIPI DCS `DISPOFF` + `SLPIN` on `panel-mipi-dbi` DPMS off**: rebuilt `panel-mipi-dbi.ko.zst` with `panel_mipi_dbi_disable()` issuing `0x28` (`msleep(20)`) + `0x10` (`msleep(50)`) under `drm_dev_enter()` after `backlight_disable()` and before `mipi_dbi_pipe_disable()`, stopping the GC9305/ST7789V boost converter and 60 Hz GRAM scan during DPMS off while preserving the 2720 Flip closed-only `backend = kernel` cover path.
|
||||
- **Unconditional `net/wwan0` BAM-DMUX registration for `ModemManager` and primary-SIM QMI VOICE USSD fallback**: fixed `error: couldn't find modem` when running USSD or `mmcli` operations on Wi-Fi-only setups without a saved `type=gsm` NetworkManager profile. Because `MMPluginQcomSoc` sets `base-modem-data-net-supported = TRUE` and `base-modem-data-tty-supported = FALSE`, `ModemManager` drops `/org/freedesktop/ModemManager1/Modem/0` whenever `net/wwan0` is absent, while `bam-dmux.c` already runtime-suspends after `1000 ms` of inactivity (`pc_state=0`, DMA channels released) at zero standby cost. `etc/init.d/msm8909-modem-wwan-port` and `msm-modem-uim-selection` (`provision_slot()` / `bananarchy-dpm.sh open`) now open `--dpm-open-port=hw-data-ep-type=bam-dmux,...` unconditionally and wait for `/sys/class/net/wwan0` (running `mmcli -S` if opened after `ModemManager` startup), `10-bananarchy-dpm.sh` no longer closes the DPM port on interface `down`, and `msm-modem-uim-selection ussd` resolves `mm_modem` via `mmcli -L` and falls back to direct `AF_QIPCRTR` QMI VOICE USSD (`QMI_SERVICE_VOICE = 9`, `sub = 0`) on the primary SIM alongside `sub = 1` on the secondary SIM.
|
||||
|
||||
### Dual-target idle wakeup elimination and GPU/scheduler power sync
|
||||
|
||||
- **2720 Flip event-driven idle daemons (`nokia-beatles`)**: replaced `bananarchy-lid`'s continuous `20 ms` (`50 Hz`) `poll()` loop, `10 Hz` `/sys/kernel/debug/gpio` full SoC GPIO register dump, and `2 s` `/dev/input` `glob` + `/run/bananarchy/cover.sock` broadcast with `/dev/input` `inotify` watching plus hardware `EV_SW` IRQ sleep (`poll(..., -1)` at `0` steady-state wakeups/s after the `20 ms` edge debounce and one `+2 s` post-transition confirmation check), and synchronized CPU `scaling_governor`, `schedutil/rate_limit_us` (`40000`), and Adreno 304 `governor` directly in `on_transition()`. Replaced `bananarchy-volume-keys`'s `1 s` `poll()` + `2 s` `/dev/input` `glob` loop with `/dev/input` `inotify` + `poll(..., -1)`.
|
||||
- **Shared GPU `devfreq`, `schedutil`, statusbar, eMMC, and Bluetooth idle fixes (`nokia-argon` and `nokia-beatles`)**: granted `video`-group `0664` permissions to `/sys/class/devfreq/1c00000.gpu/governor` in `10-power-save.start`, synced `1c00000.gpu/governor` (`powersave` while dark or cover-lit, `simple_ondemand` when the main panel wakes) in `bananarchy-display-power-sync` and `locker.so`, and restored `schedutil/rate_limit_us = 40000` on `FORCE=1` transitions as well as normal udev events. `sxmo_hook_statusbar.sh` skips `sxmo_hook_icons.sh` on `time` ticks and updates `099-time` directly in-shell without spawning `sxmo_status.sh` and duplicate `mkdir -p` forks every minute; `sxmo_wm.sh display off` skips rewriting `~/.config/sxmo/brightness` on ext4 when unchanged; `sxmo_hook_screenoff.sh` skips spawning `sxmo_autosuspend.sh` when `/etc/bananarchy-no-deep-standby` is present; and `bananarchy-bt-obex` replaces its `1.0 s` D-Bus/RFCOMM poll and `1.5-2.0 s` `/dev/input` gamepad scan with a signal self-pipe, `ctypes` `inotify`, and blocking `select.select(..., None)` (`0` idle wakeups/s when Bluetooth is enabled, `<5 ms` gamepad hotplug).
|
||||
- **Image persistence and upcoming release archives**: rebuilt both `images/bananarchy-nokia-argon.img` (SHA-256 `3be4664961482bbe811512613d85d932d53298d46c0f87e3a0dfdb3173ac7f00`) and `images/bananarchy-nokia-beatles.img` (SHA-256 `0178e8c3d5f8dec79cdfda28a73044ea8f65b5cf0d9cbb7c7b12a55e65b46b8a`, with standalone `images/boot-bananarchy-nokia-beatles.img` SHA-256 `4e16742bc1c2461cd6a63f15009a2c0a8550dae7adf7f1ab83209d3df21726ae` and unchanged display lk2nd `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d`) stamped as `a1114` / `carbonara` with `--mkinitfs`, pinned in `scripts/check-rebuild.sh`, and packaged into `bananarchy-nokia-argon-a1114-carbonara.zip` and `bananarchy-nokia-beatles-a1114-carbonara.zip`.
|
||||
- **Image persistence and upcoming release archives**: rebuilt both `images/bananarchy-nokia-argon.img` (SHA-256 `76da5b9d9ed555ebebe76ba79222ef4211c1a4c50437755f0abdbcc0c99449d4`) and `images/bananarchy-nokia-beatles.img` (SHA-256 `81d62838c2a105dfaf339a6e71016e215e8e68e8857eb46d3a24fe2fd691cce7`, with standalone `images/boot-bananarchy-nokia-beatles.img` SHA-256 `4e16742bc1c2461cd6a63f15009a2c0a8550dae7adf7f1ab83209d3df21726ae` and unchanged display lk2nd `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d`) stamped as `a1114` / `carbonara` with `--mkinitfs`, pinned in `scripts/check-rebuild.sh`, and packaged into `bananarchy-nokia-argon-a1114-carbonara.zip` and `bananarchy-nokia-beatles-a1114-carbonara.zip`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/bin/sh
|
||||
# U9: only keep the modem data port open while a cellular connection is up.
|
||||
# Ensure the QMI BAM-DMUX data port is open on cellular up; never close it on
|
||||
# down because unregistering net/wwan0 causes ModemManager (qcom-soc) to drop
|
||||
# the modem object, and bam-dmux already runtime-suspends in 1000 ms when idle.
|
||||
[ "$1" = "qrtr0" ] || [ "$1" = "wwan0" ] || exit 0
|
||||
case "$2" in
|
||||
up|vpn-up) /usr/bin/bananarchy-dpm.sh open ;;
|
||||
down|vpn-down) /usr/bin/bananarchy-dpm.sh close ;;
|
||||
up|vpn-up) /usr/bin/bananarchy-dpm.sh open ;;
|
||||
esac
|
||||
exit 0
|
||||
@@ -18,28 +18,41 @@ start() {
|
||||
|
||||
QMICLI_MODEM=""
|
||||
count=0
|
||||
while [ -z "$QMICLI_MODEM" ] && [ "$count" -lt 12 ]; do
|
||||
while [ -z "$QMICLI_MODEM" ] && [ "$count" -lt 15 ]; do
|
||||
if timeout 3 qmicli --silent -pd qrtr://0 --uim-noop >/dev/null 2>&1; then
|
||||
QMICLI_MODEM="timeout 4 qmicli --silent -pd qrtr://0"
|
||||
break
|
||||
elif timeout 3 qmicli --silent -d qrtr://0 --uim-noop >/dev/null 2>&1; then
|
||||
QMICLI_MODEM="timeout 4 qmicli --silent -d qrtr://0"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
count=$((count + 1))
|
||||
done
|
||||
|
||||
# U9: only open the BAM-DMUX data port when a cellular data profile is
|
||||
# actually configured. Otherwise the NetworkManager dispatcher opens it
|
||||
# on demand (see 10-bananarchy-dpm.sh).
|
||||
_need_dpm=0
|
||||
# Always open the BAM-DMUX QMI DPM port at boot so bam-dmux registers
|
||||
# net/wwan0 before ModemManager starts: MMPluginQcomSoc requires a net/*
|
||||
# data port to export /org/freedesktop/ModemManager1/Modem/0 (needed for
|
||||
# USSD, GPS, and SMS/call D-Bus signals), while bam-dmux.c runtime-suspends
|
||||
# automatically after 1000 ms (pc_state=0, DMA released) whenever idle.
|
||||
if [ -n "$QMICLI_MODEM" ]; then
|
||||
attempt=0
|
||||
while [ "$attempt" -lt 3 ] && [ ! -d /sys/class/net/wwan0 ]; do
|
||||
$QMICLI_MODEM --dpm-open-port=hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1 >/dev/null 2>&1 || true
|
||||
w=0
|
||||
while [ "$w" -lt 15 ] && [ ! -d /sys/class/net/wwan0 ]; do
|
||||
sleep 0.1
|
||||
w=$((w + 1))
|
||||
done
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
fi
|
||||
|
||||
for f in /etc/NetworkManager/system-connections/*.nmconnection; do
|
||||
[ -f "$f" ] || continue
|
||||
if grep -q "^type=gsm" "$f" 2>/dev/null; then
|
||||
_need_dpm=1
|
||||
sed -i '/^\[ipv6\]/,/^\[/ s/^method=auto$/method=ignore/' "$f" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
if [ "$_need_dpm" = "1" ] && [ -n "$QMICLI_MODEM" ]; then
|
||||
$QMICLI_MODEM --dpm-open-port=hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1 >/dev/null 2>&1 || true
|
||||
fi
|
||||
eend 0
|
||||
}
|
||||
@@ -1,14 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Open/close the QMI BAM-DMUX data port on demand (U9/K11).
|
||||
# With Wi-Fi as the default route and no cellular data profile there is no
|
||||
# reason to keep the modem data plane open at boot.
|
||||
QMICLI="qmicli --silent -pd qrtr://0"
|
||||
# Open/close the QMI BAM-DMUX data port. Keep it open during normal operation
|
||||
# so bam-dmux exposes net/wwan0 for ModemManager's qcom-soc plugin (bam-dmux
|
||||
# runtime-suspends after 1000 ms of inactivity with pc_state=0).
|
||||
DPM_ARGS="hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1"
|
||||
case "${1:-}" in
|
||||
open)
|
||||
$QMICLI --dpm-open-port=hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1 >/dev/null 2>&1 || true
|
||||
had_wwan0=0
|
||||
[ -d /sys/class/net/wwan0 ] && had_wwan0=1
|
||||
if ! timeout 4 qmicli --silent -pd qrtr://0 --dpm-open-port="$DPM_ARGS" >/dev/null 2>&1; then
|
||||
timeout 4 qmicli --silent -d qrtr://0 --dpm-open-port="$DPM_ARGS" >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [ "$had_wwan0" -eq 0 ]; then
|
||||
w=0
|
||||
while [ "$w" -lt 25 ] && [ ! -d /sys/class/net/wwan0 ]; do
|
||||
sleep 0.1
|
||||
w=$((w + 1))
|
||||
done
|
||||
if [ -d /sys/class/net/wwan0 ] && command -v mmcli >/dev/null 2>&1; then
|
||||
if ! timeout 2 mmcli -L 2>/dev/null | grep -q '/Modem/'; then
|
||||
timeout 3 mmcli -S >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
close)
|
||||
$QMICLI --dpm-close-port=hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1 >/dev/null 2>&1 || true
|
||||
if ! timeout 4 qmicli --silent -pd qrtr://0 --dpm-close-port="$DPM_ARGS" >/dev/null 2>&1; then
|
||||
timeout 4 qmicli --silent -d qrtr://0 --dpm-close-port="$DPM_ARGS" >/dev/null 2>&1 || true
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf 'Usage: %s [open|close]\n' "${0##*/}" >&2
|
||||
|
||||
@@ -479,6 +479,19 @@ provision_slot() {
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [ ! -d /sys/class/net/wwan0 ]; then
|
||||
if [ -x /usr/bin/bananarchy-dpm.sh ]; then
|
||||
/usr/bin/bananarchy-dpm.sh open >/dev/null 2>&1 || true
|
||||
else
|
||||
$QMICLI_MODEM --dpm-open-port=hw-data-ep-type=bam-dmux,hw-data-ep-iface-number=1,hw-data-rx-id=1,hw-data-tx-id=1 >/dev/null 2>&1 || true
|
||||
_w=0
|
||||
while [ "$_w" -lt 20 ] && [ ! -d /sys/class/net/wwan0 ]; do
|
||||
sleep 0.1
|
||||
_w=$((_w + 1))
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
QMI_CARDS="$($QMICLI_MODEM --uim-get-card-status 2>/dev/null || true)"
|
||||
count=0
|
||||
while : ; do
|
||||
@@ -1462,14 +1475,14 @@ PY
|
||||
sec_slot="${SECONDARY_GW_SLOT:-0}"
|
||||
fi
|
||||
fi
|
||||
# If requested SIM is Secondary GW, use QMI VOICE USSD on sub=1
|
||||
if [ "$req_sim" = "$sec_slot" ] && [ "$sec_slot" != "0" ] && command -v python3 >/dev/null 2>&1; then
|
||||
qmi_ussd="$(python3 - "$ussd_mode" "$ussd_code" "1" << 'PY' 2>/dev/null || true
|
||||
run_qmi_voice_ussd() {
|
||||
command -v python3 >/dev/null 2>&1 || return 1
|
||||
python3 - "$1" "$2" "$3" << 'PY' 2>/dev/null
|
||||
import os, socket, struct, select, sys, time
|
||||
|
||||
mode = sys.argv[1]
|
||||
code = sys.argv[2]
|
||||
sub = int(sys.argv[3]) if len(sys.argv) > 3 and sys.argv[3].isdigit() else 1
|
||||
sub = int(sys.argv[3]) if len(sys.argv) > 3 and sys.argv[3].isdigit() else 0
|
||||
AF_QIPCRTR = 42
|
||||
QRTR_PORT_CTRL = 0xfffffffe
|
||||
QRTR_TYPE_NEW_SERVER = 4
|
||||
@@ -1603,112 +1616,137 @@ while time.time() < deadline:
|
||||
s.close()
|
||||
sys.exit(1)
|
||||
PY
|
||||
)"
|
||||
}
|
||||
# If requested SIM is Secondary GW, use QMI VOICE USSD on sub=1
|
||||
if [ "$req_sim" = "$sec_slot" ] && [ "$sec_slot" != "0" ]; then
|
||||
qmi_ussd="$(run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "1" || true)"
|
||||
if [ -n "$qmi_ussd" ]; then
|
||||
printf "%s\n" "$qmi_ussd"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
mm_out=""
|
||||
if [ "$req_sim" = "$prim_slot" ]; then
|
||||
mm_state="$(mmcli -m any -K 2>/dev/null | awk -F':[[:space:]]*' '{gsub(/[[:space:]]+$/, "", $1); if ($1 == "modem.generic.state") {print $2; exit}}' || true)"
|
||||
if [ "$mm_state" = "disabled" ] || [ -z "$mm_state" ]; then
|
||||
mmcli -m any -e >/dev/null 2>&1 || true
|
||||
sleep 1
|
||||
qmi_sess=""
|
||||
[ -r /tmp/sxmo_ussd_session_state ] && { read -r qmi_sess < /tmp/sxmo_ussd_session_state 2>/dev/null || qmi_sess=""; }
|
||||
mm_modem=""
|
||||
if [ "$ussd_mode" != "respond" ] || [ "$qmi_sess" != "user-response" ]; then
|
||||
mm_modem="$(mmcli -L 2>/dev/null | awk '{for (i=1; i<=NF; i++) if ($i ~ /^\/org\/freedesktop\/ModemManager1\/Modem\/[0-9]+$/) {print $i; exit}}')"
|
||||
fi
|
||||
modem_dbus_path="$(mmcli -m any -K 2>/dev/null | awk -F':[[:space:]]*' '{gsub(/[[:space:]]+$/, "", $1); if ($1 == "modem.dbus-path") {print $2; exit}}' || true)"
|
||||
[ -z "$modem_dbus_path" ] && modem_dbus_path="/org/freedesktop/ModemManager1/Modem/0"
|
||||
get_ussd_prop() {
|
||||
prop_name="$1"
|
||||
if [ -n "$modem_dbus_path" ] && command -v busctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
|
||||
busctl -j get-property org.freedesktop.ModemManager1 "$modem_dbus_path" \
|
||||
org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd "$prop_name" 2>/dev/null | \
|
||||
jq -r '.data // empty' 2>/dev/null || true
|
||||
if [ -n "$mm_modem" ]; then
|
||||
rm -f /tmp/sxmo_ussd_session_state
|
||||
mm_state="$(mmcli -m "$mm_modem" -K 2>/dev/null | awk -F':[[:space:]]*' '{gsub(/[[:space:]]+$/, "", $1); if ($1 == "modem.generic.state") {print $2; exit}}' || true)"
|
||||
if [ "$mm_state" = "disabled" ] || [ -z "$mm_state" ]; then
|
||||
mmcli -m "$mm_modem" -e >/dev/null 2>&1 || true
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
get_ussd_state() {
|
||||
mmcli -m any --3gpp-ussd-status -K 2>/dev/null | \
|
||||
awk -F':[[:space:]]*' '{gsub(/[[:space:]]+$/, "", $1); if ($1 == "modem.3gpp.ussd.status" || $1 == "modem.3gpp.ussd.state") {print $2; exit}}' || true
|
||||
}
|
||||
prev_notif="$(get_ussd_prop NetworkNotification)"
|
||||
prev_req="$(get_ussd_prop NetworkRequest)"
|
||||
ussd_st="$(get_ussd_state)"
|
||||
if [ "$ussd_mode" = "respond" ] && [ "$ussd_st" != "user-response" ]; then
|
||||
case "$ussd_code" in
|
||||
\**\#|\#*\#)
|
||||
ussd_mode="initiate"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ev_file="/tmp/ussd_dbus_$$.log"
|
||||
rm -f "$ev_file"
|
||||
if command -v dbus-monitor >/dev/null 2>&1; then
|
||||
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd'" >"$ev_file" 2>/dev/null &
|
||||
ev_pid=$!
|
||||
else
|
||||
ev_pid=""
|
||||
fi
|
||||
cleanup_ev() {
|
||||
if [ -n "${ev_pid:-}" ]; then
|
||||
kill "$ev_pid" 2>/dev/null || true
|
||||
wait "$ev_pid" 2>/dev/null || true
|
||||
modem_dbus_path="$mm_modem"
|
||||
get_ussd_prop() {
|
||||
prop_name="$1"
|
||||
if [ -n "$modem_dbus_path" ] && command -v busctl >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then
|
||||
busctl -j get-property org.freedesktop.ModemManager1 "$modem_dbus_path" \
|
||||
org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd "$prop_name" 2>/dev/null | \
|
||||
jq -r '.data // empty' 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
get_ussd_state() {
|
||||
mmcli -m "$mm_modem" --3gpp-ussd-status -K 2>/dev/null | \
|
||||
awk -F':[[:space:]]*' '{gsub(/[[:space:]]+$/, "", $1); if ($1 == "modem.3gpp.ussd.status" || $1 == "modem.3gpp.ussd.state") {print $2; exit}}' || true
|
||||
}
|
||||
prev_notif="$(get_ussd_prop NetworkNotification)"
|
||||
prev_req="$(get_ussd_prop NetworkRequest)"
|
||||
ussd_st="$(get_ussd_state)"
|
||||
if [ "$ussd_mode" = "respond" ] && [ "$ussd_st" != "user-response" ]; then
|
||||
case "$ussd_code" in
|
||||
\**\#|\#*\#)
|
||||
ussd_mode="initiate"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ev_file="/tmp/ussd_dbus_$$.log"
|
||||
rm -f "$ev_file"
|
||||
}
|
||||
mm_rc=0
|
||||
mm_out=""
|
||||
if [ "$ussd_mode" = "respond" ]; then
|
||||
mm_out="$(mmcli --timeout=30 -m any --3gpp-ussd-respond="$ussd_code" 2>&1)" || mm_rc=$?
|
||||
else
|
||||
if [ "$ussd_st" = "active" ] || [ "$ussd_st" = "user-response" ]; then
|
||||
mmcli -m any --3gpp-ussd-cancel >/dev/null 2>&1 || true
|
||||
if command -v dbus-monitor >/dev/null 2>&1; then
|
||||
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd'" >"$ev_file" 2>/dev/null &
|
||||
ev_pid=$!
|
||||
else
|
||||
ev_pid=""
|
||||
fi
|
||||
mm_out="$(mmcli --timeout=30 -m any --3gpp-ussd-initiate="$ussd_code" 2>&1)" || mm_rc=$?
|
||||
fi
|
||||
if [ "$mm_rc" -eq 0 ] && [ -n "$mm_out" ]; then
|
||||
reply="$(printf "%s\n" "$mm_out" | sed \
|
||||
-e "1s/^USSD session initiated; new reply from network: '//" \
|
||||
-e "1s/^response successfully sent in USSD session; new reply from network: '//" \
|
||||
-e "1s/^USSD response sent; new reply from network: '//" \
|
||||
-e "\$s/'$//")"
|
||||
if [ -n "$reply" ]; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$reply"
|
||||
exit 0
|
||||
cleanup_ev() {
|
||||
if [ -n "${ev_pid:-}" ]; then
|
||||
kill "$ev_pid" 2>/dev/null || true
|
||||
wait "$ev_pid" 2>/dev/null || true
|
||||
fi
|
||||
rm -f "$ev_file"
|
||||
}
|
||||
mm_rc=0
|
||||
if [ "$ussd_mode" = "respond" ]; then
|
||||
mm_out="$(mmcli --timeout=30 -m "$mm_modem" --3gpp-ussd-respond="$ussd_code" 2>&1)" || mm_rc=$?
|
||||
else
|
||||
if [ "$ussd_st" = "active" ] || [ "$ussd_st" = "user-response" ]; then
|
||||
mmcli -m "$mm_modem" --3gpp-ussd-cancel >/dev/null 2>&1 || true
|
||||
fi
|
||||
mm_out="$(mmcli --timeout=30 -m "$mm_modem" --3gpp-ussd-initiate="$ussd_code" 2>&1)" || mm_rc=$?
|
||||
fi
|
||||
fi
|
||||
# Check if the USSD response arrived asynchronously via D-Bus properties
|
||||
w=0
|
||||
while [ "$w" -lt 15 ]; do
|
||||
cur_req="$(get_ussd_prop NetworkRequest)"
|
||||
cur_notif="$(get_ussd_prop NetworkNotification)"
|
||||
cur_st="$(get_ussd_state)"
|
||||
if [ -n "$cur_req" ] && { [ "$cur_req" != "$prev_req" ] || [ "$cur_st" = "user-response" ] || grep -q "NetworkRequest" "$ev_file" 2>/dev/null; }; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$cur_req"
|
||||
exit 0
|
||||
if [ "$mm_rc" -eq 0 ] && [ -n "$mm_out" ]; then
|
||||
reply="$(printf "%s\n" "$mm_out" | sed \
|
||||
-e "1s/^USSD session initiated; new reply from network: '//" \
|
||||
-e "1s/^response successfully sent in USSD session; new reply from network: '//" \
|
||||
-e "1s/^USSD response sent; new reply from network: '//" \
|
||||
-e "\$s/'$//")"
|
||||
if [ -n "$reply" ]; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$reply"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ -n "$cur_notif" ] && { [ "$cur_notif" != "$prev_notif" ] || grep -q "NetworkNotification" "$ev_file" 2>/dev/null || printf "%s" "$mm_out" | grep -q "USSD terminated by network"; }; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$cur_notif"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$cur_st" != "active" ] && [ "$w" -ge 3 ]; then
|
||||
if [ -n "$cur_req" ]; then
|
||||
# Check if the USSD response arrived asynchronously via D-Bus properties
|
||||
w=0
|
||||
while [ "$w" -lt 15 ]; do
|
||||
cur_req="$(get_ussd_prop NetworkRequest)"
|
||||
cur_notif="$(get_ussd_prop NetworkNotification)"
|
||||
cur_st="$(get_ussd_state)"
|
||||
if [ -n "$cur_req" ] && { [ "$cur_req" != "$prev_req" ] || [ "$cur_st" = "user-response" ] || grep -q "NetworkRequest" "$ev_file" 2>/dev/null; }; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$cur_req"
|
||||
exit 0
|
||||
fi
|
||||
if [ -n "$cur_notif" ]; then
|
||||
if [ -n "$cur_notif" ] && { [ "$cur_notif" != "$prev_notif" ] || grep -q "NetworkNotification" "$ev_file" 2>/dev/null || printf "%s" "$mm_out" | grep -q "USSD terminated by network"; }; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$cur_notif"
|
||||
exit 0
|
||||
fi
|
||||
break
|
||||
fi
|
||||
sleep 0.2
|
||||
w=$((w + 1))
|
||||
done
|
||||
cleanup_ev
|
||||
if [ "$cur_st" != "active" ] && [ "$w" -ge 3 ]; then
|
||||
if [ -n "$cur_req" ]; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$cur_req"
|
||||
exit 0
|
||||
fi
|
||||
if [ -n "$cur_notif" ]; then
|
||||
cleanup_ev
|
||||
printf "%s\n" "$cur_notif"
|
||||
exit 0
|
||||
fi
|
||||
break
|
||||
fi
|
||||
sleep 0.2
|
||||
w=$((w + 1))
|
||||
done
|
||||
cleanup_ev
|
||||
fi
|
||||
# Fallback to direct QMI VOICE USSD on sub=0 when ModemManager is unavailable or fails
|
||||
qmi_ussd="$(run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "0" || true)"
|
||||
if [ -n "$qmi_ussd" ]; then
|
||||
printf "%s\n" "$qmi_ussd"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
fallback_sub="0"
|
||||
[ "$req_sim" = "2" ] && fallback_sub="1"
|
||||
qmi_ussd="$(run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "$fallback_sub" || true)"
|
||||
if [ -n "$qmi_ussd" ]; then
|
||||
printf "%s\n" "$qmi_ussd"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# Fallback to direct AT+CUSD on the requested SIM AT port
|
||||
if [ "$req_sim" = "$sec_slot" ] && [ "$sec_slot" != "0" ]; then
|
||||
@@ -1751,11 +1789,14 @@ PY
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
if [ -n "${mm_out:-}" ]; then
|
||||
printf "%s\n" "$mm_out"
|
||||
else
|
||||
echo "ERROR: USSD request failed"
|
||||
fi
|
||||
case "${mm_out:-}" in
|
||||
""|*"couldn't find modem"*)
|
||||
echo "ERROR: USSD request failed"
|
||||
;;
|
||||
*)
|
||||
printf "%s\n" "$mm_out"
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
;;
|
||||
|
||||
|
||||
@@ -175,7 +175,9 @@ chown 0:0 "$TARGET_ROOTFS/etc/chrony/chrony.conf" \
|
||||
"$TARGET_ROOTFS/usr/local/bin/bluetoothctl" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-scan.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-le-enable.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-dpm.sh" \
|
||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" \
|
||||
2>/dev/null || true
|
||||
@@ -199,7 +201,9 @@ chmod 0755 "$TARGET_ROOTFS/usr/bin/bananarchy-idle-blank.sh" \
|
||||
"$TARGET_ROOTFS/usr/local/bin/bluetoothctl" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-scan.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-le-enable.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-dpm.sh" \
|
||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" \
|
||||
2>/dev/null || true
|
||||
|
||||
@@ -372,8 +372,8 @@ fi
|
||||
|
||||
echo "[check] Known-good flashable image set..."
|
||||
for pair in \
|
||||
"3be4664961482bbe811512613d85d932d53298d46c0f87e3a0dfdb3173ac7f00 images/bananarchy-nokia-argon.img" \
|
||||
"0178e8c3d5f8dec79cdfda28a73044ea8f65b5cf0d9cbb7c7b12a55e65b46b8a images/bananarchy-nokia-beatles.img" \
|
||||
"76da5b9d9ed555ebebe76ba79222ef4211c1a4c50437755f0abdbcc0c99449d4 images/bananarchy-nokia-argon.img" \
|
||||
"81d62838c2a105dfaf339a6e71016e215e8e68e8857eb46d3a24fe2fd691cce7 images/bananarchy-nokia-beatles.img" \
|
||||
"4e16742bc1c2461cd6a63f15009a2c0a8550dae7adf7f1ab83209d3df21726ae images/boot-bananarchy-nokia-beatles.img" \
|
||||
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
|
||||
set -- $pair
|
||||
@@ -1197,6 +1197,22 @@ if ! grep -qxF 'MODEM_DRX_MODE=6' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync"; then
|
||||
fail "userspace DSDS DRX, dsds-daemon dark-screen gate, or wcn36xx screen_off_offload sync is missing"
|
||||
fi
|
||||
if ! grep -qF -- '--dpm-open-port=' "$BASE_DIR/overlay/rootfs/etc/init.d/msm8909-modem-wwan-port" || \
|
||||
grep -qF '_need_dpm' "$BASE_DIR/overlay/rootfs/etc/init.d/msm8909-modem-wwan-port" || \
|
||||
grep -qF 'bananarchy-dpm.sh close' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \
|
||||
! grep -qF 'run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "1"' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \
|
||||
! grep -qF 'run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "0"' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection"; then
|
||||
fail "BAM-DMUX wwan0 boot open for ModemManager or QMI VOICE USSD sub=0/sub=1 fallback regressed"
|
||||
fi
|
||||
for dpm_script in \
|
||||
"$BASE_DIR/overlay/rootfs/etc/init.d/msm8909-modem-wwan-port" \
|
||||
"$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-dpm.sh" \
|
||||
"$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection"; do
|
||||
if ! sh -n "$dpm_script" 2>/dev/null; then
|
||||
fail "${dpm_script#"$BASE_DIR/"} has shell syntax errors"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[check] Abjects IRC default network..."
|
||||
IRC_SRC="$BASE_DIR/src/dwm-plugins/irc_plugin.cpp"
|
||||
|
||||
Reference in new issue
Block a user