Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Canonical branch: `main`. Sole remote: `origin` → `https://github.com/CERALIVE
|-----------|----------|------|
| `control/` | `@ceralive/modem-control` (npm) | TypeScript control library — domain model, ModemManager D-Bus backend, NetworkManager adapter, desired-state reconciler, injected admission/ownership/USB-hub ports, USB composition-mode model + evidence-bundle **ingestion seam**, data-usage sampler + the **usage-policy write surface**, capability-module **support-claim taxonomy + detection**, and the **band-lock** vocabulary + certification catalog (see §§ below). Published to public npm under `@ceralive` as **built ESM + `.d.ts`** across seven entry points (see § PUBLISHED PACKAGE SURFACE). |
| `cli/` | `modem-control` (bench CLI) | The iteration surface: `probe`/`watch`/`apply`/`set-usb-mode`/`usage`/`certify`/`hil-cycle`, compiled `arm64`+`amd64`, run against real modems. Not published to npm. |
| `packaging/` | ModemManager stack `.deb`s **+ the first-party companion** | Trixie rebuilds of ModemManager + libmbim + libqmi + libqrtr-glib — packaging only, not a fork. libmbim/libqmi/libqrtr-glib remain source-unmodified; ModemManager carries exactly three owner-approved, BELABOX-derived FM350-GL patches, hardware-validated on the carrier-mediated USB topology after restoring the original `ATZ0` first-enable override (see `POLICY.md` and `docs/adr/ADR-FM350-RNDIS-BEARER.md`) — PLUS `ceralive-modem-support`, the `Architecture: all` first-party companion that owns CeraLive's generic modem system assets. |
| `packaging/` | ModemManager stack `.deb`s **+ the first-party companion** | Trixie rebuilds of ModemManager + libmbim + libqmi + libqrtr-glib — packaging only, not a fork. libmbim/libqmi/libqrtr-glib remain source-unmodified; ModemManager carries three owner-approved, BELABOX-derived FM350-GL patches, hardware-validated on the carrier-mediated USB topology after restoring the original `ATZ0` first-enable override (see `POLICY.md` and `docs/adr/ADR-FM350-RNDIS-BEARER.md`), plus one generic registration-parser fix on the openstreambox release line (`0004`, two-digit AcT values in `+CREG`/`+CGREG`/`+CEREG`) — PLUS `ceralive-modem-support`, the `Architecture: all` first-party companion that owns CeraLive's generic modem system assets. |

`control/` + `cli/` are one **Bun** workspace. `packaging/` builds in a **trixie** container —
the suite the device image runs; `build-stack.sh` refuses a container whose suite disagrees.
Expand Down Expand Up @@ -1592,6 +1592,9 @@ own-number blocks in `control/src/redact.test.ts`.
patch later is an architecture gate (rationale + filed upstream MR + review). The sole current
exception is the exact three-patch BELABOX-derived FM350-GL series approved by the project
owner on 2026-08-22; its MR is still drafted, not filed, and its hardware drill remains open.
The openstreambox release line additionally carries patch `0004` (two-digit AcT values in
`+CREG`/`+CGREG`/`+CEREG`) under a separate release-line waiver in `POLICY.md` §1; it is not
upstream yet.
This narrow exception does not weaken the default that udev/plugin/device-support improvements
go **upstream first**. The Phase A → Phase B scope boundary is **version-gated at
`v1.0.0`**: CeraUI / device-image / apt integration is out of scope through `v0.2.0` and
Expand Down Expand Up @@ -1640,8 +1643,8 @@ bun run verify:consumers # install the tarball into standalone Node 26 + Bun pr
`packaging/` runs in a `debian:$TARGET_SUITE` container (default `trixie`); its contract/verification scripts live
under `packaging/ci/`. The four sources' `debian/` recipes are checked in at
`packaging/<Source>/debian/` (`ModemManager`, `libmbim`, `libqmi`, `libqrtr-glib` — matching
their pinned salsa commits except the suite adaptations and the approved ModemManager
FM350-GL series documented in `packaging/SUITE-ADAPTATIONS.md`).
their pinned salsa commits except the suite adaptations and the ModemManager patch series
(the approved FM350-GL patches and the fork's `0004`) documented in `packaging/SUITE-ADAPTATIONS.md`).
`packaging/ci/build-stack.sh <amd64|arm64>` (suite-parameterized: `TARGET_SUITE`, default
`trixie`) rebuilds
them from source in the mandatory bootstrap order (`libqrtr-glib → libmbim → libqmi →
Expand Down
15 changes: 14 additions & 1 deletion POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,24 @@ the BELABOX author, originating commit SHA(s), rationale, and `Forwarded: no` st
series is hardware-verified on the carrier-mediated USB topology and must be retired when
upstream ships equivalent support.

