Skip to content

omamobile-modem: allow a device-provided ordered link stack - #568

Merged
derekross merged 3 commits into
derekross:mainfrom
marselnenaj:codex/modem-device-link-stack
Nov 10, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
marselnenaj:codex/modem-device-link-stack

Conversation

@marselnenaj

@marselnenaj marselnenaj commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Allow a device package to provide an ordered modem PHY/host module list in /usr/lib/omamobile-modem/link.conf, a package-owned path outside vendor provisioning. The Pixel 9 Pro XL needs the separate PHY before its PCIe host. Without a configuration file, the gs201 load remains exactly modprobe pcie-gs201-cp allow_hw=1.

The configuration is data: one strictly validated ASCII module key=value… record per line, with no sourcing, evaluation or shell interpolation. Empty, malformed, linked or nonregular configuration refuses before loaded-parameter checks, the sleep-inhibitor check, persistent latch or module loads. A raw byte check rejects NUL before Bash can silently drop it. Both parsing passes use the same opened file. The existing marker, hold and refusal decisions remain intact.

Validation: the complete modem package suite and policy gate pass, including 16 actual starter/parser tests. Synthetic command-substitution and NUL fixtures refuse without reaching the inhibitor/latch/load. Restoring shell evaluation creates the fixture marker and fails its assertion; removing raw-byte validation restores an inert load and fails its assertion. Default load order and missing/mismatched loaded parameters remain covered.

The package stages the configuration directory and its documentation; the device package owns its optional data file. Version 0.1.17 remains provisional for the maintainer to allocate at merge. Device-specific drivers and physical modem qualification are separate. Existing MIT notices and attribution are preserved.

Keep the gs201 default while allowing a device package to select its PHY
and host modules. Refuse missing or mismatched parameters on already
loaded modules before the inhibitor, persistent latch or any new load.

Integrate synthetic parameter/order tests into the package suite and
advance the package version.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@derekross

Copy link
Copy Markdown
Owner

Thanks for this, and for testing the real checker and load loop rather than a copy. I checked the Pixel 7 Pro path by running main's allow_hw check and your list-based one side by side against fake /sys/module trees: not loaded, Y, N, and loaded without the parameter. They behave the same in all four. Without a link.conf the load is still exactly modprobe pcie-gs201-cp allow_hw=1. I also ran the package suite with #556 and #403 merged on top, since both touch the same script, and it stays green.

Two things before merge:

  1. Read link.conf as data, not with .. As it stands the starter sources a bash file as root before the bring-up latch, so a device package's fragment can reassign MARK or HOLD, or redefine refuse, which are the guards the rest of the script relies on. Our device descriptors are data-only for the same reason. One module key=value… per line, checked against a strict pattern and refused otherwise, would do it. A test with a $(…) line would prove the refusal.
  2. Version. 0.1.17 is claimed by several open modem PRs, so I'll set the number when I merge and put it in the title (omamobile-modem 0.1.<n>: …).

Smaller things: please say in the comment which phone needs the list, and drop or explain "identity-gate test". Consider a path the package owns alone instead of the directory tools/phone-provision fills with the extracted vendor files.

marselnenaj and others added 2 commits November 9, 2026 20:58
Do not source a device fragment as root before the bring-up latch: it could
replace the marker variables or refusal function. Accept only a strict ordered
module/key=value list, rejecting shell syntax before parameter checks,
the inhibitor, the persistent latch or any module load.

Use /usr/lib/omamobile-modem/link.conf outside the vendor provisioning tree.
Stage its package-owned directory and document the device-package contract.
Name the Pixel 9 Pro XL's PHY/host ordering requirement in the starter comment.
Keep the gs201 default and leave version allocation to the maintainer.

The complete package suite passes, including 13 actual source/guard tests.
A source-evaluation negative control creates the inert marker and fails the
same command-substitution assertion that the data parser passes.

Co-Authored-By: Codex <codex@openai.com>
Bash read discards NUL bytes, so a malformed module or parameter could become
a valid entry before the strict line pattern sees it. Reject non-ASCII-text
bytes in C locale with grep's binary handling disabled, before reading lines.
Read both passes through the same opened config file and fail on scan errors.

Actual full-starter tests reject NUL-only input and NUL in module/parameter
names before the inhibitor, latch or any module load. Removing the byte filter
restores the inert load trace and fails the same assertion. The full package
suite passes with all sixteen link tests.

Co-Authored-By: Codex <codex@openai.com>
@marselnenaj

