From e5db84164f0a2b0829f37e00f18f6182cbf79aff Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:53:45 -0647 Subject: [PATCH 1/9] tegu: plan Phone and Messages integration through mmd Trace the existing app, session agent, ModemManager-compatible bridge and sitd path. Record the tegu installation and unit prerequisites still missing on main, and an attended bridge-only test that preserves the running modem stack. Document the passing offline bridge and apps package suites, activation and audio limits, and the eventual board-specific image integration. --- device/tegu/TELEPHONY-APPS-PLAN.md | 160 +++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 device/tegu/TELEPHONY-APPS-PLAN.md diff --git a/device/tegu/TELEPHONY-APPS-PLAN.md b/device/tegu/TELEPHONY-APPS-PLAN.md new file mode 100644 index 000000000..564bd09e2 --- /dev/null +++ b/device/tegu/TELEPHONY-APPS-PLAN.md @@ -0,0 +1,160 @@ + +# Pixel 9a: connect Phone and Messages to sitd + +Status (2026-11-03): offline investigation on `origin/main` at `31fbcf9`. +The owner reports texts both ways and calls through `omamobile-sit` on the +palmtop. No phone contact in this investigation. This is an integration +plan, not a record of app or call-audio qualification on hardware. + +The app protocol already exists. The immediate missing layer in the +recorded tegu setup is `omamobile-mmd`, installed and running. A normal +package install is blocked by the cheetah-only dependency still on main; +sitd's packaged modem-unit dependency also needs the tegu startup work. +Those are existing, separate changes. Do not duplicate them or install +with dependency checks disabled. The first app test can use an already +running, attended sitd; it need not wait for modem startup at boot. + +## The existing path + +```text +Phone / Messages + | session bus: org.omamobile.Phone1, org.omamobile.Messages1 +omatel-agent (the logged-in user's service) + | system bus: org.freedesktop.ModemManager1 +omamobile-mmd (root, ModemManager-compatible API) + | /run/omamobile-sit/socket: JSON requests and status subscription +omamobile-sitd (the only owner of the modem channels) + | SIT / AT +modem +``` + +| Layer | What the repository already supplies | +| --- | --- | +| Apps | `omamobile-apps` depends on `omaphone` and `omamessages`; both pull in `omatel-agent`. Contacts is supplied with Phone and does not need a modem. #361 puts all three packages in the image. | +| Agent | `packages/omatel` packages the agent, its user unit and both session-bus activation files. Opening an app activates it. The disabled user unit is intentional; no root agent and no generic enablement change are needed. | +| Bridge | `packages/omamobile-mmd` owns the system-bus name normally used by ModemManager, exports modem/call/SMS objects, and checks polkit for operations. It conflicts with the real `modemmanager`; installing both is not the solution. | +| Commands | `Voice.CreateCall` plus `Call.Start` maps to sitd `dial`; `Accept`, `Hangup` and `SendDtmf` map to sitd requests. `Messaging.Create` plus `Sms.Send` maps to `sms-send` with a durable request ID. | +| Incoming events | The bridge subscribes to sitd, exports calls, reads `sms-list`, and maps deletion to `sms-delete`. The agent stores SMS before deleting them from the bridge and handles notifications and call history. | +| Privileges | Apps and agent use D-Bus. Only the bridge needs sitd's private socket. Keep socket permissions and the current polkit policy; no wheel-group workaround is needed for app access. | + +Sources: [app package](../../packages/omamobile-apps/PKGBUILD), +[agent packaging and activation](../../packages/omatel/README.md), +[bridge mappings](../../packages/omamobile-mmd/lib/bridge.py), +[socket subscription](../../packages/omamobile-mmd/lib/sitd_link.py), and +[the shared telephony plan](../../docs/TELEPHONY-APPS-PLAN.md), especially +sections 1.5 and 10.1b. The requested old cheetah plan path has moved to +`docs/TELEPHONY-APPS-PLAN.md`. + +Contacts uses the shared local vCard address book; it does not need a modem +or an additional cellular service. + +## What tegu is missing + +1. **A dependency-correct install.** `omamobile-mmd` depends on + `omamobile-modem-sit`, which depends on `omamobile-modem`, which still + depends on `omamobile-device-cheetah`. That conflicts with tegu's device + package. The existing `modem-policy-virtual` change replaces that last + dependency with `omamobile-modem-policy` and adds tegu's provider. It is + not in this base. Land/build that prerequisite first. +2. **The bridge package and its start.** The common rootfs list deliberately + omits mmd and modem-sit. Tegu's `ROOTFS_PACKAGES` does not include them. + `omamobile-mmd.service` ships disabled, has no D-Bus activation file, + and its installer creates no wants link. Merely opening an app cannot + start it. The recorded SIM runbook says mmd was not installed; current + hardware state must be checked by the human rather than inferred here. +3. **The right modem service for later automatic integration.** The shipped + `omamobile-sitd.service` requires `omamobile-modem.service`; the recorded + tegu run uses its own starter and an `/etc` copy of sitd's unit that + removes this dependency. A bridge-only test must retain the already + qualified, running stack. Do not start or restart the stock sitd unit + to attach the bridge. Package tegu's starter/order separately before + making this an image default. +4. **The tested tegu RIL and release safety.** Main still carries the older + RIL; use the independently reviewed tegu SIM fixes and safe unconfirmed + call-release behavior. Do not replace a running test RIL as part of + installing the bridge. An unconfirmed hang-up must not stop the tegu + modem in place. Call audio remains its separate route/qualification. + +There is no evidence that SMS needs an mmd APN, a tegu-specific socket +path, an extra bridge SMS transport, or a second modem daemon. The bridge +forwards SMS through sitd; sitd chooses the transport. Its modem state is +based on SIM/radio/registration and can be REGISTERED without a data bearer. +The hard-coded MM model string `Exynos Modem 5300` is misleading on tegu, +but is display metadata, not a routing selector or a reason to block SMS. + +## The smallest durable changes after the prerequisites + +- Keep `omamobile-apps` modem-independent, as #361 intends. Do not make all + images depend on the modem stack to get Phone or Contacts. +- After tegu's packaged modem start is qualified, add mmd and modem-sit to + tegu's board package list (and its packaged descriptor copy), with a + test that the descriptors agree and resolve against tegu's policy + provider without installing the cheetah device package. +- Enable only the bridge's existing relationship to sitd: + `systemctl enable omamobile-mmd.service` creates + `omamobile-sitd.service.wants/omamobile-mmd.service`. This follows a sitd + start without enabling sitd or starting the CP. Tegu's setup can do this + conditionally when mmd is installed; it need not use `--now`. +- Preserve mmd's one-way relationship: `After=omamobile-sitd.service`, no + `Requires=`, `Wants=` or activation path from the bridge to sitd or the + CP. An app opening or a bridge restart must never power the modem on. +- Test the conditional enablement with a fake systemctl, absent-package + handling, and a scratch unit root. Starting the bridge alone must not + request a CP start; starting qualified sitd must pull in the bridge. + +For the already running palmtop, the manual steps below are enough once +package dependencies are correct. The durable boot/image changes are not +prerequisites for that test. + +## Attended first test (proposed, not executed) + +Keep the existing modem sleep inhibitor throughout; suspend with the CP on +is not qualified by this work. Keep the existing once-per-boot start and +NV checks. No step below starts, stops or restarts the CP or sitd. +Run user commands in the existing graphical user's terminal, root commands +in the attended administrative session. These commands are a runbook for +the human, not authorization to contact the phone in this task. + +| Step / risk | Commands or action | Expect / pass | Stop condition | Rollback | +| --- | --- | --- | --- | --- | +| 1. Read-only / none | `uname -r`; `pacman -Q omaphone omamessages omatel-agent omamobile-mmd omamobile-modem-sit omamobile-modem`; `systemctl is-active omamobile-sitd omamobile-mmd ModemManager`; `systemctl cat omamobile-sitd`; `systemd-inhibit --list` | Record kernel/package versions, actual sitd unit, active inhibitor and existing running sitd. Missing bridge is expected initially. | No confirmed running sitd, wrong starter, competing ModemManager, or no inhibitor. | None; end this session without starting the modem. | +| 2. Install bridge / low | First review `pacman -Sp --print-format '%n %v' omamobile-mmd`. After the dependency fix is available, `pacman -S omamobile-mmd`, only if the transaction adds the bridge/dependencies without changing the running RIL, modem or device package. | No cheetah package, no tegu removal, no modem/RIL upgrade, and nothing starts the CP. | Resolver conflict or any unexpected upgrade/removal. Never use `-dd`. | Cancel before accepting the transaction; if installed, remove only the bridge after stopping it. | +| 3. Start bridge / low | Root: `systemctl start omamobile-mmd.service`; `busctl --system list --no-pager org.freedesktop.ModemManager1`; use `packages/omamobile-mmd/test/libmm-status.py` for states only. | Bus name owned by mmd, a modem object with SIM ready and expected registration; sitd/CP remain the same running instances. | Bridge cannot own the name/connect; sitd exits; hardware warning. | `systemctl stop omamobile-mmd.service`. Do not restart sitd or stop the modem. | +| 4. Agent and apps / low, screen changes | Announce first, then open Phone and Messages as the session user. `systemctl --user is-active omatel-agent`; `busctl --user list --no-pager org.omamobile.Phone1 org.omamobile.Messages1`. | Agent activates, apps see the modem instead of no-modem; Contacts opens without requiring a live modem. | Activation or authorization error. Do not weaken polkit/socket permissions. | Close apps; stop the user agent if it was started only for this test; stop mmd. | +| 5. SMS / carrier charge possible | Human sends one agreed test text in Messages, then sends one back from the other device; reopen the conversation. | One send, one received message, preserved after closing/reopening; no duplicate send on retry/reconnect. | Duplicate, uncertain delivery, or missing inbound text. Do not retry an uncertain send automatically. | Stop testing and stop the bridge; keep private message stores for diagnosis. | +| 6. Calls / medium, screen and sound | Only after the separate safe-release and call-audio checks: announce, place one ordinary agreed call from Phone, receive one, answer/decline and hang up. | UI state follows the call, release is confirmed, and the approved audio route behaves as qualified separately. | Unconfirmed release, unexpected audio level, CP/AoC/UFS fault. No emergency-number test. | Follow the attended safe-release runbook; no modem stop or second start. A reboot needs separate approval. | +| 7. Optional persistence / low | After passing, root: `systemctl enable omamobile-mmd.service` without `--now`. Inspect the resulting sitd wants link. | Bridge follows future *approved* sitd starts; sitd and modem remain disabled at boot. | Any change enabling the modem or sitd itself. | Disable only mmd if this step enabled it, then stop mmd if ending the test. | + +SMS/call numbers, contents, operator identities and object dumps remain +private. Record only states, counts, errors and test outcomes in this plan. +The read-only libmm status helper deliberately prints states and counts. + +A session that has never opened either app needs an additional activation +check before claiming always-on incoming notifications. The shell's call +watcher checks whether the agent owns its name and does not itself start +it. For this first test, open an app before arranging incoming traffic. +Keep #361's app-triggered activation policy until cold-session reception +has a separate test and an explicit decision about login activation. + +App mute/speaker controls are also separate: the shared plan records that +the agent uses callaudiod for those, while sitd owns its own voice PCMs. +A successful dial through mmd does not prove those controls affect tegu's +route. MMS and mobile-data control through ModemManager are outside this +SMS/basic-call integration; keep the existing sitd data ownership. + +## Offline evidence from this investigation + +`packages/omamobile-mmd/test/all` passed on this base with private D-Bus +and local simulator sockets. This covers API/bridge/libmm clients, the +real sitd-to-sit-sim call and SMS chain, and staged unit checks. One test +was skipped because ModemManager's reference introspection XML is absent. +The suite verifies that the bridge has no unit dependency that pulls in +the modem and no system-bus activation file. + +`packages/omamobile-apps/test/all` also passed all 12 checks, including +Phone/Messages dependencies and the absence of a common modem dependency. + +This does not run the packaged Rust agent or either GUI, does not test +tegu hardware or the current private carrier configuration, and does not +qualify polkit for the actual graphical session. The earlier full agent +chain result is recorded in the shared plan; it was not rerun here. From 2e519ecfc892ff593b7b1df26ef6285a8044e24c Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:16:56 -0647 Subject: [PATCH 2/9] tegu: attach Phone and Messages to an attended running sitd Keep sitd's canonical name while moving the modem dependency into device-owned policy drop-ins. Tegu checks an already running modem and CP ONLINE; cheetah and raven retain their existing starter relationship. Require the device policy capability during RIL upgrades. Add an opt-in telephony package with a bridge policy and attended helper. It checks live sitd readiness, refuses legacy unit shadows and competing managers, and starts only mmd and the graphical user's agent. The service recovery check permits live calls and registration loss; no helper enables or recovers the modem. Remove mmd's service-level conflict so a bridge start cannot stop another modem manager. Package exclusion and D-Bus name ownership remain. Retain the previously developed SIM, safe-release and audio changes in this stack. Validate the helper, dependency policies and composed units offline; run all seven affected/dependency package suites and build the new architecture-independent package without installing dependencies. --- device/tegu/TELEPHONY-APPS-PLAN.md | 24 ++ docs/TELEPHONY-APPS-PLAN.md | 3 +- packages/omamobile-device-cheetah/PKGBUILD | 2 +- packages/omamobile-device-cheetah/test/all | 6 + .../10-device-modem.conf | 5 + packages/omamobile-device-raven/PKGBUILD | 2 +- packages/omamobile-device-raven/test/all | 4 + .../10-device-modem.conf | 5 + packages/omamobile-device-raven/version | 2 +- packages/omamobile-device-tegu/PKGBUILD | 3 +- packages/omamobile-device-tegu/README.md | 15 + packages/omamobile-device-tegu/test/all | 4 + .../10-tegu-no-start.conf | 4 + .../10-device-modem.conf | 10 + .../systemd/omamobile-mmd.service | 3 +- packages/omamobile-mmd/test/all | 3 +- packages/omamobile-mmd/version | 2 +- packages/omamobile-modem-sit/PKGBUILD | 2 +- .../systemd/omamobile-sitd.service | 5 +- packages/omamobile-modem-sit/test/all | 3 + packages/omamobile-telephony-tegu/LICENSE | 21 ++ packages/omamobile-telephony-tegu/PKGBUILD | 19 ++ packages/omamobile-telephony-tegu/README.md | 127 ++++++++ .../bin/omamobile-tegu-mmd-attach | 192 ++++++++++++ packages/omamobile-telephony-tegu/install | 12 + .../omamobile-telephony-tegu.install | 11 + .../systemd/10-tegu-attach.conf | 8 + packages/omamobile-telephony-tegu/test/all | 30 ++ .../test/test_attach.py | 292 ++++++++++++++++++ .../test/test_units.py | 51 +++ packages/omamobile-telephony-tegu/version | 1 + 31 files changed, 860 insertions(+), 11 deletions(-) create mode 100644 packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf create mode 100644 packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf create mode 100644 packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf create mode 100644 packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf create mode 100644 packages/omamobile-telephony-tegu/LICENSE create mode 100644 packages/omamobile-telephony-tegu/PKGBUILD create mode 100644 packages/omamobile-telephony-tegu/README.md create mode 100755 packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach create mode 100755 packages/omamobile-telephony-tegu/install create mode 100644 packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install create mode 100644 packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf create mode 100755 packages/omamobile-telephony-tegu/test/all create mode 100644 packages/omamobile-telephony-tegu/test/test_attach.py create mode 100644 packages/omamobile-telephony-tegu/test/test_units.py create mode 100644 packages/omamobile-telephony-tegu/version diff --git a/device/tegu/TELEPHONY-APPS-PLAN.md b/device/tegu/TELEPHONY-APPS-PLAN.md index 564bd09e2..864ba80f1 100644 --- a/device/tegu/TELEPHONY-APPS-PLAN.md +++ b/device/tegu/TELEPHONY-APPS-PLAN.md @@ -1,6 +1,30 @@ # Pixel 9a: connect Phone and Messages to sitd +First-step implementation (2026-11-03), offline: branch `tegu-mmd-attach` +builds on this plan and the dependency fix (#363), with the existing SIM, +safe-release and opt-in tegu audio work retained. The optional +`omamobile-telephony-tegu` package installs mmd, the agent, an active-RIL +bridge policy and `omamobile-tegu-mmd-attach --check|--attach`. It enables +nothing. The canonical sitd unit now gets its modem dependency from a +device-owned drop-in: tegu uses Requisite on its already running starter, +while cheetah and raven retain Requires on their modem unit. A new +`omamobile-sitd-policy` dependency ensures these drop-ins accompany a RIL +upgrade. [Package/runbook](../../packages/omamobile-telephony-tegu/README.md). +No phone contact or hardware qualification was performed for this change. +The seven affected/dependency package suites passed; mmd and the attach +package were rerun after final ownership/recovery changes. The attach +package has 21 offline tests, including systemd verification of all three +device policies. One bridge API comparison skips missing reference XML. +The architecture-independent attach package also built offline with +makepkg (dependency installation and signing disabled). No rootfs or ARM +modem package was built by that native package check. + + +The investigation below records the older base and its missing pieces; +the first-step package implements bridge attachment, not modem boot or +cold-login qualification. + Status (2026-11-03): offline investigation on `origin/main` at `31fbcf9`. The owner reports texts both ways and calls through `omamobile-sit` on the palmtop. No phone contact in this investigation. This is an integration diff --git a/docs/TELEPHONY-APPS-PLAN.md b/docs/TELEPHONY-APPS-PLAN.md index 164c0305d..4fed50af9 100644 --- a/docs/TELEPHONY-APPS-PLAN.md +++ b/docs/TELEPHONY-APPS-PLAN.md @@ -134,7 +134,7 @@ shell status / quick settings ──────────────── └─ AoC voice PCMs (EP5/EP4), rmnet0 ``` -- **Why a separate process.** `omamobile-sitd` holds the safety model: the allow-list, the do-not-send list, durable SMS sends that never repeat, and power-off when a hangup isn't confirmed. Keeping D-Bus out of it keeps that code small and keeps its tests (`tools/sit-sim`) as they are. A crash in the bridge can't drop a call, and the bridge can restart freely, which the RIL can't (a second start-up on the same CP isn't supported). +- **Why a separate process.** `omamobile-sitd` holds the safety model: the allow-list, the do-not-send list, durable SMS sends that never repeat, and radio-off recovery for unconfirmed call release. Keeping D-Bus out of it keeps that code small and keeps its tests (`tools/sit-sim`) as they are. A crash in the bridge can't drop a call, and the bridge can restart freely, which the RIL can't (a second start-up on the same CP isn't supported). - **Why Python, with dbus-fast.** This differs from the apps, and it is Q3. The RIL is Python, and ofono2mm shows that Python with dbus-fast carries MM's whole API. The bridge is a translation layer with no performance load, and the same team reads both sides. Read Droidian's BSD-3-Clause original for structure (compatible with our MIT tree), and FuriLabs' GPL-2.0 fork for reference only. Rust with zbus is the alternative if the owner wants one language for everything new. It would add a toolchain to the system side, and the apps wouldn't share code with it anyway, since they use MM's public API. - **Changes to `omamobile-sitd`'s socket API** (T0, offline, against `tools/sit-sim`): - `subscribe`: a long-lived connection that receives one JSON event per change, with call, SMS, registration, signal and SIM events. The bridge then doesn't poll `state.json`. @@ -144,6 +144,7 @@ shell status / quick settings ──────────────── - **Packaging, as built (T1, `packages/omamobile-mmd` 0.1.0; [MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) "T0/T1: the ModemManager bridge"):** - Its own package, `omamobile-mmd`, with `conflicts=(modemmanager)` and **no `provides=`**: nothing in Arch or Arch Linux ARM hard-depends on `modemmanager` (gnome-calls, chatty, networkmanager and geoclue need only libmm-glib; mmsd-tng is AUR-only and also needs only libmm-glib). - It ships `omamobile-mmd.service`, not `ModemManager.service`, with no `dbus-org.freedesktop.ModemManager1.service` alias: `Type=dbus`, `BusName=org.freedesktop.ModemManager1`, `Conflicts=ModemManager.service`, `WantedBy=omamobile-sitd.service`, and not enabled by the package. It also ships the D-Bus bus policy (only root owns the name) and MM's polkit actions. + - Since mmd 0.1.1, the unit has no `Conflicts=ModemManager.service`: starting the bridge must not stop another modem daemon. Package conflicts and exclusive D-Bus name ownership still provide exclusion. The optional tegu integration adds Requisite on an already active sitd, a read-only service check, and an attended attachment helper; it enables neither modem nor RIL. - **No D-Bus activation file**, so no client can start the bridge. Enabled, it starts with `omamobile-sitd`. - No `mmcli` and no CLI of our own. Phone runbooks read the modem through libmm-glib with `test/libmm-status.py`; mmcli runs only in the conformance container (`test/conformance`). - **Packaging, superseded (the design before T1, kept for history; not built):** a package named `omamobile-mm` with `provides=(modemmanager)` and `conflicts=(modemmanager)`, shipping `ModemManager.service` aliased `dbus-org.freedesktop.ModemManager1.service`, the bus policy, a D-Bus activation file, and `mmcli` or a small `omamobile-mm-cli`. T1 dropped `provides=` (no package needs it), the activation file (so no client can start the bridge) and the takeover of ModemManager's unit name. diff --git a/packages/omamobile-device-cheetah/PKGBUILD b/packages/omamobile-device-cheetah/PKGBUILD index 932d52227..1c8f5d065 100644 --- a/packages/omamobile-device-cheetah/PKGBUILD +++ b/packages/omamobile-device-cheetah/PKGBUILD @@ -9,7 +9,7 @@ url="https://github.com/derekross/omarchy-mobile" license=(MIT Apache-2.0) depends=(bash systemd util-linux omamobile-keyring i2c-tools) # Keep CPIF and its link driver behind the modem's guarded startup. -provides=(omamobile-modem-policy) +provides=(omamobile-modem-policy omamobile-sitd-policy) backup=(etc/pacman.d/omamobile-mirrorlist) install=omamobile-device-cheetah.install optdepends=('omamobile-boot-update: writes kernel package updates to slot B from the boot files this package ships') diff --git a/packages/omamobile-device-cheetah/test/all b/packages/omamobile-device-cheetah/test/all index fba7eb760..12cd88a82 100755 --- a/packages/omamobile-device-cheetah/test/all +++ b/packages/omamobile-device-cheetah/test/all @@ -182,3 +182,9 @@ if [[ -f ../omamobile-modem/systemd/omamobile-modem-boot.target ]]; then || fail "the modem unit the link turns on is skipped on a phone that isn't provisioned" fi pass "sitd waits for the CP; the modem stack is on by default through the target's vendor link; sit-data needs the modem's port" + +# The canonical sitd unit gets its modem dependency from this device policy. +[[ -f $tmp/root/usr/lib/systemd/system/omamobile-sitd.service.d/10-device-modem.conf ]] \ + || fail "the device sitd policy is staged" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the package provides its sitd policy capability" +pass "the device sitd policy is staged and provided" diff --git a/packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf b/packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf new file mode 100644 index 000000000..bfa4628f3 --- /dev/null +++ b/packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Preserve this device's modem-start dependency for the canonical sitd unit. +[Unit] +Requires=omamobile-modem.service +After=omamobile-modem.service diff --git a/packages/omamobile-device-raven/PKGBUILD b/packages/omamobile-device-raven/PKGBUILD index 5f698f0b0..0153bf58d 100644 --- a/packages/omamobile-device-raven/PKGBUILD +++ b/packages/omamobile-device-raven/PKGBUILD @@ -8,7 +8,7 @@ url="https://github.com/derekross/omarchy-mobile" license=(MIT Apache-2.0) depends=(bash iproute2 jq systemd util-linux i2c-tools 'omamobile-audio>=0.5.15') # The modem's drivers stay blacklisted until its runtime loads them -provides=(omamobile-modem-policy) +provides=(omamobile-modem-policy omamobile-sitd-policy) # The [omamobile] entry in pacman.conf and its mirror list, as cheetah's # package does (rootfs/pacman.conf includes the mirror list). backup=(etc/pacman.d/omamobile-mirrorlist) diff --git a/packages/omamobile-device-raven/test/all b/packages/omamobile-device-raven/test/all index 0f3332569..07cb77cf1 100755 --- a/packages/omamobile-device-raven/test/all +++ b/packages/omamobile-device-raven/test/all @@ -69,6 +69,10 @@ done [[ $(readlink "$tmp/root/usr/lib/systemd/system-sleep/omamobile") == /usr/bin/omamobile-sleep ]] \ || fail "the sleep hook is linked into system-sleep" [ ! -e "$tmp/root/usr/bin/omamobile-sleepd" ] || fail "the sleep watcher is omamobile-shell's, not this package's" +# The canonical sitd unit gets its modem dependency from this device policy. +[[ -f $tmp/root/usr/lib/systemd/system/omamobile-sitd.service.d/10-device-modem.conf ]] \ + || fail "the device sitd policy is staged" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the package provides its sitd policy capability" pass "install stages the package" # omamobile-wlan-mac only ever sets a unicast, globally administered address diff --git a/packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf b/packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf new file mode 100644 index 000000000..bfa4628f3 --- /dev/null +++ b/packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Preserve this device's modem-start dependency for the canonical sitd unit. +[Unit] +Requires=omamobile-modem.service +After=omamobile-modem.service diff --git a/packages/omamobile-device-raven/version b/packages/omamobile-device-raven/version index 28d007539..50140e353 100644 --- a/packages/omamobile-device-raven/version +++ b/packages/omamobile-device-raven/version @@ -1 +1 @@ -0.1.32 +0.1.33 diff --git a/packages/omamobile-device-tegu/PKGBUILD b/packages/omamobile-device-tegu/PKGBUILD index da1e2b777..2732b538d 100644 --- a/packages/omamobile-device-tegu/PKGBUILD +++ b/packages/omamobile-device-tegu/PKGBUILD @@ -8,7 +8,8 @@ arch=(aarch64) url="https://github.com/derekross/omarchy-mobile" license=(MIT) depends=(bash systemd kmod bluez-utils omamobile-keyring) -provides=(omamobile-device omamobile-modem-policy) +optdepends=('omamobile-telephony-tegu: attach Phone and Messages to an attended running sitd') +provides=(omamobile-device omamobile-modem-policy omamobile-sitd-policy) conflicts=(omamobile-device) backup=(etc/pacman.d/omamobile-mirrorlist) install=omamobile-device-tegu.install diff --git a/packages/omamobile-device-tegu/README.md b/packages/omamobile-device-tegu/README.md index 5d9dafe74..604697628 100644 --- a/packages/omamobile-device-tegu/README.md +++ b/packages/omamobile-device-tegu/README.md @@ -149,3 +149,18 @@ that loaded them, from its own staged copies, not the package: the package blacklists both and starts neither. Licence: MIT. + +## Optional Phone and Messages attachment + +`omamobile-telephony-tegu` is an opt-in companion package; it installs the +ModemManager-compatible bridge and session agent without enabling or +starting the radio. Its attended helper attaches only to a running tegu +modem and sitd. See its [runbook](../omamobile-telephony-tegu/README.md). + +This device package supplies sitd's modem-unit policy under +`omamobile-sitd.service.d/10-device-modem.conf`: Requisite and ordering on +`omamobile-tegu-modem.service`, with a CP ONLINE check before any future +sitd start. It supplies no CP starter and enables neither service. It +also prevents the generic modem runtime unit from starting on tegu. +Remove any old full sitd unit copy in `/etc` using the runbook's attended +migration; the package does not delete human overrides. diff --git a/packages/omamobile-device-tegu/test/all b/packages/omamobile-device-tegu/test/all index 3a55ebd03..121d36bc5 100755 --- a/packages/omamobile-device-tegu/test/all +++ b/packages/omamobile-device-tegu/test/all @@ -147,6 +147,10 @@ for absent in usr/bin/omamobile-boot-success usr/bin/omamobile-bootctl \ usr/lib/udev/rules.d/20-omamobile-gpu-always-on.rules; do [[ ! -e $tmp/root/$absent ]] || fail "install includes $absent" done +# The canonical sitd unit gets its modem dependency from this device policy. +[[ -f $tmp/root/usr/lib/systemd/system/omamobile-sitd.service.d/10-device-modem.conf ]] \ + || fail "the device sitd policy is staged" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the package provides its sitd policy capability" pass "install stages the package, enables only the guards, and nothing that marks a slot" for m in cpif shm_ipc pcie_gs201_cp; do diff --git a/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf new file mode 100644 index 000000000..67efa018a --- /dev/null +++ b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +# The tegu starter is attended and separate. Never run the generic profile. +[Unit] +ConditionPathExists=!/usr/share/omamobile/device-tegu/version diff --git a/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf new file mode 100644 index 000000000..719317df9 --- /dev/null +++ b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: MIT +# Requisite checks the attended starter without pulling it into a start job. +# A missing/inactive tegu modem must fail, never start cheetah's modem unit. +[Unit] +Requisite=omamobile-tegu-modem.service +After=omamobile-tegu-modem.service omamobile-tegu-aoc.service + +[Service] +# Active alone is insufficient: the CP must already report ONLINE. +ExecStartPre=/usr/lib/omamobile-vendor/omamobile-modem-cp state diff --git a/packages/omamobile-mmd/systemd/omamobile-mmd.service b/packages/omamobile-mmd/systemd/omamobile-mmd.service index 6b41f159a..81fccf220 100644 --- a/packages/omamobile-mmd/systemd/omamobile-mmd.service +++ b/packages/omamobile-mmd/systemd/omamobile-mmd.service @@ -7,7 +7,8 @@ [Unit] Description=Omarchy Mobile ModemManager-compatible bridge (omamobile-sitd on D-Bus) After=dbus.service omamobile-sitd.service -Conflicts=ModemManager.service +# Bus-name ownership and package conflicts provide exclusion. Do not stop +# another modem daemon as a side effect of starting this bridge. [Service] Type=dbus diff --git a/packages/omamobile-mmd/test/all b/packages/omamobile-mmd/test/all index 3b555a4bb..f53ffa2c2 100755 --- a/packages/omamobile-mmd/test/all +++ b/packages/omamobile-mmd/test/all @@ -38,7 +38,8 @@ python3 "$stage/usr/bin/omamobile-mmd" --help >/dev/null || fail "the staged dae # the modem side, no D-Bus activation file. grep -E '^(Requires|Wants|BindsTo|Requisite)=' systemd/omamobile-mmd.service && fail "the unit pulls something in" [[ -z $(find "$stage" -path '*dbus-1/system-services*' -print -quit) ]] || fail "no D-Bus activation file" -grep -qx 'Conflicts=ModemManager.service' systemd/omamobile-mmd.service || fail "the unit conflicts with ModemManager" +! grep -qx 'Conflicts=ModemManager.service' systemd/omamobile-mmd.service \ + || fail "starting the bridge must not stop another modem daemon" if command -v systemd-analyze >/dev/null; then systemd-analyze verify --man=no "$stage/usr/lib/systemd/system/omamobile-mmd.service" 2>&1 | grep -v -e 'not executable' -e 'No such file' -e 'omamobile-sitd.service' -e '^$' && fail "unit verify" || true diff --git a/packages/omamobile-mmd/version b/packages/omamobile-mmd/version index d917d3e26..b1e80bb24 100644 --- a/packages/omamobile-mmd/version +++ b/packages/omamobile-mmd/version @@ -1 +1 @@ -0.1.2 +0.1.3 diff --git a/packages/omamobile-modem-sit/PKGBUILD b/packages/omamobile-modem-sit/PKGBUILD index c73e40211..dbf3a6726 100644 --- a/packages/omamobile-modem-sit/PKGBUILD +++ b/packages/omamobile-modem-sit/PKGBUILD @@ -10,7 +10,7 @@ license=(MIT) # mobile-broadband-provider-info: the carrier database the automatic APN # reads (GNOME, CC-PDDC; arch "any", NetworkManager already pulls it in). # polkit: the Mobile network page's helper runs through pkexec. -depends=(python iproute2 iputils systemd alsa-lib alsa-utils omamobile-modem +depends=(python iproute2 iputils systemd alsa-lib alsa-utils 'omamobile-modem>=0.1.11' omamobile-sitd-policy mobile-broadband-provider-info polkit) backup=(etc/omamobile/modem-sit.conf) install=omamobile-modem-sit.install diff --git a/packages/omamobile-modem-sit/systemd/omamobile-sitd.service b/packages/omamobile-modem-sit/systemd/omamobile-sitd.service index 83879c44e..f235d22a7 100644 --- a/packages/omamobile-modem-sit/systemd/omamobile-sitd.service +++ b/packages/omamobile-modem-sit/systemd/omamobile-sitd.service @@ -6,8 +6,9 @@ # own: a second start-up on the same CP is not supported (reboot instead). [Unit] Description=Omarchy Mobile SIT RIL (S5300 calls, SMS, registration) -Requires=omamobile-modem.service -After=omamobile-modem.service omamobile-audio.service +# The device modem-policy package supplies its modem dependency as a drop-in. +# Tegu checks an already running modem; cheetah/raven retain their starter. +After=omamobile-audio.service ConditionPathExists=/dev/umts_ipc0 [Service] diff --git a/packages/omamobile-modem-sit/test/all b/packages/omamobile-modem-sit/test/all index bba38d704..231ef6a10 100755 --- a/packages/omamobile-modem-sit/test/all +++ b/packages/omamobile-modem-sit/test/all @@ -48,4 +48,7 @@ if command -v systemd-analyze >/dev/null; then -e 'omamobile-sitd.service' -e '^$' && fail "$u verify" || true done fi +! grep -qx 'Requires=omamobile-modem.service' systemd/omamobile-sitd.service \ + || fail "the base unit must use the device's sitd policy" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the RIL needs an installed device sitd policy" pass "staged layout, config and units" diff --git a/packages/omamobile-telephony-tegu/LICENSE b/packages/omamobile-telephony-tegu/LICENSE new file mode 100644 index 000000000..aecd59624 --- /dev/null +++ b/packages/omamobile-telephony-tegu/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Derek Ross + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/omamobile-telephony-tegu/PKGBUILD b/packages/omamobile-telephony-tegu/PKGBUILD new file mode 100644 index 000000000..38d41f353 --- /dev/null +++ b/packages/omamobile-telephony-tegu/PKGBUILD @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: MIT +pkgname=omamobile-telephony-tegu +pkgver=$(cat "${startdir:-.}/version") +pkgrel=1 +pkgdesc="Opt-in Pixel 9a Phone/Messages bridge attachment to an already running sitd" +arch=(any) +url="https://github.com/derekross/omarchy-mobile" +license=(MIT) +depends=(python systemd sudo 'omamobile-device-tegu>=0.2.9' + 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4') +install=omamobile-telephony-tegu.install + +check() { + "$startdir/test/all" +} + +package() { + "$startdir/install" "$pkgdir" +} diff --git a/packages/omamobile-telephony-tegu/README.md b/packages/omamobile-telephony-tegu/README.md new file mode 100644 index 000000000..20ed62607 --- /dev/null +++ b/packages/omamobile-telephony-tegu/README.md @@ -0,0 +1,127 @@ + +# Pixel 9a: attach Phone and Messages to a running sitd + +This opt-in package installs `omamobile-mmd`, `omatel-agent`, and the tegu +bridge policy. It enables and starts no services. It does not package a +modem starter: the attended tegu modem and RIL must already be running. +Apps speak to the session agent, the agent speaks ModemManager's system +D-Bus API, and mmd forwards requests to sitd's private socket. + +Install the built `omamobile-telephony-tegu` package with ordinary pacman +dependency checking. Inspect the transaction first. Its device/RIL minima +carry the packaged unit policies, the dependency fix, the tegu SIM fixes, +safe unconfirmed-release handling and the opt-in tegu audio route. Prepare +those upgrades before a modem session; never replace a running test RIL +with older code. No firmware or private provisioning comes in this package. + +The common `omamobile-sitd.service` name is preserved for the CLI, bridge +and data helper. Its modem dependency now comes from the device package: + +- Cheetah and raven retain `Requires=omamobile-modem.service` and its order. +- Tegu uses `Requisite=omamobile-tegu-modem.service` plus ordering, and + checks CP ONLINE with the existing state helper before starting sitd. + Requisite fails if that starter is inactive; it never starts it. +- The device packages provide `omamobile-sitd-policy`, which the RIL now + requires, so an upgrade cannot silently omit its device unit dependency. +- The opt-in bridge uses `Requisite=omamobile-sitd.service` and a read-only + service preflight. Starting the bridge cannot pull in sitd or either modem unit. + +## Migrate the old sitd unit (attended preparation) + +The old `/etc/systemd/system/omamobile-sitd.service` copy overrides the +packaged base unit. The attach script refuses it. The package never deletes +or rewrites a human's unit. Prefer migration with the modem off, before +starting the next approved session. For an already running session, only +continue after checking the versions, active tegu starter and unchanged +process IDs; `daemon-reload` changes definitions without restarting them. + +1. Read-only: `systemctl cat omamobile-sitd.service` and + `systemctl show omamobile-sitd.service omamobile-tegu-modem.service -p ActiveState -p MainPID`. + Save those PIDs privately. Stop if the service/starter differs from the + approved tegu setup, or if a call is in progress. Risk: none; rollback: + none. +2. After the new packages are installed, inspect + `/usr/lib/systemd/system/omamobile-sitd.service` and its + `omamobile-sitd.service.d/10-device-modem.conf`. Expect tegu Requisite, + no cheetah Requires, CP ONLINE precheck, and `Restart=no`. Stop on a + mismatch. Risk: none; rollback: none. +3. Only for the legacy full copy, root: + `install -d -m700 /var/lib/omamobile-telephony-tegu`, then + `mv -n /etc/systemd/system/omamobile-sitd.service /var/lib/omamobile-telephony-tegu/omamobile-sitd.service.before-attach`. + Verify the source is gone (an existing backup makes `mv -n` skip; do + not overwrite it), then `systemctl daemon-reload`. Do not use restart, + enable or `--now`. Risk: low (unit definitions). Expect the same PIDs + and `FragmentPath=/usr/lib/systemd/system/omamobile-sitd.service`. + Stop if a PID changes or a service leaves active. Rollback: restore + the saved file and daemon-reload, without restarting the modem or RIL. + +The attach script also refuses pending daemon-reload, unexpected start +relationships, an inactive tegu starter/RIL, another ModemManager, a +non-ready SIM, an unregistered radio, and a live call. It obtains a live +status RPC; it never trusts the public state.json as proof of readiness. +It reads no modem device and sends no radio-control request. IMS or a +mobile-data bearer is not required just to attach. The unit's separate +`--service-check` permits an existing call or registration loss, so the +bridge can recover without dropping call visibility. The attended initial +attachment keeps the stricter no-live-call and registered-SIM checks. + +Mmd 0.1.1 removes the service-level `Conflicts=ModemManager.service`: a +bridge start must not stop another modem daemon. Package conflicts and +exclusive D-Bus name ownership still prevent two managers from serving the +same API; tegu's preflight refuses another owner before starting mmd. + +## Attach (human in the graphical user's terminal) + +Keep the existing, approved sleep inhibitor for the modem session. This +package does not qualify CP-on suspend or change auto-sleep. Confirm the +NV checks and once-per-boot rule from the modem startup runbook; nothing +here repeats the modem start or accesses NV partitions. + +Read-only preflight: + +```sh +omamobile-tegu-mmd-attach --check +``` + +Expect existing running tegu modem and sitd, a registered SIM and no live +calls. This uses sudo for read-only system checks and the private sitd +socket. Stop on any failure; it never attempts recovery. Risk: low; no +rollback is needed because no service is changed. + +Attach, after announcing that incoming calls and message notifications may +now appear on the screen and sound: + +```sh +omamobile-tegu-mmd-attach --attach +``` + +Run as the existing graphical user, not root, in a terminal. Type `ATTACH` +at its prompt. The complete set of service-start commands is: + +```sh +sudo -- systemctl start omamobile-mmd.service +systemctl --user start omatel-agent.service +``` + +The script rechecks the modem/RIL PIDs immediately before the bridge start, +after it, and after the agent start. Repeating it starts already active +services without restarting them. It never enables services or starts, +restarts or stops the modem/RIL. Risk: low (apps begin importing SMS into +the user's store and observing incoming calls). Expect both services +active and unchanged modem/RIL PIDs. Stop on any failure and inspect; +there is no automatic retry or modem recovery. + +Open Messages, then do one agreed SMS each way. Record only outcomes and +counts; number, text and network identities stay private. Stop on duplicate +or uncertain delivery; do not resend automatically. Calls follow the +separate safe-release/audio qualification. This package does not qualify +speech, mute/speaker controls, MMS, emergency calls or suspend. + +Rollback for services started by this test, once there is no live call: +close the apps, `systemctl --user stop omatel-agent.service`, then +`sudo systemctl stop omamobile-mmd.service`. Leave either service running +if it was already active before the test. A partial failure intentionally +leaves a started bridge in place for inspection. Never stop the modem or +restart sitd to recover an app failure. Any reboot is separately attended +and approved. Removing this package also requires stopping the bridge +first; it removes only the opt-in policy/helper, not private message data. diff --git a/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach new file mode 100755 index 000000000..10fb3d8ee --- /dev/null +++ b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Attended attachment of the bridge and session agent to an existing RIL. + +--check: read-only preflight (sudo is used for the private sitd socket). +--attach: preflight, an explicit terminal confirmation, then start only + omamobile-mmd.service and this user's omatel-agent.service. +--system-check: root preflight for the attended script. +--service-check: root unit preflight; permits an existing call or registration loss. +No modem/RIL start, restart, stop, enable, radio request or device ioctl. +""" +import json +import os +from pathlib import Path +import socket +import subprocess +import sys + +SITD = 'omamobile-sitd.service' +MODEM = 'omamobile-tegu-modem.service' +BRIDGE = 'omamobile-mmd.service' +AGENT = 'omatel-agent.service' +BUS = 'org.freedesktop.ModemManager1' +# Only systemd's basic implicit dependencies may start with the bridge. +BASIC = {'sysinit.target', 'basic.target', 'system.slice', 'dbus.socket', 'dbus.service'} + + +class Refused(RuntimeError): + pass + + +def run(args, *, safe_error=False): + try: + result = subprocess.run(args, check=True, capture_output=True, text=True, timeout=30) + return result.stdout.strip() + except subprocess.CalledProcessError as error: + if safe_error and error.stderr.startswith('Attach refused: '): + raise Refused(error.stderr.removeprefix('Attach refused: ').strip()) from None + raise Refused('a required service/bus check failed; no modem recovery attempted') from None + except (OSError, subprocess.SubprocessError): + raise Refused('a required service/bus check failed; no modem recovery attempted') from None + + +def properties(unit): + result = run(['systemctl', 'show', unit, '--property=ActiveState,MainPID,FragmentPath,Requires,Wants,BindsTo,Requisite,Conflicts,NeedDaemonReload']) + return dict(line.split('=', 1) for line in result.splitlines() if '=' in line) + + +def require_active(unit): + props = properties(unit) + if props.get('ActiveState') != 'active' or not props.get('MainPID', '').isdigit() or int(props['MainPID']) <= 0: + raise Refused(f'{unit} must already be active with a running process; start nothing here') + return props + + +def socket_status(path): + # A live read-only RPC, never the potentially stale public state.json. + try: + with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: + client.settimeout(5) + client.connect(str(path)) + client.sendall(b'{"action":"status"}\n') + with client.makefile('rb') as stream: + line = stream.readline((1 << 20) + 1) + if len(line) > 1 << 20 or not line.endswith(b'\n'): + raise ValueError + reply = json.loads(line) + if reply.get('ok') is not True: + raise ValueError + return reply['result'] + except (OSError, ValueError, KeyError, TypeError, AttributeError): + raise Refused('cannot read a live sitd status; no modem recovery attempted') from None + + +def system_check(*, require_ready=True): + if os.geteuid() != 0: + raise Refused('--system-check requires root') + root = Path(os.environ.get('OMAMOBILE_TEGU_ROOT', '/')) + if not root.is_absolute() or not root.is_dir(): + raise Refused('invalid preflight root') + descriptor = root / 'usr/share/omamobile/device.conf' + try: + tegu = 'CODENAME=tegu' in descriptor.read_text().splitlines() + installed = (root / 'usr/share/omamobile/device-tegu/version').is_file() + except OSError: + tegu = installed = False + if not tegu or not installed: + raise Refused('requires the tegu device package and descriptor') + ril = require_active(SITD) + modem = require_active(MODEM) + if ril.get('FragmentPath') != '/usr/lib/systemd/system/' + SITD: + raise Refused('migrate the legacy /etc sitd unit to the packaged unit first; see the README') + bridge = properties(BRIDGE) + if any(p.get('NeedDaemonReload') != 'no' for p in (ril, bridge)): + raise Refused('unit files need daemon-reload; inspect them before attaching') + if bridge.get('FragmentPath') != '/usr/lib/systemd/system/' + BRIDGE: + raise Refused('requires the packaged bridge unit') + if MODEM not in ril.get('Requisite', '').split() or SITD not in bridge.get('Requisite', '').split(): + raise Refused('tegu attach policy is not loaded; inspect the packaged drop-ins') + for unit in (ril, bridge): + for key in ('Requires', 'Wants', 'BindsTo'): + if set(unit.get(key, '').split()) - BASIC: + raise Refused('bridge or sitd has an unexpected start dependency; inspect its unit before attaching') + if set(bridge.get('Conflicts', '').split()) - {'shutdown.target'}: + raise Refused('bridge has an unexpected stop dependency; inspect its unit before attaching') + # Neither the script nor a direct unit start may stop a real modem daemon. + owner = run(['busctl', '--system', 'call', 'org.freedesktop.DBus', '/org/freedesktop/DBus', + 'org.freedesktop.DBus', 'NameHasOwner', 's', BUS]) + if owner == 'b true' and bridge.get('ActiveState') != 'active': + raise Refused('ModemManager bus name is already owned by another service') + if owner not in ('b true', 'b false'): + raise Refused('cannot determine the ModemManager bus owner') + competing = properties('ModemManager.service') + if competing.get('ActiveState') in ('active', 'activating', 'reloading'): + raise Refused('another ModemManager service is running; it will not be stopped here') + status = socket_status(root / 'run/omamobile-sit/socket') + try: + m = status['modem'] + ready = (m.get('present') is True and m.get('sim', {}).get('state') == 'ready' + and m.get('radio') == 'on' and m.get('registration') in ('home', 'roaming')) + calls = status['calls'] + if not isinstance(calls, list): + raise TypeError + live = any(c.get('state') != 'terminated' for c in calls) + except (AttributeError, KeyError, TypeError): + raise Refused('invalid live sitd status') from None + if require_ready and (not ready or live): + raise Refused('sitd must have a ready SIM, registered radio and no live calls') + # PIDs are used only to detect an unexpected RIL/CP service replacement. + # Never return the private RPC's numbers, network identities or messages. + return {'sitd_pid': ril['MainPID'], 'modem_pid': modem['MainPID']} + + +def user_check(): + if os.geteuid() == 0: + raise Refused('run --check/--attach as the graphical user, not root') + state = run(['systemctl', '--user', 'show', AGENT, '--property=LoadState', '--value']) + if state != 'loaded': + raise Refused('omatel-agent user unit is not installed') + + +def root_check(): + reply = run(['sudo', '--', str(Path(__file__).resolve()), '--system-check'], safe_error=True) + try: + result = json.loads(reply) + if set(result) != {'sitd_pid', 'modem_pid'}: + raise ValueError + return result + except (TypeError, ValueError): + raise Refused('root preflight returned an invalid result') from None + + +def main(argv=None): + argv = sys.argv[1:] if argv is None else argv + if argv in ([], ['--help'], ['-h']): + print(__doc__) + return 0 + try: + if argv in (['--system-check'], ['--service-check']): + print(json.dumps(system_check(require_ready=argv == ['--system-check']))) + return 0 + if argv not in (['--check'], ['--attach']): + raise Refused('use --check or --attach') + if argv == ['--attach'] and not (sys.stdin.isatty() and sys.stdout.isatty()): + raise Refused('--attach needs an attended terminal') + user_check() + before = root_check() + print('Preflight passed: existing tegu modem and sitd, registered SIM, no live calls.') + if argv == ['--check']: + return 0 + print('This starts only the ModemManager bridge and your Phone/Messages agent.') + if input('Type ATTACH to continue: ') != 'ATTACH': + raise Refused('attachment cancelled') + if root_check() != before: + raise Refused('modem or sitd changed during confirmation; no services started') + run(['sudo', '--', 'systemctl', 'start', BRIDGE]) + if root_check() != before: + raise Refused('modem or sitd changed while attaching; stop testing and inspect') + run(['systemctl', '--user', 'start', AGENT]) + run(['systemctl', '--user', 'is-active', '--quiet', AGENT]) + run(['systemctl', 'is-active', '--quiet', BRIDGE]) + if root_check() != before: + raise Refused('modem or sitd changed while attaching; stop testing and inspect') + print('Bridge and session agent active. Open Phone or Messages for the attended test.') + return 0 + except (Refused, EOFError, KeyboardInterrupt) as error: + print(f'Attach refused: {error}', file=sys.stderr) + return 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/packages/omamobile-telephony-tegu/install b/packages/omamobile-telephony-tegu/install new file mode 100755 index 000000000..df5c69d86 --- /dev/null +++ b/packages/omamobile-telephony-tegu/install @@ -0,0 +1,12 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Stage the opt-in bridge integration. No service activation or wants links. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +d=${1:?Usage: ./install DESTDIR} +[[ $d == /* && $d != / ]] || { echo "Use an absolute staging directory" >&2; exit 1; } +install -Dm755 bin/omamobile-tegu-mmd-attach "$d/usr/bin/omamobile-tegu-mmd-attach" +install -Dm644 systemd/10-tegu-attach.conf "$d/usr/lib/systemd/system/omamobile-mmd.service.d/10-tegu-attach.conf" +install -Dm644 README.md "$d/usr/share/doc/omamobile-telephony-tegu/README.md" +install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-telephony-tegu/LICENSE" +install -Dm644 version "$d/usr/share/omamobile/telephony-tegu/version" diff --git a/packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install b/packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install new file mode 100644 index 000000000..095527446 --- /dev/null +++ b/packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: MIT +post_install() { + systemctl daemon-reload 2>/dev/null || true + echo "omamobile-telephony-tegu: installed; no services enabled or started." + echo " From the graphical user's terminal, with sitd already running:" + echo " omamobile-tegu-mmd-attach --check, then --attach (attended)." + echo " Migrate any /etc copy of omamobile-sitd.service first; see the README." +} +post_upgrade() { + post_install +} diff --git a/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf new file mode 100644 index 000000000..d2e0ad6e3 --- /dev/null +++ b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT +# Check the existing RIL, never pull it or the CP into a start transaction. +[Unit] +Requisite=omamobile-sitd.service +After=omamobile-sitd.service + +[Service] +ExecStartPre=/usr/bin/omamobile-tegu-mmd-attach --service-check diff --git a/packages/omamobile-telephony-tegu/test/all b/packages/omamobile-telephony-tegu/test/all new file mode 100755 index 000000000..9f3a4f1cc --- /dev/null +++ b/packages/omamobile-telephony-tegu/test/all @@ -0,0 +1,30 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Package and attended attachment tests: fixtures only, no phone or system bus. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +for f in PKGBUILD install omamobile-telephony-tegu.install test/all; do bash -n "$f"; done +python3 -B -m unittest discover -s test -p 'test_*.py' +t=$(mktemp -d); trap 'rm -rf "$t"' EXIT +./install "$t/root" +for f in usr/bin/omamobile-tegu-mmd-attach usr/lib/systemd/system/omamobile-mmd.service.d/10-tegu-attach.conf \ + usr/share/doc/omamobile-telephony-tegu/README.md usr/share/omamobile/telephony-tegu/version; do + [[ -f $t/root/$f ]] || { echo "not ok - missing $f"; exit 1; } +done +[[ -z $(find "$t/root" -type l -print) ]] || { echo 'not ok - package enables a unit'; exit 1; } +[[ ! -d $t/root/etc ]] || { echo 'not ok - package copies or overrides /etc'; exit 1; } +[[ -x $t/root/usr/bin/omamobile-tegu-mmd-attach ]] +"$t/root/usr/bin/omamobile-tegu-mmd-attach" --help >/dev/null +python3 -I -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' bin/omamobile-tegu-mmd-attach +# Read the dependency declarations, not a grep that can match an optdepend. +deps=$(startdir=$PWD bash -c 'source PKGBUILD; printf "%s\n" "${depends[@]}"') +for dep in 'omamobile-device-tegu>=0.2.9' 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4'; do + grep -qxF "$dep" <<<"$deps" +done +! grep -qx omamobile-device-cheetah <<<"$deps" +# Requisite is an active-state check, not a start request. No Wants/Requires +# or multi-user target links may be added by this package. +grep -qx 'Requisite=omamobile-sitd.service' systemd/10-tegu-attach.conf +! grep -E '^(Requires|Wants|BindsTo)=' systemd/10-tegu-attach.conf +! grep -E 'systemctl .*\b(start|restart|enable)\b' omamobile-telephony-tegu.install +echo 'ok - opt-in package stages the attended helper and non-pulling bridge policy' diff --git a/packages/omamobile-telephony-tegu/test/test_attach.py b/packages/omamobile-telephony-tegu/test/test_attach.py new file mode 100644 index 000000000..665abb13c --- /dev/null +++ b/packages/omamobile-telephony-tegu/test/test_attach.py @@ -0,0 +1,292 @@ +# SPDX-License-Identifier: MIT +"""The attended script with fake service/bus calls and private socket data.""" +import contextlib +import copy +import importlib.machinery +import importlib.util +import io +import json +from pathlib import Path +import subprocess +import tempfile +import unittest +from unittest.mock import Mock, patch + +SCRIPT = Path(__file__).resolve().parents[1] / 'bin/omamobile-tegu-mmd-attach' +loader = importlib.machinery.SourceFileLoader('attach', str(SCRIPT)) +spec = importlib.util.spec_from_loader(loader.name, loader) +a = importlib.util.module_from_spec(spec) +loader.exec_module(a) + + +class SystemCheck(unittest.TestCase): + def setUp(self): + self.scratch = tempfile.TemporaryDirectory() + self.addCleanup(self.scratch.cleanup) + self.root = Path(self.scratch.name) + desc = self.root / 'usr/share/omamobile/device.conf' + desc.parent.mkdir(parents=True) + desc.write_text('CODENAME=tegu\n') + ver = self.root / 'usr/share/omamobile/device-tegu/version' + ver.parent.mkdir() + ver.write_text('0.2.9\n') + self.status = dict(modem=dict(present=True, sim=dict(state='ready'), radio='on', + registration='home', ims='unregistered', data=False, + operator='PRIVATE NETWORK'), calls=[], sms={'received': []}) + self.units = { + a.SITD: dict(ActiveState='active', MainPID='123', FragmentPath='/usr/lib/systemd/system/' + a.SITD, + Requisite=a.MODEM, Requires='sysinit.target', Wants='', BindsTo='', NeedDaemonReload='no'), + a.MODEM: dict(ActiveState='active', MainPID='122'), + a.BRIDGE: dict(ActiveState='inactive', MainPID='0', FragmentPath='/usr/lib/systemd/system/' + a.BRIDGE, + Requisite=a.SITD, Requires='dbus.socket sysinit.target', Wants='', BindsTo='', NeedDaemonReload='no'), + 'ModemManager.service': dict(ActiveState='inactive', MainPID='0'), + } + self.owner = 'b false' + self.commands = [] + for target, value in [('os.geteuid', lambda: 0), ('properties', lambda name: self.units[name]), + ('run', self.command), ('socket_status', lambda path: self.status)]: + helper = patch.object(a.os, 'geteuid', value) if target == 'os.geteuid' else patch.object(a, target, value) + helper.start() + self.addCleanup(helper.stop) + helper = patch.dict(a.os.environ, OMAMOBILE_TEGU_ROOT=str(self.root)) + helper.start() + self.addCleanup(helper.stop) + + def command(self, args): + self.commands.append(args) + self.assertEqual(args[:3], ['busctl', '--system', 'call']) + self.assertIn('NameHasOwner', args) + return self.owner + + def refused(self): + with self.assertRaises(a.Refused): + a.system_check() + + def test_live_no_ims_no_bearer_passes_without_radio_actions(self): + self.assertEqual(a.system_check(), {'sitd_pid': '123', 'modem_pid': '122'}) + self.assertEqual(len(self.commands), 1) + self.assertNotIn('PRIVATE', json.dumps(a.system_check())) + + def test_wrong_board_and_non_root_refused(self): + with patch.object(a.os, 'geteuid', return_value=1000): + self.refused() + (self.root / 'usr/share/omamobile/device.conf').write_text('CODENAME=cheetah\n') + self.refused() + + def test_missing_or_inactive_ril_or_modem_refused(self): + for unit in (a.SITD, a.MODEM): + for field, value in [('ActiveState', 'inactive'), ('MainPID', '0')]: + with self.subTest(unit=unit, field=field): + old = self.units[unit][field] + self.units[unit][field] = value + self.refused() + self.units[unit][field] = old + + def test_shadow_units_and_reload_pending_refused(self): + for unit in (a.SITD, a.BRIDGE): + for field, value in [('FragmentPath', '/etc/systemd/system/' + unit), ('NeedDaemonReload', 'yes')]: + with self.subTest(unit=unit, field=field): + old = self.units[unit][field] + self.units[unit][field] = value + self.refused() + self.units[unit][field] = old + + def test_missing_policy_or_pulling_dependency_refused(self): + for unit in (a.SITD, a.BRIDGE): + for field, value in [('Requisite', ''), ('Requires', a.MODEM), ('Wants', a.SITD), ('BindsTo', a.MODEM)]: + with self.subTest(unit=unit, field=field): + old = self.units[unit][field] + self.units[unit][field] = value + self.refused() + self.units[unit][field] = old + + def test_competing_bus_owner_or_real_manager_refused(self): + self.owner = 'b true' + self.refused() + self.units[a.BRIDGE]['ActiveState'] = 'active' + self.assertEqual(a.system_check()['sitd_pid'], '123') + self.units['ModemManager.service']['ActiveState'] = 'activating' + self.refused() + + def test_unready_registration_or_live_call_refused(self): + good = copy.deepcopy(self.status) + for key, value in [('sim', {'state': 'absent'}), ('radio', 'off'), ('registration', 'searching')]: + self.status = copy.deepcopy(good) + self.status['modem'][key] = value + self.refused() + self.status = copy.deepcopy(good) + self.status['calls'] = [dict(state='active', number='PRIVATE NUMBER')] + self.refused() + + def test_service_recovery_allows_live_calls_and_registration_loss(self): + self.status['calls'] = [dict(state='active')] + self.status['modem']['radio'] = 'off' + self.status['modem']['registration'] = 'searching' + self.status['modem']['sim'] = dict(state='absent') + self.refused() + self.assertEqual(a.system_check(require_ready=False)['sitd_pid'], '123') + + def test_stop_dependency_is_refused(self): + self.units[a.BRIDGE]['Conflicts'] = 'ModemManager.service shutdown.target' + self.refused() + + def test_malformed_rpc_is_refused_without_private_output(self): + self.status = {'modem': None, 'calls': ['PRIVATE']} + self.refused() + self.status = dict(modem=dict(present=True, sim=None)) + self.refused() + + +class SocketRead(unittest.TestCase): + def test_only_status_sent_and_refused_payload_hidden(self): + fake = Mock() + fake.__enter__ = Mock(return_value=fake) + fake.__exit__ = Mock(return_value=False) + fake.makefile.return_value = io.BytesIO(b'{"ok":true,"result":{"calls":[]}}\n') + with patch.object(a.socket, 'socket', return_value=fake): + self.assertEqual(a.socket_status('/private/socket'), {'calls': []}) + fake.sendall.assert_called_once_with(b'{"action":"status"}\n') + for response in [b'{"ok":false,"error":"PRIVATE NUMBER"}\n', b'bad PRIVATE JSON\n', b'{}']: + fake.makefile.return_value = io.BytesIO(response) + with patch.object(a.socket, 'socket', return_value=fake), self.assertRaises(a.Refused) as error: + a.socket_status('/private/socket') + self.assertNotIn('PRIVATE', str(error.exception)) + + +class Attended(unittest.TestCase): + def setUp(self): + self.commands = [] + self.identity = {'sitd_pid': '123', 'modem_pid': '122'} + self.output = io.StringIO() + self.output.isatty = lambda: True + self.input = Mock() + self.input.isatty.return_value = True + helpers = [patch.object(a.os, 'geteuid', return_value=1000), + patch.object(a, 'root_check', return_value=self.identity), + patch.object(a, 'run', side_effect=self.command), + patch.object(a.sys, 'stdin', self.input), patch.object(a.sys, 'stdout', self.output), + patch.object(a.sys, 'stderr', new=io.StringIO()), patch('builtins.input', return_value='ATTACH')] + for helper in helpers: + helper.start() + self.addCleanup(helper.stop) + + def command(self, args, **kwargs): + self.commands.append(args) + return 'loaded' if '--property=LoadState' in args else '' + + def mutations(self): + return [cmd for cmd in self.commands if 'start' in cmd] + + def test_check_changes_nothing(self): + self.assertEqual(a.main(['--check']), 0) + self.assertFalse(self.mutations()) + + def test_attach_starts_exactly_bridge_and_user_agent(self): + for _ in range(2): + self.assertEqual(a.main(['--attach']), 0) + self.assertEqual(self.mutations(), [ + ['sudo', '--', 'systemctl', 'start', a.BRIDGE], ['systemctl', '--user', 'start', a.AGENT]] * 2) + self.assertNotIn('restart', str(self.commands)) + self.assertNotIn('enable', str(self.commands)) + self.assertNotIn(a.MODEM, str(self.commands)) + self.assertNotIn(a.SITD, str(self.commands)) + + def test_requires_terminal_and_explicit_confirmation(self): + self.input.isatty.return_value = False + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.commands) + self.input.isatty.return_value = True + with patch('builtins.input', return_value='yes'): + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.mutations()) + + def test_ril_change_or_preflight_failure_never_starts_services(self): + with patch.object(a, 'root_check', side_effect=[self.identity, {'sitd_pid': '124', 'modem_pid': '122'}]): + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.mutations()) + with patch.object(a, 'root_check', side_effect=a.Refused('inactive')): + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.mutations()) + + def test_agent_failure_never_recovers_modem_or_ril(self): + def command(args, **kwargs): + value = self.command(args, **kwargs) + if args == ['systemctl', '--user', 'start', a.AGENT]: + raise a.Refused('agent failed') + return value + with patch.object(a, 'run', side_effect=command): + self.assertEqual(a.main(['--attach']), 1) + self.assertEqual(self.mutations(), [['sudo', '--', 'systemctl', 'start', a.BRIDGE], + ['systemctl', '--user', 'start', a.AGENT]]) + + def test_refuses_root_and_missing_user_unit(self): + with patch.object(a.os, 'geteuid', return_value=0): + self.assertEqual(a.main(['--check']), 1) + with patch.object(a, 'run', return_value='not-found'): + self.assertEqual(a.main(['--check']), 1) + self.assertFalse(self.mutations()) + + +class UnitPolicy(unittest.TestCase): + repo = Path(__file__).resolve().parents[3] + + def unit(self, path): + fields = {} + for line in path.read_text().splitlines(): + if '=' in line and not line.startswith('#'): + key, value = line.split('=', 1) + fields.setdefault(key, []).extend(value.split()) + return fields + + def test_effective_device_dependencies_and_readiness(self): + base_path = self.repo / 'packages/omamobile-modem-sit/systemd/omamobile-sitd.service' + if not base_path.exists(): + self.skipTest('device unit integration needs the repository') + base = self.unit(base_path) + self.assertNotIn('Requires', base) + self.assertIn('omamobile-audio.service', base['After']) + for dev in ('tegu', 'cheetah', 'raven'): + policy = self.unit(self.repo / f'packages/omamobile-device-{dev}/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf') + if dev == 'tegu': + self.assertEqual(policy['Requisite'], [a.MODEM]) + for field in ('Requires', 'Wants', 'BindsTo'): + self.assertNotIn(field, policy) + self.assertEqual(policy['ExecStartPre'], ['/usr/lib/omamobile-vendor/omamobile-modem-cp', 'state']) + self.assertIn(a.MODEM, policy['After']) + else: + self.assertEqual(policy['Requires'], ['omamobile-modem.service']) + self.assertEqual(policy['After'], ['omamobile-modem.service']) + + def test_bridge_dependency_cannot_start_ril_or_cp(self): + base_path = self.repo / 'packages/omamobile-mmd/systemd/omamobile-mmd.service' + if not base_path.exists(): + self.skipTest('bridge unit integration needs the repository') + policy = self.unit(Path(__file__).resolve().parents[1] / 'systemd/10-tegu-attach.conf') + base = self.unit(base_path) + for fields in (base, policy): + for key in ('Requires', 'Wants', 'BindsTo'): + self.assertNotIn(key, fields) + self.assertNotIn('Conflicts', base) + self.assertEqual(policy['Requisite'], [a.SITD]) + self.assertEqual(policy['ExecStartPre'], ['/usr/bin/omamobile-tegu-mmd-attach', '--service-check']) + + def test_ril_requires_device_policy_and_dependency_fix(self): + pkg = self.repo / 'packages/omamobile-modem-sit/PKGBUILD' + if not pkg.exists(): + self.skipTest('package closure needs the repository') + def array(path, name): + return subprocess.run(['bash', '-c', + 'startdir=$(dirname "$1"); source "$1"; declare -p "$2"', '_', str(path), name], + check=True, capture_output=True, text=True).stdout + self.assertIn('omamobile-sitd-policy', array(pkg, 'depends')) + modem = self.repo / 'packages/omamobile-modem/PKGBUILD' + self.assertIn('omamobile-modem-policy', array(modem, 'depends')) + self.assertNotIn('omamobile-device-cheetah', array(modem, 'depends')) + for device in ('cheetah', 'raven', 'tegu'): + provides = array(self.repo / f'packages/omamobile-device-{device}/PKGBUILD', 'provides') + self.assertIn('omamobile-sitd-policy', provides) + self.assertIn('omamobile-modem-policy', provides) + + +if __name__ == '__main__': + unittest.main() diff --git a/packages/omamobile-telephony-tegu/test/test_units.py b/packages/omamobile-telephony-tegu/test/test_units.py new file mode 100644 index 000000000..74d4e8640 --- /dev/null +++ b/packages/omamobile-telephony-tegu/test/test_units.py @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: MIT +"""Have systemd itself validate the three composed unit policies offline.""" +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + + +@unittest.skipUnless(shutil.which('systemd-analyze'), 'systemd-analyze not installed') +class Units(unittest.TestCase): + def test_composed_units_verify_for_each_device(self): + repo = Path(__file__).resolve().parents[3] + packages = repo / 'packages' + if not (packages / 'omamobile-mmd').exists(): + self.skipTest('composed unit test needs the repository') + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + units = root / 'usr/lib/systemd/system' + units.mkdir(parents=True) + for pkg, name in [('omamobile-modem-sit', 'omamobile-sitd'), ('omamobile-mmd', 'omamobile-mmd')]: + shutil.copy2(packages / pkg / f'systemd/{name}.service', units / f'{name}.service') + # Stubs satisfy references only; verify never starts them. + for name in ['basic', 'sysinit', 'shutdown', 'sockets', 'multi-user', 'slices']: + (units / f'{name}.target').write_text('[Unit]\nDescription=Fixture\n') + (units / 'system.slice').write_text('[Unit]\nDescription=Fixture slice\n') + for name in ['omamobile-modem', 'omamobile-tegu-modem', 'omamobile-audio', + 'omamobile-aoc', 'omamobile-tegu-aoc', 'dbus']: + (units / f'{name}.service').write_text('[Service]\nExecStart=/bin/true\n') + (units / 'dbus.socket').write_text('[Socket]\nListenStream=/run/fixture-bus\n') + for name in ['bin/true', 'usr/bin/omamobile-sitd', 'usr/bin/omamobile-mmd', + 'usr/bin/omamobile-tegu-mmd-attach', 'usr/lib/omamobile-vendor/omamobile-modem-cp']: + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text('fixture') + path.chmod(0o755) + drop = units / 'omamobile-sitd.service.d' + drop.mkdir() + bridge = units / 'omamobile-mmd.service.d' + bridge.mkdir() + for device in ['cheetah', 'raven', 'tegu']: + shutil.copy2(packages / f'omamobile-device-{device}/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf', + drop / '10-device-modem.conf') + if device == 'tegu': + shutil.copy2(packages / 'omamobile-telephony-tegu/systemd/10-tegu-attach.conf', bridge / '10-tegu-attach.conf') + result = subprocess.run(['systemd-analyze', '--root', directory, '--man=no', 'verify', + 'omamobile-sitd.service', 'omamobile-mmd.service'], + capture_output=True, text=True) + if result.returncode and 'Operation not permitted' in result.stderr: + self.skipTest('local sandbox blocks systemd verification sockets') + self.assertEqual(result.returncode, 0, f'{device}: {result.stdout}{result.stderr}') diff --git a/packages/omamobile-telephony-tegu/version b/packages/omamobile-telephony-tegu/version new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/packages/omamobile-telephony-tegu/version @@ -0,0 +1 @@ +0.1.0 From 5c975b96ebf255f57e33be4d3c068beecc406c94 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:03:00 -0647 Subject: [PATCH 3/9] device/tegu TELEPHONY-APPS-PLAN: the 2026-11-02 run, the two ways to start the bridge, and a plan that reads as one Record the palmtop run of Phone and Messages (kernel, versions, what passed, and that opening an app didn't start the agent), say which start fits which case, cite #363 instead of a branch, and drop the lines that read like a task report. --- device/tegu/TELEPHONY-APPS-PLAN.md | 92 ++++++++++++++++++------------ 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/device/tegu/TELEPHONY-APPS-PLAN.md b/device/tegu/TELEPHONY-APPS-PLAN.md index 864ba80f1..074335381 100644 --- a/device/tegu/TELEPHONY-APPS-PLAN.md +++ b/device/tegu/TELEPHONY-APPS-PLAN.md @@ -1,34 +1,32 @@ # Pixel 9a: connect Phone and Messages to sitd -First-step implementation (2026-11-03), offline: branch `tegu-mmd-attach` -builds on this plan and the dependency fix (#363), with the existing SIM, -safe-release and opt-in tegu audio work retained. The optional +Status (2026-11-03): Phone and Messages ran on the palmtop on 2026-11-02 +through this path (results at the end). The optional `omamobile-telephony-tegu` package installs mmd, the agent, an active-RIL -bridge policy and `omamobile-tegu-mmd-attach --check|--attach`. It enables -nothing. The canonical sitd unit now gets its modem dependency from a -device-owned drop-in: tegu uses Requisite on its already running starter, -while cheetah and raven retain Requires on their modem unit. A new -`omamobile-sitd-policy` dependency ensures these drop-ins accompany a RIL -upgrade. [Package/runbook](../../packages/omamobile-telephony-tegu/README.md). -No phone contact or hardware qualification was performed for this change. -The seven affected/dependency package suites passed; mmd and the attach -package were rerun after final ownership/recovery changes. The attach -package has 21 offline tests, including systemd verification of all three -device policies. One bridge API comparison skips missing reference XML. -The architecture-independent attach package also built offline with -makepkg (dependency installation and signing disabled). No rootfs or ARM -modem package was built by that native package check. - - -The investigation below records the older base and its missing pieces; -the first-step package implements bridge attachment, not modem boot or -cold-login qualification. - -Status (2026-11-03): offline investigation on `origin/main` at `31fbcf9`. -The owner reports texts both ways and calls through `omamobile-sit` on the -palmtop. No phone contact in this investigation. This is an integration -plan, not a record of app or call-audio qualification on hardware. +bridge policy and `omamobile-tegu-mmd-attach --check|--attach`, and enables +nothing. sitd's unit gets its modem dependency from a device-owned drop-in: +tegu uses Requisite on its already running starter, while cheetah and raven +keep Requires on their modem unit, and the virtual `omamobile-sitd-policy` +makes the drop-ins come along with a RIL upgrade. It builds on #363 (the +device modem policy). [Package/runbook](../../packages/omamobile-telephony-tegu/README.md). + +Two ways start the bridge, each for its own case: at boot, #372's opt-in +`omamobile-tegu-modem-boot` starts the modem, sitd and mmd once the CP is +ONLINE (daily use); and `omamobile-tegu-mmd-attach --attach` attaches mmd +and the agent to a modem and sitd already started by hand (bring-up and +tests, where nothing should start the modem for you). The helper refuses +when sitd isn't running and never starts the modem itself. + +Offline: the seven affected package suites pass, the attach package has 21 +tests (including systemd verification of all three device policies), and +the architecture-independent package builds with makepkg. One bridge API +comparison skips when ModemManager's reference XML is missing. + +The sections below are the investigation this started from, on `origin/main` +at `31fbcf9`, before #363 and the attach package. The owner then had texts +both ways and calls through `omamobile-sit`; this was the plan for the apps +on top. The app protocol already exists. The immediate missing layer in the recorded tegu setup is `omamobile-mmd`, installed and running. A normal @@ -55,7 +53,7 @@ modem | Layer | What the repository already supplies | | --- | --- | | Apps | `omamobile-apps` depends on `omaphone` and `omamessages`; both pull in `omatel-agent`. Contacts is supplied with Phone and does not need a modem. #361 puts all three packages in the image. | -| Agent | `packages/omatel` packages the agent, its user unit and both session-bus activation files. Opening an app activates it. The disabled user unit is intentional; no root agent and no generic enablement change are needed. | +| Agent | `packages/omatel` packages the agent, its user unit and both session-bus activation files. Its session-bus activation files are meant to start it when an app opens; on the palmtop that didn't happen (results below), and the user unit had to be started and enabled. The disabled user unit is intentional; no root agent and no generic enablement change are needed. | | Bridge | `packages/omamobile-mmd` owns the system-bus name normally used by ModemManager, exports modem/call/SMS objects, and checks polkit for operations. It conflicts with the real `modemmanager`; installing both is not the solution. | | Commands | `Voice.CreateCall` plus `Call.Start` maps to sitd `dial`; `Accept`, `Hangup` and `SendDtmf` map to sitd requests. `Messaging.Create` plus `Sms.Send` maps to `sms-send` with a durable request ID. | | Incoming events | The bridge subscribes to sitd, exports calls, reads `sms-list`, and maps deletion to `sms-delete`. The agent stores SMS before deleting them from the bridge and handles notifications and call history. | @@ -66,8 +64,7 @@ Sources: [app package](../../packages/omamobile-apps/PKGBUILD), [bridge mappings](../../packages/omamobile-mmd/lib/bridge.py), [socket subscription](../../packages/omamobile-mmd/lib/sitd_link.py), and [the shared telephony plan](../../docs/TELEPHONY-APPS-PLAN.md), especially -sections 1.5 and 10.1b. The requested old cheetah plan path has moved to -`docs/TELEPHONY-APPS-PLAN.md`. +sections 1.5 and 10.1b. Contacts uses the shared local vCard address book; it does not need a modem or an additional cellular service. @@ -77,9 +74,8 @@ or an additional cellular service. 1. **A dependency-correct install.** `omamobile-mmd` depends on `omamobile-modem-sit`, which depends on `omamobile-modem`, which still depends on `omamobile-device-cheetah`. That conflicts with tegu's device - package. The existing `modem-policy-virtual` change replaces that last - dependency with `omamobile-modem-policy` and adds tegu's provider. It is - not in this base. Land/build that prerequisite first. + package. #363 (merged) replaces that last dependency with the virtual + `omamobile-modem-policy` and adds tegu's provider. 2. **The bridge package and its start.** The common rootfs list deliberately omits mmd and modem-sit. Tegu's `ROOTFS_PACKAGES` does not include them. `omamobile-mmd.service` ships disabled, has no D-Bus activation file, @@ -130,14 +126,13 @@ For the already running palmtop, the manual steps below are enough once package dependencies are correct. The durable boot/image changes are not prerequisites for that test. -## Attended first test (proposed, not executed) +## Attended first test (ran on 2026-11-02) Keep the existing modem sleep inhibitor throughout; suspend with the CP on is not qualified by this work. Keep the existing once-per-boot start and NV checks. No step below starts, stops or restarts the CP or sitd. Run user commands in the existing graphical user's terminal, root commands -in the attended administrative session. These commands are a runbook for -the human, not authorization to contact the phone in this task. +in the attended administrative session. | Step / risk | Commands or action | Expect / pass | Stop condition | Rollback | | --- | --- | --- | --- | --- | @@ -166,7 +161,7 @@ A successful dial through mmd does not prove those controls affect tegu's route. MMS and mobile-data control through ModemManager are outside this SMS/basic-call integration; keep the existing sitd data ownership. -## Offline evidence from this investigation +## Offline evidence `packages/omamobile-mmd/test/all` passed on this base with private D-Bus and local simulator sockets. This covers API/bridge/libmm clients, the @@ -182,3 +177,26 @@ This does not run the packaged Rust agent or either GUI, does not test tegu hardware or the current private carrier configuration, and does not qualify polkit for the actual graphical session. The earlier full agent chain result is recorded in the shared plan; it was not rerun here. + +## Results on the palmtop, 2026-11-02 + +The daily kernel (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`), +the modem started by hand and sitd running (built from this stack, 0.3.12 +at the time), `omamobile-mmd` 0.1.0 started with `systemctl start`. + +- Steps 1 to 3 passed: the bridge owned `org.freedesktop.ModemManager1` + and exported the modem with the SIM ready; sitd and the CP stayed the + same running instances. +- Step 4: opening Messages did *not* start the agent, and it showed + "service isn't running" until `systemctl --user enable --now + omatel-agent`. After that both apps saw the modem. Cold-session + activation stays open, as above. +- Step 5: texts both ways from Messages, with no duplicate. +- Step 6: calls out from Phone and in, with speakerphone audio (#367), + released cleanly. +- The status bar showed airplane mode until sitd mapped radio state 10 to + on (now on main with #381). + +A `tools/phone-smoke` report from the palmtop is still to come, with the +next run. + From 5e39a328a104de6e194aeace75cd410c2611965a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:34:26 -0647 Subject: [PATCH 4/9] TELEPHONY-APPS-PLAN, omamobile-telephony-tegu: mmd's Conflicts= goes in 0.1.3, with this pull request The plan and the README dated the removal of the unit's Conflicts=ModemManager.service to mmd 0.1.1, and the bullet above still listed it as built; this pull request is what removes it, in 0.1.3. --- docs/TELEPHONY-APPS-PLAN.md | 4 ++-- packages/omamobile-telephony-tegu/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/TELEPHONY-APPS-PLAN.md b/docs/TELEPHONY-APPS-PLAN.md index 4fed50af9..1e4011606 100644 --- a/docs/TELEPHONY-APPS-PLAN.md +++ b/docs/TELEPHONY-APPS-PLAN.md @@ -143,8 +143,8 @@ shell status / quick settings ──────────────── - Received SMS handed over by ID: the bridge exports each one as an `Sms` object, and a client's `Messaging.Delete` deletes it in sitd's store. That is Chatty's pattern: it copies each message into its own database and deletes it from the modem. - **Packaging, as built (T1, `packages/omamobile-mmd` 0.1.0; [MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) "T0/T1: the ModemManager bridge"):** - Its own package, `omamobile-mmd`, with `conflicts=(modemmanager)` and **no `provides=`**: nothing in Arch or Arch Linux ARM hard-depends on `modemmanager` (gnome-calls, chatty, networkmanager and geoclue need only libmm-glib; mmsd-tng is AUR-only and also needs only libmm-glib). - - It ships `omamobile-mmd.service`, not `ModemManager.service`, with no `dbus-org.freedesktop.ModemManager1.service` alias: `Type=dbus`, `BusName=org.freedesktop.ModemManager1`, `Conflicts=ModemManager.service`, `WantedBy=omamobile-sitd.service`, and not enabled by the package. It also ships the D-Bus bus policy (only root owns the name) and MM's polkit actions. - - Since mmd 0.1.1, the unit has no `Conflicts=ModemManager.service`: starting the bridge must not stop another modem daemon. Package conflicts and exclusive D-Bus name ownership still provide exclusion. The optional tegu integration adds Requisite on an already active sitd, a read-only service check, and an attended attachment helper; it enables neither modem nor RIL. + - It ships `omamobile-mmd.service`, not `ModemManager.service`, with no `dbus-org.freedesktop.ModemManager1.service` alias: `Type=dbus`, `BusName=org.freedesktop.ModemManager1`, `WantedBy=omamobile-sitd.service`, and not enabled by the package (up to mmd 0.1.2 it also had `Conflicts=ModemManager.service`). It also ships the D-Bus bus policy (only root owns the name) and MM's polkit actions. + - From mmd 0.1.3 (#371), the unit has no `Conflicts=ModemManager.service`: starting the bridge must not stop another modem daemon. Package conflicts and exclusive D-Bus name ownership still provide exclusion. The optional tegu integration adds Requisite on an already active sitd, a read-only service check, and an attended attachment helper; it enables neither modem nor RIL. - **No D-Bus activation file**, so no client can start the bridge. Enabled, it starts with `omamobile-sitd`. - No `mmcli` and no CLI of our own. Phone runbooks read the modem through libmm-glib with `test/libmm-status.py`; mmcli runs only in the conformance container (`test/conformance`). - **Packaging, superseded (the design before T1, kept for history; not built):** a package named `omamobile-mm` with `provides=(modemmanager)` and `conflicts=(modemmanager)`, shipping `ModemManager.service` aliased `dbus-org.freedesktop.ModemManager1.service`, the bus policy, a D-Bus activation file, and `mmcli` or a small `omamobile-mm-cli`. T1 dropped `provides=` (no package needs it), the activation file (so no client can start the bridge) and the takeover of ModemManager's unit name. diff --git a/packages/omamobile-telephony-tegu/README.md b/packages/omamobile-telephony-tegu/README.md index 20ed62607..78331f18b 100644 --- a/packages/omamobile-telephony-tegu/README.md +++ b/packages/omamobile-telephony-tegu/README.md @@ -65,7 +65,7 @@ mobile-data bearer is not required just to attach. The unit's separate bridge can recover without dropping call visibility. The attended initial attachment keeps the stricter no-live-call and registered-SIM checks. -Mmd 0.1.1 removes the service-level `Conflicts=ModemManager.service`: a +Mmd 0.1.3 (#371) removes the service-level `Conflicts=ModemManager.service`: a bridge start must not stop another modem daemon. Package conflicts and exclusive D-Bus name ownership still prevent two managers from serving the same API; tegu's preflight refuses another owner before starting mmd. From 8186c19021a2130b9335894d11ffb8f793d6be20 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 3 Nov 2026 20:07:53 -0647 Subject: [PATCH 5/9] omamobile-telephony-tegu: the bridge's service check accepts its own WantedBy and tmp.mount, and a refusal isn't retried With #372's boot unit on and this package installed, the bridge's ExecStartPre refused every start: sitd wanted omamobile-mmd.service (the bridge's own WantedBy, once enabled) and both units wanted tmp.mount (systemd adds it). Neither pulls the RIL or the CP into a start, so both are allowed now. A refusal of --service-check exits 3, which the drop-in names in RestartPreventExitStatus=, so a refused bridge stays down instead of retrying every five seconds. --- .../bin/omamobile-tegu-mmd-attach | 22 ++++++++++++++++--- .../systemd/10-tegu-attach.conf | 3 +++ .../test/test_attach.py | 19 ++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach index 10fb3d8ee..798056c22 100755 --- a/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach +++ b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach @@ -22,7 +22,13 @@ BRIDGE = 'omamobile-mmd.service' AGENT = 'omatel-agent.service' BUS = 'org.freedesktop.ModemManager1' # Only systemd's basic implicit dependencies may start with the bridge. -BASIC = {'sysinit.target', 'basic.target', 'system.slice', 'dbus.socket', 'dbus.service'} +# tmp.mount: systemd adds it to any unit that uses /tmp. Neither it nor +# these pull the CP or the RIL into a start transaction. +BASIC = {'sysinit.target', 'basic.target', 'system.slice', 'dbus.socket', 'dbus.service', 'tmp.mount'} +# A service-check refusal exits with this code, which the bridge's drop-in +# names in RestartPreventExitStatus=, so a refused bridge stays down instead +# of retrying every RestartSec. +REFUSED_SERVICE = 3 class Refused(RuntimeError): @@ -99,7 +105,13 @@ def system_check(*, require_ready=True): raise Refused('tegu attach policy is not loaded; inspect the packaged drop-ins') for unit in (ril, bridge): for key in ('Requires', 'Wants', 'BindsTo'): - if set(unit.get(key, '').split()) - BASIC: + allowed = BASIC + # sitd wanting the bridge comes from the bridge's own + # WantedBy=omamobile-sitd.service once it is enabled: it starts + # the bridge after the RIL, never the RIL or the CP. + if unit is ril and key == 'Wants': + allowed = BASIC | {BRIDGE} + if set(unit.get(key, '').split()) - allowed: raise Refused('bridge or sitd has an unexpected start dependency; inspect its unit before attaching') if set(bridge.get('Conflicts', '').split()) - {'shutdown.target'}: raise Refused('bridge has an unexpected stop dependency; inspect its unit before attaching') @@ -157,7 +169,11 @@ def main(argv=None): return 0 try: if argv in (['--system-check'], ['--service-check']): - print(json.dumps(system_check(require_ready=argv == ['--system-check']))) + try: + print(json.dumps(system_check(require_ready=argv == ['--system-check']))) + except Refused as error: + print(f'Attach refused: {error}', file=sys.stderr) + return REFUSED_SERVICE if argv == ['--service-check'] else 1 return 0 if argv not in (['--check'], ['--attach']): raise Refused('use --check or --attach') diff --git a/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf index d2e0ad6e3..a4490fa5c 100644 --- a/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf +++ b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf @@ -6,3 +6,6 @@ After=omamobile-sitd.service [Service] ExecStartPre=/usr/bin/omamobile-tegu-mmd-attach --service-check +# A refusal (exit 3) is not retried every RestartSec: the bridge stays down +# until the cause is fixed and it is started again. +RestartPreventExitStatus=3 diff --git a/packages/omamobile-telephony-tegu/test/test_attach.py b/packages/omamobile-telephony-tegu/test/test_attach.py index 665abb13c..a95751b4f 100644 --- a/packages/omamobile-telephony-tegu/test/test_attach.py +++ b/packages/omamobile-telephony-tegu/test/test_attach.py @@ -100,6 +100,24 @@ def test_missing_policy_or_pulling_dependency_refused(self): self.refused() self.units[unit][field] = old + def test_enabled_bridge_and_implicit_tmp_mount_pass(self): + # As on the palmtop once the bridge is enabled: sitd wants it (its + # WantedBy=), and systemd adds tmp.mount to both units. + self.units[a.SITD]['Wants'] = a.BRIDGE + ' tmp.mount' + self.units[a.BRIDGE]['Wants'] = 'tmp.mount' + self.assertEqual(a.system_check()['sitd_pid'], '123') + # sitd wanting anything else, or the bridge wanting itself, still refuses + self.units[a.SITD]['Wants'] = a.BRIDGE + ' ' + a.MODEM + self.refused() + self.units[a.SITD]['Wants'] = '' + self.units[a.BRIDGE]['Wants'] = a.BRIDGE + self.refused() + + def test_service_check_refusal_has_its_own_exit_code(self): + self.units[a.SITD]['Wants'] = a.MODEM + self.assertEqual(a.main(['--service-check']), a.REFUSED_SERVICE) + self.assertEqual(a.main(['--system-check']), 1) + def test_competing_bus_owner_or_real_manager_refused(self): self.owner = 'b true' self.refused() @@ -269,6 +287,7 @@ def test_bridge_dependency_cannot_start_ril_or_cp(self): self.assertNotIn('Conflicts', base) self.assertEqual(policy['Requisite'], [a.SITD]) self.assertEqual(policy['ExecStartPre'], ['/usr/bin/omamobile-tegu-mmd-attach', '--service-check']) + self.assertEqual(policy['RestartPreventExitStatus'], [str(a.REFUSED_SERVICE)]) def test_ril_requires_device_policy_and_dependency_fix(self): pkg = self.repo / 'packages/omamobile-modem-sit/PKGBUILD' From fd709bbc40fe6b55da3913b6bfe13aa4867804f5 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 6 Nov 2026 08:32:41 -0643 Subject: [PATCH 6/9] omamobile-telephony-tegu: the bridge's service check is an ExecCondition RestartPreventExitStatus= applies only to the main process, so an ExecStartPre= that refused with exit 3 was still restarted every RestartSec under Restart=on-failure. As an ExecCondition=, a refusal (any exit from 1 to 254) skips the start without a retry and without marking the bridge failed. Checked on systemd 262: ExecStartPre exiting 3 with RestartPreventExitStatus=3 restarted five times, ExecCondition exiting 3 skipped the start once. --- .../omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach | 5 ++--- .../omamobile-telephony-tegu/systemd/10-tegu-attach.conf | 6 ++---- packages/omamobile-telephony-tegu/test/test_attach.py | 5 +++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach index 798056c22..3ee8f2806 100755 --- a/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach +++ b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach @@ -25,9 +25,8 @@ BUS = 'org.freedesktop.ModemManager1' # tmp.mount: systemd adds it to any unit that uses /tmp. Neither it nor # these pull the CP or the RIL into a start transaction. BASIC = {'sysinit.target', 'basic.target', 'system.slice', 'dbus.socket', 'dbus.service', 'tmp.mount'} -# A service-check refusal exits with this code, which the bridge's drop-in -# names in RestartPreventExitStatus=, so a refused bridge stays down instead -# of retrying every RestartSec. +# A service-check refusal exits with this code. The bridge's ExecCondition +# treats it as a skipped start, without repeatedly restarting the service. REFUSED_SERVICE = 3 diff --git a/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf index a4490fa5c..56960ff72 100644 --- a/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf +++ b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf @@ -5,7 +5,5 @@ Requisite=omamobile-sitd.service After=omamobile-sitd.service [Service] -ExecStartPre=/usr/bin/omamobile-tegu-mmd-attach --service-check -# A refusal (exit 3) is not retried every RestartSec: the bridge stays down -# until the cause is fixed and it is started again. -RestartPreventExitStatus=3 +# A refused service check skips this start without retrying every RestartSec. +ExecCondition=/usr/bin/omamobile-tegu-mmd-attach --service-check diff --git a/packages/omamobile-telephony-tegu/test/test_attach.py b/packages/omamobile-telephony-tegu/test/test_attach.py index a95751b4f..23ab8cc74 100644 --- a/packages/omamobile-telephony-tegu/test/test_attach.py +++ b/packages/omamobile-telephony-tegu/test/test_attach.py @@ -286,8 +286,9 @@ def test_bridge_dependency_cannot_start_ril_or_cp(self): self.assertNotIn(key, fields) self.assertNotIn('Conflicts', base) self.assertEqual(policy['Requisite'], [a.SITD]) - self.assertEqual(policy['ExecStartPre'], ['/usr/bin/omamobile-tegu-mmd-attach', '--service-check']) - self.assertEqual(policy['RestartPreventExitStatus'], [str(a.REFUSED_SERVICE)]) + self.assertEqual(policy['ExecCondition'], ['/usr/bin/omamobile-tegu-mmd-attach', '--service-check']) + self.assertNotIn('ExecStartPre', policy) + self.assertNotIn('RestartPreventExitStatus', policy) def test_ril_requires_device_policy_and_dependency_fix(self): pkg = self.repo / 'packages/omamobile-modem-sit/PKGBUILD' From 87319729aab2ea02de10cc691b9f42bddc2002a0 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sun, 8 Nov 2026 17:47:16 -0643 Subject: [PATCH 7/9] omamobile-device-cheetah 0.1.48, device-tegu 0.2.10, modem-sit 0.3.32: versions past main after the rebase The rebase onto main dropped the two commits main already had and left these three packages changed without a version above main's. --- packages/omamobile-device-cheetah/version | 2 +- packages/omamobile-device-tegu/version | 2 +- packages/omamobile-modem-sit/version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/omamobile-device-cheetah/version b/packages/omamobile-device-cheetah/version index 9506d143f..5946febf1 100644 --- a/packages/omamobile-device-cheetah/version +++ b/packages/omamobile-device-cheetah/version @@ -1 +1 @@ -0.1.47 +0.1.48 diff --git a/packages/omamobile-device-tegu/version b/packages/omamobile-device-tegu/version index 1866a362b..13dead7eb 100644 --- a/packages/omamobile-device-tegu/version +++ b/packages/omamobile-device-tegu/version @@ -1 +1 @@ -0.2.9 +0.2.10 diff --git a/packages/omamobile-modem-sit/version b/packages/omamobile-modem-sit/version index f18b7fb98..cd906cd5e 100644 --- a/packages/omamobile-modem-sit/version +++ b/packages/omamobile-modem-sit/version @@ -1 +1 @@ -0.3.31 +0.3.32 From 313f726e36e0fcc92f54373c9611743ce83bfe9b Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 10:39:35 -0500 Subject: [PATCH 8/9] omamobile-telephony-tegu: depend on the device-tegu that lands with it (0.2.10) --- packages/omamobile-telephony-tegu/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/omamobile-telephony-tegu/PKGBUILD b/packages/omamobile-telephony-tegu/PKGBUILD index 38d41f353..0da8e53cb 100644 --- a/packages/omamobile-telephony-tegu/PKGBUILD +++ b/packages/omamobile-telephony-tegu/PKGBUILD @@ -6,7 +6,7 @@ pkgdesc="Opt-in Pixel 9a Phone/Messages bridge attachment to an already running arch=(any) url="https://github.com/derekross/omarchy-mobile" license=(MIT) -depends=(python systemd sudo 'omamobile-device-tegu>=0.2.9' +depends=(python systemd sudo 'omamobile-device-tegu>=0.2.10' 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4') install=omamobile-telephony-tegu.install From c7ac1b04f88e7c22f2bc1c62dc9d5528888b7424 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 11:05:18 -0500 Subject: [PATCH 9/9] omamobile-telephony-tegu: the dependency test reads device-tegu>=0.2.10 too --- packages/omamobile-telephony-tegu/test/all | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/omamobile-telephony-tegu/test/all b/packages/omamobile-telephony-tegu/test/all index 9f3a4f1cc..d91ec5010 100755 --- a/packages/omamobile-telephony-tegu/test/all +++ b/packages/omamobile-telephony-tegu/test/all @@ -18,7 +18,7 @@ done python3 -I -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' bin/omamobile-tegu-mmd-attach # Read the dependency declarations, not a grep that can match an optdepend. deps=$(startdir=$PWD bash -c 'source PKGBUILD; printf "%s\n" "${depends[@]}"') -for dep in 'omamobile-device-tegu>=0.2.9' 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4'; do +for dep in 'omamobile-device-tegu>=0.2.10' 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4'; do grep -qxF "$dep" <<<"$deps" done ! grep -qx omamobile-device-cheetah <<<"$deps"