**Fork release-line waiver, registration parser, 2026-11-25.** The openstreambox release line
(`osb/release/*`) also carries `0004-modem-helpers-accept-two-digit-act-in-creg.patch`: the
generic `+CREG`/`+CGREG`/`+CEREG` patterns accept the two-digit AcT values 10 to 13, without
which a modem that registers on 5G SA after ModemManager's registration attempt (the FM350-GL)
stays at `searching`. It is a second, separate waiver of §1, held by the openstreambox fork and
limited to its release line; it is not part of the CeraLive owner exception above, and `main`
does not carry it. Against §1: requirement 1 is the rationale in the ADR, section 2.4;
requirement 2 is **not met** (not offered upstream yet; the patch records `Forwarded: no`);
requirement 3 is an independent review of the change, with the fork owner's merge into the
release line as the sign-off. Until that merge the patch is not carried. It is retired when
upstream ModemManager accepts two-digit AcT values in these patterns.

## 2. Upstream-contribution-first

For anything that is genuinely a modem-support improvement — udev rules, ModemManager
plugins, device quirks, port-type hints — **the contribution goes upstream first**, except
for the single dated FM350-GL owner exception recorded in §1.
for the dated FM350-GL owner exception and the openstreambox release-line waiver for patch
`0004`, both recorded in §1.