Copy link
Copy Markdown
Contributor Author

I changed link.conf to a data-only ordered list: one module key=value… line, checked against a strict ASCII pattern. The starter never sources or evaluates it, so entries cannot replace MARK, HOLD or refuse. Invalid or empty configurations refuse before parameter checks, the inhibitor, the bring-up latch or module loads.

The device-package path is now /usr/lib/omamobile-modem/link.conf, outside vendor provisioning. The package stages that directory and installs documentation for the contract. Without the file, the gs201 command remains exactly modprobe pcie-gs201-cp allow_hw=1. I named the Pixel 9 Pro XL's PHY-before-host requirement and replaced the unexplained test wording.

The complete package suite and policy checks pass, including 16 actual starter/parser tests. A $(touch …) fixture refuses without creating its temporary marker; restoring source evaluation creates the marker and fails that assertion. Loaded-parameter refusal still precedes the inhibitor/latch, and ordered loads see the latch already present. I left the proposed version unchanged for your allocation at merge.

Independent review also found that Bash silently drops NUL bytes. The parser now checks raw ASCII text before reading lines, using the same opened file. Full-starter fixtures reject NUL-only input and NUL inside a module or parameter before inhibitor/latch/load; removing that byte check restores the inert load and fails the test.

@derekross

Copy link
Copy Markdown
Owner

Thank you, this is exactly what I asked for, and the NUL check is a good catch I hadn't thought of. I read the parser and the tests and ran them: all 16 pass, and they fail when I take out the binary-byte check or weaken the symlink check. With no link.conf, the real starter still runs exactly modprobe pcie-gs201-cp allow_hw=1, after the latch, so the Pixel 7 Pro is unchanged. A bad file is refused before the inhibitor and the latch, as you said.

I'll merge this and set the version and title at merge. Two small edits I'll make while squashing, unless you'd rather push them: the README's last sentence about the version is a note for this PR rather than for the phone, and "the Pixel 9 Pro XL needs a separate PHY" becomes "is expected to need" until that kernel is public.

The first device package that ships a link.conf gets its own review, as you wrote in the README.

@derekross
derekross merged commit 8c7bf83 into derekross:main Nov 10, 2026
2 checks passed
robotosaith added a commit to robotosaith/omarchy-mobile that referenced this pull request Nov 10, 2026
Review of derekross#424: a modprobe that failed left through set -e, not
refuse(), so the sleep block stayed although the unit comment said
"no CPIF" released it. Each modprobe now refuses with its module's
name for the tile ("Off: cpif didn't load"). refuse() then releases
the block only when none of the modem's drivers is loaded, and that
list now takes the device's link stack from link.conf (derekross#568) as well
as pcie_gs201_cp, shm_ipc and cpif: a module that loaded and failed in
probe keeps the block, one that never loaded releases it. The latch
stays either way, as it did.

test_link.py runs the real starter through both cases (the first link
module fails: the block goes; the second fails with the first loaded,
a module named only in link.conf: it stays), with a fake systemctl so
the tests never ask the host's. The inhibitor's and the modem unit's
headers and cheetah's MODEM-PLAN M4.6 get the dated release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 10, 2026
Main took 0.1.17 (derekross#568) and 0.3.33 (derekross#569) for other changes and
omamobile-device-tegu 0.2.11 (derekross#591), so this branch's packages move to
the next numbers and the README names the modem package version the
stop command comes with.
ikegam added a commit to ikegam/omarchy-mobile that referenced this pull request Nov 12, 2026
…d-enable

test_link.py (derekross#568) runs the real starter with its paths redirected, but
not the M6 enable file, so on a phone with /etc/omamobile/modem-suspend-enable
the starter skipped the lock and four cases failed in makepkg's check();
on a laptop they passed. The file now points into the test's directory.

Two cases run the starter with no lock held: without the file it refuses
with "Off: no sleep inhibitor" before any driver and before the latch; with
it, the drivers load and the lock is never asked for. Inverting the
condition in omamobile-modem-start now fails six cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…ck (derekross#568)

A device package can give omamobile-modem its own ordered list of link
modules (link.conf). The file is read as data, never sourced: it is
refused, before the sleep inhibitor and the bring-up latch, when it is a
symlink, holds a NUL or other binary byte, or names anything but module
names and their parameters. Without the file the starter loads what it
loaded before; the Pixel 7 Pro's path is unchanged (pcie-gs201-cp
allow_hw=1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants