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
14 changes: 12 additions & 2 deletions device/cheetah/MODEM-CLIENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Two packages:
| `sit.py` | ported | The single-owner IPC0 transport: framing, token matching, indication queue (signal and physical-channel snapshots coalesced so telemetry can't crowd out an SMS reply). Two guards: the allow-list of requests this stack sends, and our do-not-send list (NV, identity, carrier lock, AT forwarding, VSIM, satellite) checked first, so an edit to the allow-list can't let one through. Dial and SMS sends need the owner's flags |
| `sit_names.py` | ours | The 602 message names, for logs |
| `bringup.py` | ported, carrier values moved to the config | The start-up order (section 1.1) |
| `carrier_apn.py` | ours | The SIM's carrier settings from its home network code (GET_IMSI's MCC/MNC, the rest dropped): the package's `apn-overrides.conf` first, then mobile-broadband-provider-info's `serviceproviders.xml`; the internet and attach APNs, `ims_apn`, `ims_first`, `internet_cid` and the data profiles, each only where `[network]` leaves it `auto` or empty (0.3.29, TELEPHONY-APPS-PLAN 7.6) |
| `omamobile-sit-config` | ours | The pkexec helper behind the shell's Mobile network page (polkit action `org.omamobile.modem-sit.configure`): `set apn\|attach_apn\|roaming` and `get`, nothing else in `modem-sit.conf`; an APN must be a plain carrier APN, and the file is rewritten atomically with its comments kept |
| `data_call.py` | ported, APN from the config | Setup (983 bytes; no PDU session ID on cellular, as stock), initial attach (251), data profile (246); bearer ownership recorded in RAM before each setup, never retried blindly |
| `ims.py` | ported (identity strings ours) | IMS stack start, hidden-menu configuration, ADD_PDN_INFO from the IMS bearer, the registration indication |
| `radio_settings.py` | ported | NR mode byte (3 -> 0 keeps LTE; the original kept in RAM) |
Expand Down Expand Up @@ -103,8 +105,16 @@ registration indication), unless `ims_required = yes`.
- **No NV writes from Linux, by construction.** The RIL speaks only SIT on
`umts_ipc0` and fixed AT on `umts_router`; there is no raw-request path.
NV lives in rfsd's RAM copies (MODEM-PLAN M3).
- **No identity reads.** GET_IMEI/IMSI/SIM I/O, PIN and APDU requests are
not on the allow-list; GET_IMEI/IMEISV are on the do-not-send list too.
- **No identity reads, but one.** GET_IMEI, SIM I/O, PIN and APDU requests
are not on the allow-list; GET_IMEI/IMEISV are on the do-not-send list too.
From 0.3.29 GET_IMSI is, sent once at start-up when any of `[network]`
`apn`, `attach_apn`, `ims_apn`, `ims_first` or `internet_cid` is `auto`
or empty. Those are the shipped defaults, so by default it is sent at
every boot, and typing `apn` and `attach_apn` alone still sends it (for
the bearer order); only typing all five reads no IMSI. Only its MCC/MNC
is used, to choose the APNs, the bearer order and the data profiles
(`carrier_apn.py`, TELEPHONY-APPS-PLAN 7.6); the IMSI is never logged,
stored or published, and the simulator tests fail if it reaches the log.
- **Logs.** Requests by name and status code; SIM card/app state; data-call
status/CID/type; IMS registration state/features. Never numbers, message
text, addresses or the IMSI. The simulator tests fail if a number or a
Expand Down
22 changes: 22 additions & 0 deletions docs/TELEPHONY-APPS-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,28 @@ An "Emergency call" button on the lock plugin's keypad page (patch 0003 added th
- **Quick settings.** "Mobile data" (in the roadmap today, waiting on M4) toggles NM's `gsm` connection (`nmcli`) from T3, or `omamobile-sit data on|off` before that. A long press opens a sheet with the operator, signal, APN and a roaming switch. "Airplane mode" also turns the radio off (`Modem.Enable(false)`).
- **SIM PIN.** If the SIM asks for a PIN, the shell shows an unlock sheet (`Sim.SendPin`). Until T8 the RIL can't do this, so the SIM's PIN lock must stay off (as M4.2 already says).