- New device support, mode-switch quirks, and plugin changes are proposed to upstream
ModemManager / the Debian packaging, not accreted as local carry.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ straight from CI artifacts; nothing is published to `apt.ceralive.tv` yet.
|-----------|----------|------------|
| [`control/`](control/) | **`@ceralive/modem-control`** (npm package) | The TypeScript control library: the [frozen v1.1 domain contracts](docs/DOMAIN-CONTRACTS.md), [provider registry and evidence-scored matcher](docs/PROVIDER-MATCHING.md), concrete typed-D-Bus [`ModemManagerProvider`](docs/MODEMMANAGER-PROVIDER.md) (runtime-discovered generic controls; no CLI subprocess), NetworkManager adapter, desired-state reconciler, injected mutation-admission and exclusive-ownership ports, USB composition-mode model + the [evidence-bundle ingestion seam](docs/CATALOG-INGESTION.md), data-usage sampler plus its `setUsagePolicy` write surface (`control/src/backend/usage/policy-write.ts` — a local 0600 policy file, because ModemManager exposes no data-usage API at all), and the **read-only SMS port** (`control/src/ports/sms.ts` + `control/src/sms/` — LIST/READ plus `Added`/`Deleted` observation, never a send or a delete, locked by `sms/readonly-gate.test.ts`). The USB-hub actuator is port-only here; the bench CLI owns its HIL adapter. Published to the public npm registry under the `@ceralive` scope as **built ESM + `.d.ts`** across seven entry points — see [`control/README.md`](control/README.md). |
| [`cli/`](cli/) | **`modem-control`** (bench CLI) | The iteration surface: `probe`, `watch`, `apply`, `set-usb-mode`, `usage`, `certify`, `hil-cycle`. Compiled for `arm64` + `amd64` and run against real modems on a bench device to mature the package, capture per-SKU certification bundles, and prove hub VBUS port-cycling ([RB-10](docs/BENCH.md#rb-10--hub-vbus-verification-partial)). |
| [`packaging/`](packaging/) | **ModemManager stack `.deb`s** | Trixie rebuilds of ModemManager + libmbim + libqmi + libqrtr-glib — **packaging only, not a fork**. libmbim, libqmi, and libqrtr-glib remain source-unmodified; ModemManager carries one owner-approved, three-patch BELABOX-derived FM350-GL series, hardware-validated on the carrier-mounted USB composition after restoring BELABOX's `ATZ0` first-enable override (see [`POLICY.md`](POLICY.md) and the [ADR](docs/adr/ADR-FM350-RNDIS-BEARER.md)). Provenance-verified upstream pins; installed on the bench from CI artifacts. |
| [`packaging/`](packaging/) | **ModemManager stack `.deb`s** | Trixie rebuilds of ModemManager + libmbim + libqmi + libqrtr-glib — **packaging only, not a fork**. libmbim, libqmi, and libqrtr-glib remain source-unmodified; ModemManager carries one owner-approved, three-patch BELABOX-derived FM350-GL series, hardware-validated on the carrier-mounted USB composition after restoring BELABOX's `ATZ0` first-enable override (see [`POLICY.md`](POLICY.md) and the [ADR](docs/adr/ADR-FM350-RNDIS-BEARER.md)), plus one generic registration-parser fix on the openstreambox release line (`0004`, two-digit AcT values in `+CREG`/`+CGREG`/`+CEREG`). Provenance-verified upstream pins; installed on the bench from CI artifacts. |

The control package's existing `./hardware` entry point also exposes transport-free
SIM-presence and Huawei/ZTE/UFI response normalization. Device I/O, sessions, retries,
Expand Down
54 changes: 54 additions & 0 deletions docs/adr/ADR-FM350-RNDIS-BEARER.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,60 @@ T-Mobile and Verizon answers as captured (documentation-range addresses), the ol
layout including a short mask, a bare address followed by a gateway, and a malformed line next
to a good one. Hardware confirmation on T-Mobile is pending.

### 2.4 Follow-up: registration on 5G SA is missed after a replug (2026-11-25)

After a replug on T-Mobile US 5G SA (n41, firmware `81600.0000.00.29.18.01`) the module
registered (`AT+CEREG?` read `2,1,…,11`, `+COPS` AcT 11), but ModemManager reported
`searching` for four minutes and sent no registration query in a 50 s debug capture. One
`mmcli -m <n> --3gpp-register-home` made it read the registration, and the bearer connected
16 s later.

The cause is in the generic layer, not in the `fm350gl` plugin, which overrides no 3GPP
registration step. The parser defect is confirmed from source and recorded answers; how it
played out in the field is inferred, because the capture holds no URC from the module:

- The firmware reports 5GS registration through the legacy `+CREG`, `+CGREG` and `+CEREG`
with AcT 11 (NR connected to a 5GCN). Recorded answers, with synthetic TAC and cell id:
`+CREG: 2,1,"1F00","12345A00B",11`, `+CGREG: 2,1,"1F00","12345A00B",11,"FF"`,
`+CEREG: 2,1,"1F00","12345A00B",11`. While searching it answers
`+CEREG: 2,2,"FFFF","0FFFFFFF",0`.
- In `src/mm-modem-helpers.c` (`creg_regex[]`, entries 5, 6, 7, 9, 10 and 11) every pattern
that captures an AcT field accepts one digit only. So the searching answers (AcT 0) parse and
the registered ones (AcT 11) match nothing, URCs included. The only registered line that
parses is the solicited `+CGREG` with its trailing RAC, which falls through to the six-field
pattern 8; that is why any fresh poll (the nudge, or another one-shot check such as enabling
3GPP location) reads the modem as registered. The AcT-to-access-technology mapping already
handles 10 to 13. Upstream main has the same one-digit AcT in these patterns.
- `+C5GREG` is not used for this module: 1.24.2's generic code enables only `+CREG`, `+CGREG`
and `+CEREG` reports, and since the module lists no 5G mode in `AT+WS46=?`
(`12,22,25,28,29,30,31`) it gets no 5GNR capability, so 5GS registration is never polled
either. That is harmless here because the firmware mirrors the registration into the legacy
reports.
- `src/mm-iface-modem-3gpp.c` starts periodic registration checks only when setting up or
enabling unsolicited registration reports fails. They succeed on this module. Without them,
the registration is read again only by event-driven checks: a registration attempt (every
3 s, bounded, 60 s for a register request) or a one-shot check such as enabling 3GPP
location. Nothing schedules one while the modem sits at `searching`, so once the attempt
has ended the dropped URCs are the only signal, and a module that registers after that
stays at `searching` until something triggers a check.

Patch `0004` accepts AcT 10 to 13, unpadded, in those six fields, and only where the line
has no competing reading: the AT port tries URC patterns in reverse order (handlers are
prepended) and responses in forward order, so a padded `<stat>`, a padded or two-digit cell id
or an unquoted RAC could otherwise pass for an AcT. In patterns 5, 9 and 10 the field after
`<stat>` must not be a (padded) digit; in pattern 7 the `<ci>` must not be a value 0 to 13. It also reads the `+CREG`/`+CGREG` `<lac>` as a TAC on NR,
so the three reports agree on the location. Tests in `src/tests/test-modem-helpers.c` cover the
module's layouts solicited and unsolicited, AcT 10 and 13, the radio-on sequence
(`2,4` → `2,2` → `2,1,…,11`), a searching-then-URC sequence (a plausible model of the field
event, built from the recorded answers in their 27.007 unsolicited form) and five layouts a
looser pattern misreads, each in both orders. Over the strings in the 1.24.2 tests plus a
generated set of about 52,000 `+CREG`/`+CGREG`/`+CEREG` lines (padded and unpadded fields, 4- to
6-field layouts), each parsed as response and as URC in both orders, no line that parsed
before changes its result, the set of order-dependent lines is the same as before, and every
newly parsed line carries an unpadded 10 to 13. There is
no hardware confirmation yet. Until a build with `0004` runs on a box, the field fallback stays
the `--3gpp-register-home` nudge above.

---

## 3. Upstream 1.24 does not cover this device (POLICY §1.1 — "why a rebuild cannot")
Expand Down
Loading