Skip to content

omamobile-modem-sit 0.3.37: the cellular default route steps aside for a system sleep - #750

Closed
W4HO-ham wants to merge 1 commit into
derekross:mainfrom
W4HO-ham:sit-data-sleep-route
Closed

W4HO-ham wants to merge 1 commit into
derekross:mainfrom
W4HO-ham:sit-data-sleep-route

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Option A from my note on #556, written and run on a Pixel 9a. Draft: it only matters once a phone can sleep with the modem up (kernel #232), so it should wait for that, and you may want it folded into #556 instead. The version number moves at merge (#697 and #556 both name 0.3.37 too).

What

With the modem up and Wi-Fi connected, every system sleep on the 9a was refused. At logind's announcement NetworkManager takes Wi-Fi down; the bearer's metric-700 default route is then the only one; whatever was talking over Wi-Fi sends through the bearer in the same second; and the modem's link is up when #232's notifier looks.

omamobile-sit-data owns that route, so it now steps aside for a sleep:

  • it listens for logind's PrepareForSleep through a busctl monitor child (systemd is already a dependency; without busctl nothing changes);
  • on "sleep starting" it removes its default route (the bearer's address stays, so the device is still the bearer's);
  • on "sleep over" the route waits for another default route to be back, or ten seconds without one, and then returns. Put back at once, it carried a few seconds of traffic at every wake, and the answers to that ended the following sleeps early;
  • a route that wasn't there at the announcement (a silent bearer, roaming with data roaming off) is not brought back.

The logic is in a small class, SleepHold, with unit tests; the loop only asks it what to do.

Tested

packages/omamobile-modem-sit/test/all and tools/pr-check: pass. New unit tests for the announcement parser and for SleepHold (the route goes at the announcement, waits for Wi-Fi after, returns alone after the grace, is not invented, survives a second sleep during the wait, and roaming ends it).

On my palmtop (Pixel 9a), 2026-11-13, a test kernel with kernel #232, the maintainer's 6.1 and 6.2 patches from its review and sleep_guard on for zumapro (7.3.0-rc6-omamobile-push1-gc50fd8fdf42a); LTE with IMS registered, Wi-Fi connected, the data service running, the owner's VPN daemon as the talker; RTC sleeps of 60 s requested with systemctl suspend -i, the modem told "screen off" by hand before each:

omamobile-sit-data requests entered ran to the alarm
as on main 14 0
stopped, for comparison 23 22 19
route away, back at once after the sleep (first try) 20 18 0
route away, back after Wi-Fi (this change, as first written) 20 20 11
this change as it is here, with SleepHold 12 11 7

After every series the phone service answered and ping -I rmnet0 got 5 of 5, except the last, which ended in a watchdog reset 20 s after its twelfth sleep had ended; that hang is in the kernel's link power-up, awake, and is reported on kernel #232. In the fourth series sit-data logged "The cellular default route is back behind Wi-Fi" 20 of 20 times and "Default internet path cellular" not once.

The file that ran was this change applied on top of #697's data_network.py (the palmtop runs #697's build), not this branch's file byte for byte; the packaged file was put back afterwards.

Not tested

  • A phone other than the 9a, and the 7 Pro's omamobile-modem-sit 0.3.37, omamobile-modem 0.1.25, device-cheetah 0.1.56: suspend with the modem online (M6) #556 with follow_screen.
  • A lost race: NetworkManager and sit-data hear the announcement together, and if Wi-Fi's route goes first the bearer carries traffic for a moment. I didn't see a refusal I could pin on that in 52 requests (3 were refused in all), but nothing guarantees the order.
  • Roaming, and a phone with no Wi-Fi at all (there the route is the only way out, comes back after ten seconds awake, and the sleeps would be ended by whatever arrives for the phone, as they should).

…r a system sleep

With the modem up and Wi-Fi connected, a system sleep was refused every time on the Pixel 9a: NetworkManager takes Wi-Fi down at logind's announcement, the bearer's metric-700 default route is then the only one, whatever was talking over Wi-Fi sends through the bearer at once, and the modem's link is up when the kernel looks (linux-omarchy-mobile#232's sleep guard).

omamobile-sit-data now listens for logind's PrepareForSleep (a busctl monitor, no new dependency) and takes its default route away when a sleep is announced; the bearer's address stays. After the sleep the route waits for another default route to be back, or ten seconds without one: put back at once it carried a few seconds of traffic at every wake, and the answers ended the next sleeps early. A route that wasn't there (a silent bearer, roaming) is not brought back, and without busctl nothing changes.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

An overnight run with this change in place on the 9a (2026-11-13 to 11-14, one boot, the test kernel with linux-omarchy-mobile#232 and the sleep guard on for zumapro; the service's file is this branch's logic applied on #697's version). Wi-Fi connected and LTE registered throughout; the owner was not at the palmtop and told me to run it without him.

  • 300 sleep requests of 60 s: 299 entered, 1 refused (the link was up at the request). On main the same evening's count was 0 of 14, every request refused.
  • The service logged the announcement 300 times and "The cellular default route is back behind Wi-Fi" 300 times, never "as the only way out": Wi-Fi came back within the 10 s every time. Before each of the 300 requests the default routes read Wi-Fi first with the cellular one behind it.
  • After every sleep: the modem ONLINE, no failed poll in sitd, Wi-Fi up. At the end ping -I rmnet0 got 5 of 5, and IMS voice was still registered.
  • Two "Network check failed, retrying: TimeoutExpired" lines in the 7 h 40 min, each followed by "Network checks work again"; nothing else from the service.

The kernel side of the count is on linux-omarchy-mobile#232.

@ikegam

ikegam commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Thanks for this! I took it into #556 as is (6eddef2), with an A/B from my 7 Pro there: 0/5 → 5/5 sleeps with traffic on the default route.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thanks, @ikegam, and for the A/B on the 7 Pro. Closing this so there is one thing to review: the change lives in #556 now (6eddef2). I'm running #556's head on the 9a at the moment and will put the result there.

@W4HO-ham W4HO-ham closed this Nov 14, 2026
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 14, 2026
… nothing by hand (2026-11-14)

30 of 30 requests entered with omarchy-mobile#556's phone-service package and follow_screen on: sitd told the modem the screen state itself, the sleep hook ran each time, and the route change that was derekross#750 is part of derekross#556 now.
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