### 7.6 SIM setup with no APN to type (2026-11-02)

On 2026-11-02 a reseller SIM on Verizon's network needed its APN typed into `modem-sit.conf` before sitd would start ("No APN configured"), and then registered only once `vzwims` was the attach APN. A phone's SIM should just work. Built offline in `omamobile-modem-sit` 0.3.12, `omamobile-mmd` 0.1.1 and `omamobile-shell` 0.2.93, and merged with main on 2026-11-03 as `omamobile-modem-sit` 0.3.29, `omamobile-mmd` 0.1.2 and `omamobile-shell` 0.2.99 (main's 0.3.24-0.3.28, #384, #387 and #364, brought `attach_apn = none`, `ims_first`, `internet_cid`, `[profiles]`, `carrier_manifest` and the unconfirmed-hangup stop; main's shell 0.2.97 and #397's 0.2.98 come before this). Nothing below has met the phone yet as the automatic path; the values it produces for Verizon's codes are the ones set by hand on the 7 Pro on 2026-11-03 (phone checks at the end).

**What 2026-11-03 changed** ([cheetah NOTES](../device/cheetah/NOTES.md) 2026-11-03, [IMS-SHANNON](../device/cheetah/IMS-SHANNON.md) sections 11 and 12): IMS registered and carried an SMS on the 7 Pro once sitd did what stock's RIL does on a Verizon network: no initial attach APN at all (`attach_apn = none`; the modem attaches with its carrier profile, and its attach bearer carries IMS), `ims_apn = IMS`, the IMS bearer first on CID 2 and the internet on CID 3 (`ims_first = yes`, `internet_cid = 3`), and stock's four data profiles (`[profiles]` 0 VZWINTERNET default,supl,dun ipv4v6; 2 IMS ia,ims ipv4v6, roaming ipv6; 3 VZWADMIN fota; 4 VZWAPP cbs,mms). The 11-02 value `attach_apn = vzwims` registered but never got IMS (our attach replaced the profile's attach and its P-CSCF request), so it is wrong now. The carrier lookup therefore fills all of these: an override section carries `attach_apn` (an APN, or `none`), `ims_apn`, `ims_first`, `internet_cid` and `profile_<ID>` lines with the `[profiles]` meaning, and `like = MCC/MNC` lets a carrier's codes share one section. `[network] ims_apn`, `ims_first` and `internet_cid` default to `auto` (the override's value, else `ims`, `no` and `1`), `[profiles]` empty takes the override's set and any typed line replaces it, and a typed value always wins. The carrier manifest stays the owner's (`carrier_manifest`): it names a file in the owner's own modem chroot.

- **Where the APN comes from.** `[network] apn` and `attach_apn` are `auto` by default (empty means the same). With `auto`, sitd sends GET_IMSI (0x0400) once after the USIM is READY, with the USIM's AID from GET_SIM_STATUS (MODEM-SIT-RESEARCH 3.2), keeps only the MCC and the MNC candidates (three digits first in the three-digit countries of E.212, else two), and looks them up: first in the project's `apn-overrides.conf` (`/usr/share/omamobile/modem-sit/`), then in the system's `mobile-broadband-provider-info` (`serviceproviders.xml`, GNOME, **CC-PDDC** public-domain dedication, `arch=any`, in Arch Linux ARM's extra and already pulled in by NetworkManager; now a dependency of `omamobile-modem-sit`). Among providers sharing a code, `primary="true"` wins, then the provider listing more network codes (the operator over its resellers). Its first internet-capable APN (`internet`, `mms-internet-hipri*` or no usage) is the internet APN, never one named `ims`. A value typed in the config always wins, and a typed internet APN with `attach_apn = auto` still takes the carrier's attach APN.
- **The attach APN** (SET_INITIAL_ATTACH_APN) is the override's `attach_apn` (an APN, or `none`: not sent), else a database APN typed `ia`, else the internet APN (what a phone does when the carrier lists none). The database has no `ia` entries today, so the overrides carry the carriers that need another one. The only override so far is Verizon's codes (the database's own list): internet `VZWINTERNET` (the database lists `vzwims` first; Verizon's page gives VZWINTERNET for internet, [knowledge-base-240220](https://www.verizon.com/support/knowledge-base-240220/)), attach `none`, IMS APN `IMS`, IMS first on CID 2 with the internet on CID 3, and stock's four profiles (the 2026-11-03 result above; the 11-02 captures' `vzwims` is superseded). Other carriers worldwide get the database's internet APN as both, the older bearer order (internet on CID 1, then IMS) and profile 0 alone. **Merged:** main's `[network] attach_apn` (#356, #384) has the same meaning (empty: the internet APN; `none`: not sent); this PR adds `auto` and the per-carrier choice, and `start()` was merged by hand on 2026-11-03.
- **No APN found** (unknown code, GET_IMSI refused, no database): sitd no longer stops before the radio. It skips the attach APN and the default data profile, registers, skips the internet bearer and goes on to IMS, so calls and SMS work; status reports `apn.source = none` and `data_available = false`. A configured APN still fails start-up as before if the modem refuses the bearer.
- **What is logged.** Only the source ("APN chosen from the carrier database", "attach APN chosen from the project's carrier overrides"). Never the IMSI, the MCC/MNC or an APN: together with a log excerpt in a plan they would name the maintainer's carrier. The status socket and `state.json` carry the APNs in use (`modem.apn`: `value`, `source`, `attach`, `attach_source`) and the SIM's PIN1 state (`sim.pin_lock`, from the application record's +57), for the page; no IMSI.
- **Mobile network page** (`omamobile.mobilenetwork`): Setup > Mobile network (only where `/usr/lib/omamobile-sit/omamobile-sit-config` exists) and the Mobile data tile's chevron. Carrier, registration and technology, signal (ModemManager's `SignalQuality` when recent, else "Not reported yet"), Mobile data and Data roaming switches, the APN in use with its source and a field to type one (or go back to the SIM's), Advanced with the attach APN and its own field, and the SIM PIN lock. "No modem" without the stack. Backend `omamobile-mobile-network` (reads `state.json`, the config and MM; never a number or identifier). Changes go through `omamobile-sit-config` under `pkexec` (polkit `org.omamobile.modem-sit.configure`, `allow_active=yes`), which changes only `apn`, `attach_apn` and `[data] roaming`, checks each value and keeps the file's comments. **APN changes apply after a restart of the phone** (the page offers one): sitd's unit says a second start-up on the same CP isn't supported, so nothing restarts `omamobile-sitd`, and never `omamobile-modem`. Data roaming applies at once: `omamobile-sit-data` reads it on every pass and drops the cellular route while the network reports roaming (default `yes`, the behaviour so far).
- **Setup** (`omamobile-onboarding`): with the stack running and a SIM, it names the carrier and says mobile data is set up automatically; a SIM without an APN is sent to Setup > Mobile network; nothing is shown without the stack.
- **Not done:** SPN or GID1 to tell resellers on a shared code apart (needs SIM_IO, not on the allow-list); such a reseller gets the operator's APN, which works for the big US resellers on their host's network.

**Phone checks** (attended, modem tests on the charger; each is one boot, read-only first; quote no APN, code or identifier from the journal into this plan):

1. *Low risk.* Install the three packages; keep a copy of `/etc/omamobile/modem-sit.conf`. `pacman -Q mobile-broadband-provider-info` is installed. **Pass:** `omamobile-sit-config get` (as root) prints the current values; the `.pacnew` is reviewed. **Stop** if the package or polkit action is missing.
2. *Medium (a boot with the modem).* Set `apn = auto`, `attach_apn = auto`, `ims_apn = auto`, `ims_first = auto`, `internet_cid = auto` and an empty `[profiles]` (keep `carrier_manifest`), reboot. **Expect:** journal `Startup: APN chosen from ...`, `attach APN chosen from ... (none: not sent)`, `bearer order and data profiles from ...`, `SIT GET_IMSI: error=0`, four `data profile N accepted` lines, `initial attach APN not sent`, IMS on CID 2 before the internet on CID 3, registration within `register_timeout`, IMS registered, `omamobile-sit status` data bearer up: the same lines as the 2026-11-03 boot with the values typed. **Stop** if GET_IMSI is refused (the log says "could not be read") or registration times out: GET_IMSI hasn't met this firmware, and the AID layout comes from stock's builder only. **Rollback:** the typed values of IMS-SHANNON section 12, reboot.
3. *Medium.* The no-APN path: `apn = auto` with a temporary `OMAMOBILE_SIT_PROVIDERS`/`OMAMOBILE_SIT_APN_OVERRIDES` pointing at empty files (a `systemctl edit omamobile-sitd` drop-in), reboot. **Expect:** registration without an attach APN or data profile, IMS registered, `data_available: false`, an SMS to your own number arrives. **Stop** if registration fails: then a no-APN SIM needs another attach APN (the IMS APN is the next candidate). **Rollback:** remove the drop-in, reboot.
4. *Low.* The page: Setup > Mobile network and the tile's chevron open it; carrier, LTE, Mobile data and roaming switches follow `omamobile-sit status`; type an APN, Save asks nothing (active session), the config line changes, "Restart now" reboots; "Use the APN from the SIM" restores `auto`. Turn roaming off: nothing changes at home (the route stays). Announce the restart to whoever holds the phone.
5. *Low.* Setup's line: run `omamobile-onboarding` and check the "Mobile network: ... set up automatically" line.

---

## 8. The other apps: reuse or build
Expand Down
25 changes: 23 additions & 2 deletions packages/omamobile-mmd/lib/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def static_props(self, name):
SupportedBands=[mm.BAND_UNKNOWN], CurrentBands=[mm.BAND_UNKNOWN],
SupportedIpFamilies=mm.IP_V4 | mm.IP_V6 | mm.IP_V4V6)
if name == mm.MODEM_3GPP:
apn, ip_type = self.settings.get('apn', ''), self.settings.get('ip_type', 'ipv4v6')
apn, ip_type = self.apn_settings(attach=True)
settings = {'apn': GLib.Variant('s', apn),
'ip-type': GLib.Variant('u', IP_TYPES.get(ip_type, mm.IP_V4V6))} if apn else {}
return dict(InitialEpsBearerSettings=settings)
Expand Down Expand Up @@ -250,6 +250,27 @@ def dynamic_props(self, name, d):
return dict(self.signal)
return {}

def apn_settings(self, attach=False):
"""The APN sitd's start-up used (sitd 0.3.29 reports it: typed, or
chosen from the SIM), else the config's value; "auto" is no APN.
attach: the initial attach APN (InitialEpsBearerSettings) instead of
the internet APN; the config's attach_apn, when empty, is the APN,
and "none" (no attach APN sent) leaves the settings empty."""
used = ((self.status or {}).get('modem') or {}).get('apn') or {}
known = isinstance(used, dict) and bool(used.get('source'))
if known:
apn = used.get('attach', '') if attach and 'attach' in used else used.get('value', '')
else:
apn = self.settings.get('apn', '')
if attach:
typed = self.settings.get('attach_apn', '')
apn = typed if typed and typed.lower() != 'auto' else apn
# "auto" is chosen from the SIM (no APN until sitd reports it);
# "none" (sitd 0.3.24+) means no initial attach APN is sent at all.
if apn.lower() in ('auto', 'none'):
apn = ''
return apn, self.settings.get('ip_type', 'ipv4v6')

def create_sim(self, d):
self.sim = self.path('SIM')
self.x.add(self.sim, {mm.SIM: dict(Active=True, SimType=mm.SIM_TYPE_PHYSICAL,
Expand All @@ -264,7 +285,7 @@ def sim_dynamic(self, d):

def create_bearer(self, d):
self.bearer = self.path('Bearer')
apn, ip_type = self.settings.get('apn', ''), self.settings.get('ip_type', 'ipv4v6')
apn, ip_type = self.apn_settings()
self.x.add(self.bearer, {mm.BEARER: dict(
Interface='rmnet0', Connected=d['data'], IpTimeout=20, BearerType=mm.BEARER_DEFAULT,
ProfileId=-1, Properties={'apn': GLib.Variant('s', apn),
Expand Down
5 changes: 4 additions & 1 deletion packages/omamobile-mmd/lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@

def sit_settings(path):
"""The APN and IP type from sitd's own config, for
Modem3gpp.InitialEpsBearerSettings and the bearer's properties."""
Modem3gpp.InitialEpsBearerSettings and the bearer's properties, until
sitd's status names the APN its start-up used ("auto" is chosen from
the SIM, so it is no APN here)."""
parser = configparser.ConfigParser(interpolation=None)
try:
parser.read(path)
Expand All @@ -40,6 +42,7 @@ def sit_settings(path):
if not parser.has_section('network'):
return {}
return dict(apn=parser['network'].get('apn', '').strip(),
attach_apn=parser['network'].get('attach_apn', '').strip(),
ip_type=parser['network'].get('ip_type', 'ipv4v6').strip())


Expand Down
29 changes: 29 additions & 0 deletions packages/omamobile-mmd/test/test_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,35 @@ def call(sid, state, direction='incoming', number=SENDER, reason=''):
multiparty=False, since=0)


class ApnSettings(unittest.TestCase):
"""The APN shown on the bearer: the one sitd's start-up used, else the
config's; "auto" (chosen from the SIM) is never shown as an APN."""
def apn(self, settings, used=None, attach=False):
b = bridge.Bridge(None, None, settings)
b.status = dict(modem=dict(apn=used)) if used is not None else None
return b.apn_settings(attach=attach)[0]

def test_attach(self):
used = dict(value='vzwinternet', source='override', attach='vzwims', attach_source='override')
self.assertEqual(self.apn(dict(apn='auto'), used, attach=True), 'vzwims')
self.assertEqual(self.apn(dict(apn='auto'), used), 'vzwinternet')
self.assertEqual(self.apn(dict(apn='internet.example', attach_apn='auto'), attach=True), 'internet.example')
self.assertEqual(self.apn(dict(apn='internet.example', attach_apn='ims'), attach=True), 'ims')
# attach_apn = none (sitd 0.3.24+): no initial attach APN is sent.
used = dict(value='VZWINTERNET', source='override', attach='none', attach_source='override')
self.assertEqual(self.apn(dict(apn='auto'), used, attach=True), '')
self.assertEqual(self.apn(dict(apn='auto'), used), 'VZWINTERNET')
self.assertEqual(self.apn(dict(apn='internet.example', attach_apn='none'), attach=True), '')

def test_sources(self):
self.assertEqual(self.apn(dict(apn='internet.example')), 'internet.example')
self.assertEqual(self.apn(dict(apn='auto')), '')
self.assertEqual(self.apn(dict(apn='auto'), dict(value='vzwinternet', source='override')), 'vzwinternet')
self.assertEqual(self.apn(dict(apn='auto'), dict(value='', source='none')), '')
# Before start-up has chosen (source empty), the config's value.
self.assertEqual(self.apn(dict(apn='internet.example'), dict(value='', source='')), 'internet.example')


class Derive(unittest.TestCase):
def test_states(self):
cases = [
Expand Down
2 changes: 1 addition & 1 deletion packages/omamobile-mmd/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1
0.1.2
6 changes: 5 additions & 1 deletion packages/omamobile-modem-sit/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ pkgdesc="Omarchy Mobile SIT RIL for the Pixel 7 Pro's S5300: LTE registration, I
arch=(aarch64)
url="https://github.com/derekross/omarchy-mobile"
license=(MIT)
depends=(python iproute2 iputils systemd alsa-lib alsa-utils omamobile-modem)
# 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
mobile-broadband-provider-info polkit)
backup=(etc/omamobile/modem-sit.conf)
install=omamobile-modem-sit.install

Expand Down
Loading