Skip to content
Draft
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
48 changes: 48 additions & 0 deletions device/husky/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,54 @@ Sources:
- `P/`: postmarketOS pmaports `device/testing` (2026-10-21).
- `G/`: Google's GPL kernel for this phone, `android-gs-shusky-6.1-android16` ([source.android.com: Build Pixel kernels](https://source.android.com/docs/setup/build/building-pixel-kernels)).

## 2026-11-21: power off with the RTC fix, and upower at a critical battery

Colin's phone, `omamobile` at `d832a9890f63` (`7.3.0-rc6-omamobile-push1-gd832a9890f63`), the
last commit of [linux-omarchy-mobile#262](https://github.com/derekross/linux-omarchy-mobile/pull/262)
and nothing after it: built in WSL, written to slot B with `bin/omamobile flash`, modules
from `bin/omamobile modules-push`. The device tree, `dtbo`, `init_boot` and `vendor_boot`
images are byte for byte the ones of `82f31d3a7`, which the phone ran before. Slot B read 2
tries before each run and was never marked successful; every start from off spent one.

- **The precondition** [V]: the RTC regmap (`firmware:power-management:pmic-1-rtc`) reads
`0x02` `0e` and `0x03` `0f` on `82f31d3a7` (2026-11-20) and again on this kernel after every
start. The bootloader arms WTSR at every start and the kernel clears it only at power off,
so these bytes do not show the fix.
- **Power off by hand, cable out** [V]: `systemctl poweroff` over Wi-Fi at 14:59:50 (MST).
The journal ends at 14:59:56 and `journalctl --list-boots` has no boot until Power was held
at 16:04:20, 1 h 4 min later.
- **Power off by upower, cable out** [V]: a runtime-only upower config in `/run`: the drop-in's
two settings, then a later file with `PercentageLow=99`, `PercentageCritical=98` and
`PercentageAction=97`, so only `CriticalPowerAction=PowerOff` is the drop-in's and its `3`
did not act (`/etc` untouched). The phone was at 100 % and the cable was pulled. The last
read before was 98 % at 17:25:14 and the first after the restart was 97 %; at 17:25:41
logind logged `poweroff requested from client PID … ('upowerd')`, then "The system will
power off now!", and the journal stopped at 17:25:43. The phone was dark and did not answer;
the next boot is at 17:46:38, when Power was held (21 min). `GetCriticalAction` read
`PowerOff` while the config was armed and `Sleep` again after that start.
- **upower reads percentages as whole numbers** [V, source and this unit]: upower 1.91.5's
`up_config_get_double()` (`src/up-config.c`) keeps the value in an `int`. A first run with
99.8, 99.5 and 99.0 read as 99, 99 and 99, which are not descending, so upower reset all
three to 20, 5 and 2 and the warning level stayed `none` at 99 %. With 99, 98 and 97 it read
`low` at 99 %, `critical` at 98 % and acted at 97 %. The drop-in's 3 is a whole number.
- **The package on the phone** [V]: built on the phone from this change with
`tools/phone-install-package` and installed with `pacman -U` (0.1.16 to 0.1.22; the only
other change in that range that installs files is the `omarchy-trace` Plymouth theme, #945
for #266, installed but not the active theme). The drop-in is the committed file byte for
byte, `pacman -Qkk` reports 0 altered files, and `GetCriticalAction` read `Sleep` before and
`PowerOff` after `systemctl restart upower`. The phone was not restarted.
- **upower acts on the battery's own reading** [V for the reading, not tested at 3 %]: the
charger driver is blacklisted, so upower sees only the battery. With the cable in at full
charge the battery read `Discharging` at times, with the current within 7 mA of zero (the
watcher log, 17:04 to 17:09). So on a weak port at 3 % this file could power the phone off
while it is plugged in, as the 7 Pro's would (device/cheetah/SUSPEND-PLAN.md 6.6).
- **Not tested:** a real 3 % (the gauge has no battery model,
[#761](https://github.com/derekross/omarchy-mobile/issues/761), so what 3 % holds in mAh is
not known); this file on a kernel without linux-omarchy-mobile#262 (the restart at 3 % is
expected from #578, not run); power off with the cable in on this unit (Somnius ran it for
linux-omarchy-mobile#262); what plugging in the off phone does (the 7 Pro starts a dark
charging boot for that, `omamobile-charger.target`; husky has none); akita and tegu.

## 2026-11-18: the torch tile and a held volume key, the third phone

Colin's phone, published `omamobile` at `82f31d3a7` (the kernel). The two packages
Expand Down
37 changes: 33 additions & 4 deletions device/husky/SUSPEND-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ after 13 s and pmic-1's interrupt count went from 0 to 1. No sleep was
involved. Interrupt counts at idle on H0: pmic-1 and `rtc-alarm0` 0, the
gauge 10 (no storm). Omarchy's `suspend-off` toggle is set and
`omamobile-sleepd` runs, so the phone doesn't sleep on its own; but
UPower's critical-battery action still does (section 4, 2026-11-13).
UPower's critical-battery action did (section 4, 2026-11-13), until the
power off drop-in (section 4, 2026-11-21).
Inhibitors: NetworkManager, UPower and Omarchy's lock, all `delay`.

## 2. Rules and recovery
Expand Down Expand Up @@ -240,9 +241,11 @@ the whole run.
handshake is tested.
- **Auto sleep** (`omamobile-sleepd` with the toggle on), and anything
unattended: a later plan, after H4 and the hook.
- **UPower's critical action** (section 4, 2026-11-13): whether it should
suspend at all on husky before H4 has passed, as cheetah keeps its
drop-in off.
- **UPower's critical action:** the husky device package powers off at 3 %
(`PercentageAction=3`, `CriticalPowerAction=PowerOff`), as device-cheetah does
since 0.1.55. It needs a kernel with
[linux-omarchy-mobile#262](https://github.com/derekross/linux-omarchy-mobile/pull/262)
(section 4, 2026-11-21). Auto sleep and unattended runs stay a later plan.
- **NFC** with its driver bound across s2idle (#209's note), the modem,
the AoC across sleep, and SYS_SLEEP: separate plans.

Expand Down Expand Up @@ -354,3 +357,29 @@ commented), and the package's
`AllowSuspendThenHibernate=no`. There is no `/etc/systemd/sleep.conf.d/`
directory, so no hand copy hides the package's file (#806). To be read
again once 0.1.14 is installed.

**This unit, 2026-11-21, upower's critical action, and power off.**
Kernel `7.3.0-rc6-omamobile-push1-gd832a9890f63` (`omamobile` at the last
commit of linux-omarchy-mobile#262), `omamobile-device-husky` 0.1.16 for
the runs, then the package built from this change. Eight boots of this
unit end at upower's critical suspend: 2026-11-11 10:19 (`deep`), then
`s2idle` on 11-13 04:25, 11-14 09:49, 11-15 08:53, 11-16 06:07, 11-17
09:00, 11-19 15:44 and 11-21 09:33. In each the journal ends within a
second of `PM: suspend entry`, with no resume line, and the next boot is
a fresh one. The journal does not settle whether the battery ran flat or
the phone hung.
With linux-omarchy-mobile#262 a power off stays off: `systemctl poweroff`
with the cable out, off for 1 h 4 min. A runtime-only upower config (the
drop-in's `CriticalPowerAction=PowerOff`, with the percentages raised to
99, 98 and 97 because the battery read 100 %, so the drop-in's 3 did not
act itself) made upowerd ask logind for the power off, and the phone
stayed off until Power, 21 min later. The journal lines, and the finding
that upower cuts fractional percentages to whole numbers, are in
[NOTES.md, 2026-11-21](NOTES.md#2026-11-21-power-off-with-the-rtc-fix-and-upower-at-a-critical-battery).
With the package built from this change installed, upower's critical
action reads `PowerOff`.
Not tested: a real 3 %; this file on a kernel without
linux-omarchy-mobile#262; power off with the cable in on this unit;
upower at 3 % with the cable in (upower acts on the battery's own
`Discharging` reading, which at full charge with the cable in showed up
at times); what plugging in the off phone does.
2 changes: 1 addition & 1 deletion packages/omamobile-device-husky/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license=(MIT)
depends=(bash systemd omamobile-keyring i2c-tools 'omamobile-audio>=0.5.18')
provides=(omamobile-device)
conflicts=(omamobile-device)
backup=(etc/pacman.d/omamobile-mirrorlist etc/NetworkManager/conf.d/zz-omamobile-wifi-powersave.conf)
backup=(etc/pacman.d/omamobile-mirrorlist etc/NetworkManager/conf.d/zz-omamobile-wifi-powersave.conf etc/UPower/UPower.conf.d/50-omamobile-critical.conf)
install=omamobile-device-husky.install
makedepends=(gcc)

Expand Down
1 change: 1 addition & 0 deletions packages/omamobile-device-husky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Omamobile's first userspace package for the Google Pixel 8 Pro (codename husky,
| `bin/omamobile-bt-addr` + `vendor/systemd/system/omamobile-bt-addr@.service` + `vendor/udev/rules.d/80-omamobile-bt-addr.rules` | `/usr/bin`, `/usr/lib/systemd/system`, `/usr/lib/udev/rules.d` | Gives the BCM4398 its real Bluetooth address from the bootloader's device tree (`/chosen/config/bt_addr`) when the controller appears, powering it on once first, as on the Pixel 9a. The 9a's script, rule and unit with the chip named; the test checks. Without it the controller keeps its placeholder (43:98:D0:..), the same on every 8 Pro. The address is read at run time and never stored in the package. Bluetooth then comes up powered at every boot |
| `charge-limit.conf` + `vendor/udev/rules.d/75-omamobile-charge-limit.rules` + `vendor/systemd/system/omamobile-charge-limit-apply.service` | `/usr/share/omamobile/charge-limit.conf`, `/usr/lib/udev/rules.d`, `/usr/lib/systemd/system` (not enabled) | Declares that this phone has a charge limit on `max77759-charger` (`supply=max77759-charger`). The Settings app's Battery page and its root helper (omamobile-settings) need this file and do nothing without it, so no other phone gets the page whatever its kernel. When the charger appears, udev pulls in the apply unit, which runs the helper without an argument to put the saved `/etc/omamobile/charge-limit` back on the charger; no saved file, nothing is touched. Since 0.1.16. Inert while `omamobile-max77759.conf` blacklists `max77759_charger`: there is no charger power supply, and the Battery row stays hidden |
| `etc/omamobile-mirrorlist` | `/etc/pacman.d/omamobile-mirrorlist` | Where pacman finds the `[omamobile]` repository. Same file as the Pixel 7 Pro package |
| `etc/upower-critical.conf` | `/etc/UPower/UPower.conf.d/50-omamobile-critical.conf` (kept across upgrades, `backup=`) | At a critical battery, power off: `PercentageAction=3`, `CriticalPowerAction=PowerOff`, the Pixel 7 Pro's settings. upower's own default suspends (s2idle), and eight boots of this phone have ended on that suspend with nothing after it ([SUSPEND-PLAN](../../device/husky/SUSPEND-PLAN.md) section 4). upower reads the file when it next starts (the next boot, or `systemctl restart upower`). It needs a kernel with [linux-omarchy-mobile#262](https://github.com/derekross/linux-omarchy-mobile/pull/262) (SMPL and WTSR disarmed at power off): without it the PMIC restarts the phone after a power off ([#578](https://github.com/derekross/omarchy-mobile/issues/578)), and at 3 % that would repeat, one slot B try each time |
| `omamobile-device-husky.install` | pacman hook | Adds `[omamobile]` to `pacman.conf` before `[omarchy]`, once. Same script as the Pixel 7 Pro package |
| `src/reboot-to.c` | `/usr/bin/reboot-to` | Reboot with a reason the bootloader understands. Same bytes as the Pixel 7 Pro package; the test checks |
| `device.conf` | `/usr/share/omamobile/device.conf` | The descriptor, the same bytes as `device/husky/device.conf` |
Expand Down
20 changes: 20 additions & 0 deletions packages/omamobile-device-husky/etc/upower-critical.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: MIT
# Omarchy Mobile (Pixel 8 Pro): at a critical battery, power off.
# upower's default critical action is a suspend. On this phone eight boots
# have ended at upowerd's suspend request and "PM: suspend entry" with nothing
# after it, and the next boot spent a slot B try; whether the battery ran flat
# or the phone hung is not settled (device/husky/SUSPEND-PLAN.md section 4).
# Power off stays off only on a kernel with linux-omarchy-mobile#262, which
# disarms the PMIC's WTSR and SMPL restarts at power off. On an earlier kernel
# the PMIC starts the phone again after a power off (omarchy-mobile#578), and
# at 3 % that would repeat, one slot B try each time: never have this file in
# effect before that kernel.
# upower resets all three percentages to its defaults (20, 5, 2) unless
# PercentageLow > PercentageCritical > PercentageAction, so the action must
# stay under the default critical level (5). upower 1.91.5 also cuts each
# percentage to a whole number (up_config_get_double keeps it in an int), so
# write whole numbers.
# Same settings as device-cheetah 0.1.55 (device/cheetah/SUSPEND-PLAN.md 6.6).
[UPower]
PercentageAction=3
CriticalPowerAction=PowerOff
2 changes: 2 additions & 0 deletions packages/omamobile-device-husky/install
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ install -Dm644 device.conf \
"$destination/usr/share/omamobile/device.conf"
install -Dm644 etc/omamobile-mirrorlist \
"$destination/etc/pacman.d/omamobile-mirrorlist"
install -Dm644 etc/upower-critical.conf \
"$destination/etc/UPower/UPower.conf.d/50-omamobile-critical.conf"
install -Dm644 LICENSE "$destination/usr/share/licenses/omamobile-device-husky/LICENSE"
install -Dm644 version "$destination/usr/share/omamobile/device-husky/version"
23 changes: 23 additions & 0 deletions packages/omamobile-device-husky/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ for f in usr/bin/reboot-to \
usr/lib/systemd/system/omamobile-charge-limit-apply.service \
usr/share/omamobile/device-husky/version \
usr/share/licenses/omamobile-device-husky/LICENSE \
etc/UPower/UPower.conf.d/50-omamobile-critical.conf \
etc/pacman.d/omamobile-mirrorlist; do
[[ -f $tmp/root/$f ]] || fail "install stages $f"
done
Expand Down Expand Up @@ -302,6 +303,28 @@ bash -n bin/omamobile-bt-addr || fail "the Bluetooth address script parses"
grep -q 'chosen/config/bt_addr' bin/omamobile-bt-addr || fail "the Bluetooth address comes from the bootloader's DT"
grep -q 'DRIVERS=="hci_uart_bcm"' vendor/udev/rules.d/80-omamobile-bt-addr.rules || fail "the rule matches the BCM UART controller only"
pass "the Bluetooth address is read at run time, with the 9a's script"
# At a critical battery the phone powers off, at 3 % (the 7 Pro's drop-in,
# device-cheetah 0.1.55, its SUSPEND-PLAN 6.6). upower's default is a suspend,
# which has ended eight boots of this phone (SUSPEND-PLAN section 4). Power
# off holds only on a kernel with linux-omarchy-mobile#262, so this drop-in
# must not reach a phone ahead of that kernel (README, omarchy-mobile#578).
ud="$tmp/root/etc/UPower/UPower.conf.d"
[[ $(find "$ud" -type f | wc -l) -eq 1 ]] || fail "install stages one upower drop-in"
uf=$(find "$ud" -type f)
# upower reads only NN-name.conf from UPower.conf.d (NN two digits).
[[ ${uf##*/} =~ ^[0-9][0-9]-[a-zA-Z0-9_-]*\.conf$ ]] || fail "upower ignores a drop-in whose name isn't NN-name.conf"
# Exactly these settings. upower resets all three percentages to its defaults
# (20, 5, 2) unless Low > Critical > Action, so an action above the default
# critical level (5) would silently bring back the suspend at 2 %.
[[ $(grep -vE '^[[:space:]]*(#|$)' "$uf") == $'[UPower]\nPercentageAction=3\nCriticalPowerAction=PowerOff' ]] \
|| fail "the upower drop-in powers off at 3 %"
grep -qx 'backup=(etc/pacman.d/omamobile-mirrorlist etc/NetworkManager/conf.d/zz-omamobile-wifi-powersave.conf etc/UPower/UPower.conf.d/50-omamobile-critical.conf)' PKGBUILD \
|| fail "pacman keeps a changed upower drop-in (backup=)"
if [[ -f ../omamobile-device-cheetah/etc/upower-critical.conf ]]; then
[[ $(grep -vE '^[[:space:]]*(#|$)' etc/upower-critical.conf) == "$(grep -vE '^[[:space:]]*(#|$)' ../omamobile-device-cheetah/etc/upower-critical.conf)" ]] \
|| fail "the upower drop-in's settings drifted from the 7 Pro's"
fi
pass "at a critical battery the phone powers off (upower drop-in, the 7 Pro's settings)"
ps="$tmp/root/etc/NetworkManager/conf.d/zz-omamobile-wifi-powersave.conf"
grep -qx '\[connection\]' "$ps" || fail "the Wi-Fi power save file needs a [connection] header"
grep -qx 'wifi.powersave=3' "$ps" || fail "Wi-Fi power save is on by default (3 = enable)"
Expand Down
2 changes: 1 addition & 1 deletion packages/omamobile-device-husky/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.21
0.1.22