From 7a3ddd2ac2f7d12b910c201daca569de95402ce0 Mon Sep 17 00:00:00 2001 From: Lef Date: Wed, 18 Nov 2026 19:26:18 +0200 Subject: [PATCH 1/2] omamobile-device-husky 0.1.18: the charger's policy and sleep on the cable, inert Ships the charger's two option lines from the Pixel 7 Pro and the Pixel 7 (omarchy-mobile#827): default_ilim_ua=500000 temp_guard=1, with the gauge loaded first. The charger stays blacklisted in omamobile-max77759.conf, so on the published kernel the lines only apply to a modprobe by hand. Also a sleep blocker for the cable: a block inhibitor while max77759-charger is online, since the temperature guard is delayed work that s2idle stops. udev starts it when the charger's power supply appears; it is not enabled at boot, so with the charger blacklisted it never runs. Tested: package test/all, including the blocker against a fake sysfs file and a stub systemd-inhibit; the test fails without the charger or tcpci_maxim blacklist, without temp_guard, without the softdep, or with a second options line. Not tested: anything on a phone. The version is a placeholder for the maintainer to set. --- packages/omamobile-device-husky/README.md | 6 +- .../bin/omamobile-plugged-inhibit | 23 +++++++ packages/omamobile-device-husky/install | 9 +++ packages/omamobile-device-husky/test/all | 60 +++++++++++++++++++ .../vendor/modprobe.d/omamobile-charger.conf | 13 ++++ .../vendor/modprobe.d/omamobile-max77759.conf | 1 + .../system/omamobile-plugged-inhibit.service | 10 ++++ .../udev/rules.d/80-omamobile-charger.rules | 5 ++ packages/omamobile-device-husky/version | 2 +- 9 files changed, 126 insertions(+), 3 deletions(-) create mode 100755 packages/omamobile-device-husky/bin/omamobile-plugged-inhibit create mode 100644 packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf create mode 100644 packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service create mode 100644 packages/omamobile-device-husky/vendor/udev/rules.d/80-omamobile-charger.rules diff --git a/packages/omamobile-device-husky/README.md b/packages/omamobile-device-husky/README.md index 645ef820b..cb2e9c151 100644 --- a/packages/omamobile-device-husky/README.md +++ b/packages/omamobile-device-husky/README.md @@ -1,6 +1,6 @@ # omamobile-device-husky -Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename husky, Tensor G3 / zuma). Like the Pixel Fold's, it hides the Android partitions from desktop tools, holds the USB address, and gives pacman the same `[omamobile]` repository as the Pixel 7 Pro. It does not drive the radio, the charger, or a camera, and it does not mark a boot slot successful. +Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename husky, Tensor G3 / zuma). Like the Pixel Fold's, it hides the Android partitions from desktop tools, holds the USB address, and gives pacman the same `[omamobile]` repository as the Pixel 7 Pro. It ships the charger's policy, which stays blacklisted until the kernel work lands, does not drive the radio or a camera, and does not mark a boot slot successful. | Path | Installs to | What it does | | --- | --- | --- | @@ -16,6 +16,8 @@ Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename hu | `bin/omamobile-usb-rescue` + `vendor/systemd/system/omamobile-usb-rescue.service` | `/usr/bin`, `/usr/lib/systemd/system` (enabled by a vendor wants link) | Keeps the USB link across an unplug. The MAX77759's Type-C side opens its USB2 data switch (TCPC 0x25, register 0x93) on unplug and, with no Type-C driver, nothing closes it again until the bootloader runs: the phone stays off the bus after a replug. While VBUS is valid the script writes 0x09 back (the only register it writes) and logs every change of the switch, VBUS and the UDC state to the journal. It stands aside once a Type-C driver owns 0x25. It needs the hsi2c_11 bus (kernel #163, enabled by a bring-up overlay): without it the script says so and exits. Tested on a Pixel 8 Pro: unplug, replug, the link was back in two seconds with no reboot. Same logic as the Pixel 7 Pro's, on husky's bus | | `bin/omamobile-husky-aoc-start` + `vendor/systemd/system/omamobile-husky-aoc.service` + `vendor/modprobe.d/omamobile-husky-aoc.conf` | `/usr/bin`, `/usr/lib/systemd/system` (enabled by a vendor wants link), `/usr/lib/modprobe.d` | Starts the AoC audio DSP and the two speaker amplifiers, hang-safe, as the Pixel 7 Pro's `omamobile-aoc-start` does: Trusty, the GSA mailbox, the AoC System MMU, mailbox and core with the firmware load off, the service front ends, the sound card's driver and the CS35L41 amplifiers, then the `aoc.bin` firmware load and a wait for the card. A marker is written and synced before any of it and a start that never returns leaves it behind, so the next boot leaves the AoC off until `omamobile-husky-aoc-start --retry`. The unit is skipped by its condition on a kernel without the AoC node (154b0000.aoc). The modprobe file only blacklists the stack so nothing else loads it out of order; no `speaker_protection` option, the card driver's analog ceiling stays at 10. `aoc.bin` comes from the phone's own vendor partition, never from this package. The kernel side is not merged yet (the Trusty, GSA, AoC and sound card drivers are on the maintainer's list), so today this does nothing on the published kernel | | `vendor/modprobe.d/omamobile-max77759.conf` | `/usr/lib/modprobe.d` | Keeps max77759_charger, gpio_max77759, nvmem_max77759 and tcpci_maxim from autoloading: binding the PMIC creates the charger cell, which programs charge limits from the battery node. Blacklist only, so a runbook can still load them by hand. The fuel gauge and the MFD core are not blacklisted | +| `vendor/modprobe.d/omamobile-charger.conf` | `/usr/lib/modprobe.d` | The charger's policy, the same two lines as the Pixel 7 Pro and the Pixel 7 (#827): a 500 mA input without a Type-C source (`default_ilim_ua`; without it the upstream driver turns charging off at probe) and stock's temperature bands from the gauge (`temp_guard`), the gauge loading first. Inert for now: the MAX77759 file still blacklists the charger, so these apply only when a runbook loads it by hand | +| `bin/omamobile-plugged-inhibit` + `vendor/systemd/system/omamobile-plugged-inhibit.service` + `vendor/udev/rules.d/80-omamobile-charger.rules` | `/usr/bin`, `/usr/lib/systemd/system`, `/usr/lib/udev/rules.d` | Sleep on the cable: holds a logind sleep block while `max77759-charger` is online, since the temperature guard is delayed work that s2idle stops while the chip goes on charging. The udev rule starts it when the charger's power supply appears; it is not enabled at boot, so with the charger blacklisted it never runs. It exits when the charger goes away. Not covered: a cable plugged in while the phone is already asleep, and a suspend within about a second of plug-in (1 s polling) | | `vendor/systemd/system/plymouth-quit.service.d/10-omamobile-retain-splash.conf` | `/usr/lib/systemd/system/plymouth-quit.service.d` | Makes `plymouth quit` keep its last frame on screen (`--retain-splash`) until Hyprland draws, instead of a black screen. The same three unit lines as cheetah and raven (the comments differ): gs-decon has no fbdev console to hand back, and on raven a plain quit hung for 27 s and held the session back. It only does anything with `splash` on the kernel command line, which husky's descriptor gets from #278; without it Plymouth never runs and the drop-in is inert. Booted from the package on a Pixel 8 Pro (2026-11-02, kernel 7.3.0-rc6-omamobile-push1-g5899fec2bd28): Plymouth started at 3.30 s and its quit, with --retain-splash, finished at 4.94 s without a hang | | `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 | @@ -26,7 +28,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename hu `./build [DIR]` compiles `reboot-to` from this directory, `./install DESTDIR [DIR]` stages the files, and `test/all` checks the copies when it is run from the repository. -Not in this package: the boot-success marker, the charger, cameras, and the slot-B image hook. Those stay out until each one has its own runbook. There is no lid drop-in: husky has no hinge. +Not in this package: the boot-success marker, loading the charger at boot (its options ship, it stays blacklisted until the kernel work lands), cameras, and the slot-B image hook. Those stay out until each one has its own runbook. There is no lid drop-in: husky has no hinge. ## Firmware the phone needs diff --git a/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit b/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit new file mode 100755 index 000000000..065665053 --- /dev/null +++ b/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit @@ -0,0 +1,23 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Hold a logind sleep inhibitor (block) while max77759-charger is online. +# The charger's temperature guard is delayed work: s2idle stops it while the +# chip goes on charging, so the phone must not sleep on the cable. +# udev starts this when the charger's power supply appears +# (80-omamobile-charger.rules); with the charger blacklisted it never +# appears, and this never runs. It exits when the charger goes away. +# Limits: a cable plugged in while already asleep is not covered (nothing +# wakes the phone), and polling is 1 s, so a suspend within about a second +# of plug-in can get through. +C=${OMAMOBILE_CHARGER_ONLINE:-/sys/class/power_supply/max77759-charger/online} +while [ -r "$C" ]; do + if [ "$(cat "$C" 2>/dev/null)" = 1 ]; then + # the lock lives exactly as long as the cable is in + systemd-inhibit --what=sleep --mode=block --who=omamobile-charger \ + --why="charging: the charge guard does not run during sleep" \ + sh -c 'while [ "$(cat "$1" 2>/dev/null)" = 1 ]; do sleep 1; done' _ "$C" \ + || { echo "omamobile-plugged-inhibit: systemd-inhibit failed, sleep is not blocked" >&2; exit 1; } + fi + sleep 1 +done +echo "omamobile-plugged-inhibit: $C is gone, stopping" >&2 diff --git a/packages/omamobile-device-husky/install b/packages/omamobile-device-husky/install index 790758918..9ad06edff 100755 --- a/packages/omamobile-device-husky/install +++ b/packages/omamobile-device-husky/install @@ -36,6 +36,15 @@ ln -sfn ../omamobile-husky-display.service \ "$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-husky-display.service" install -Dm644 vendor/modprobe.d/omamobile-max77759.conf \ "$destination/usr/lib/modprobe.d/omamobile-max77759.conf" +# The charger's policy and its sleep blocker; inert while the charger is +# blacklisted: the rule starts the blocker only when the charger binds. +install -Dm644 vendor/modprobe.d/omamobile-charger.conf \ + "$destination/usr/lib/modprobe.d/omamobile-charger.conf" +install -Dm755 bin/omamobile-plugged-inhibit "$destination/usr/bin/omamobile-plugged-inhibit" +install -Dm644 vendor/systemd/system/omamobile-plugged-inhibit.service \ + "$destination/usr/lib/systemd/system/omamobile-plugged-inhibit.service" +install -Dm644 vendor/udev/rules.d/80-omamobile-charger.rules \ + "$destination/usr/lib/udev/rules.d/80-omamobile-charger.rules" install -Dm755 bin/omamobile-usb-rescue "$destination/usr/bin/omamobile-usb-rescue" install -Dm644 vendor/systemd/system/omamobile-usb-rescue.service \ "$destination/usr/lib/systemd/system/omamobile-usb-rescue.service" diff --git a/packages/omamobile-device-husky/test/all b/packages/omamobile-device-husky/test/all index 1760d8b79..020a90f39 100755 --- a/packages/omamobile-device-husky/test/all +++ b/packages/omamobile-device-husky/test/all @@ -80,6 +80,9 @@ for f in usr/bin/reboot-to \ usr/lib/systemd/system/omamobile-husky-display.service \ usr/lib/systemd/system/display-manager.service.d/10-omamobile-husky.conf \ usr/lib/modprobe.d/omamobile-max77759.conf \ + usr/lib/modprobe.d/omamobile-charger.conf \ + usr/bin/omamobile-plugged-inhibit usr/lib/systemd/system/omamobile-plugged-inhibit.service \ + usr/lib/udev/rules.d/80-omamobile-charger.rules \ usr/bin/omamobile-usb-rescue \ usr/lib/systemd/system/omamobile-usb-rescue.service \ usr/lib/systemd/system/plymouth-quit.service.d/10-omamobile-retain-splash.conf \ @@ -144,6 +147,63 @@ for m in max77759_charger tcpci_maxim gpio_max77759 nvmem_max77759; do done ! grep -qE '^blacklist (max17042_battery|max77759)$' "$conf" || fail "the fuel gauge and the MFD core keep autoloading" pass "the MAX77759 cell drivers and the Type-C driver are blacklisted, the gauge and the MFD core are not" +# The charger's policy, as on the Pixel 7 Pro and the Pixel 7 (#827): both +# options on one line, the gauge first. Inert: the charger stays blacklisted +# above, so the lines only apply to a modprobe by hand. +mod=$tmp/root/usr/lib/modprobe.d +grep -qx 'options max77759_charger default_ilim_ua=500000 temp_guard=1' "$mod/omamobile-charger.conf" \ + || fail "the charger charges without a Type-C source, under the temperature guard" +grep -qx 'softdep max77759_charger pre: max17042_battery' "$mod/omamobile-charger.conf" \ + || fail "the gauge loads before the charger, for the guard's first reading" +(( $(grep -h '^options max77759_charger' "$mod"/*.conf | wc -l) == 1 )) \ + || fail "one charger options line only" +grep -qx 'blacklist max77759_charger' "$mod/omamobile-max77759.conf" || fail "the charger stays blacklisted until the kernel side is in" +pass "the charger's options and softdep are set, and it stays blacklisted (inert)" +# Sleep on the cable: the blocker starts only when the charger binds, holds +# a block inhibitor while it is online, and is not enabled at boot. +rule=$tmp/root/usr/lib/udev/rules.d/80-omamobile-charger.rules +grep -qx 'ACTION=="add", SUBSYSTEM=="power_supply", KERNEL=="max77759-charger", TAG+="systemd", ENV{SYSTEMD_WANTS}+="omamobile-plugged-inhibit.service"' "$rule" \ + || fail "the sleep blocker starts when the charger's power supply appears" +[[ ! -e $tmp/root/usr/lib/systemd/system/multi-user.target.wants/omamobile-plugged-inhibit.service ]] \ + || fail "the sleep blocker is not enabled at boot: it would run with no charger" +sh -n bin/omamobile-plugged-inhibit || fail "the sleep blocker parses" +grep -q '^ExecStart=/usr/bin/omamobile-plugged-inhibit$' vendor/systemd/system/omamobile-plugged-inhibit.service \ + || fail "the blocker unit starts the script" +stub=$tmp/stub; mkdir -p "$stub" +# a stub systemd-inhibit: records its options and pid, then runs the child +cat > "$stub/systemd-inhibit" <> "$stub/calls"; echo \$\$ > "$stub/child" +while [ "\${1#--}" != "\$1" ]; do shift; done +exec "\$@" +STUB +chmod +x "$stub/systemd-inhibit" +run_blocker() { PATH=$stub:$PATH OMAMOBILE_CHARGER_ONLINE=$tmp/online sh bin/omamobile-plugged-inhibit 2>/dev/null & ipid=$!; } +gone() { for _ in $(seq 10); do kill -0 "$1" 2>/dev/null || return 0; sleep 0.3; done; return 1; } +# no charger: exits at once and blocks nothing +PATH=$stub:$PATH OMAMOBILE_CHARGER_ONLINE=$tmp/no-such-file timeout 5 sh bin/omamobile-plugged-inhibit 2>/dev/null \ + || fail "the blocker exits by itself when there is no charger" +[[ ! -e $stub/calls ]] || fail "the blocker holds nothing without a charger" +# online 0 at start: no lock; the charger going away stops it +echo 0 > "$tmp/online"; run_blocker; sleep 2 +[[ ! -e $stub/calls ]] || fail "the blocker takes no lock while the charger is offline" +rm -f "$tmp/online"; gone "$ipid" || { kill "$ipid"; fail "the blocker stops when the charger goes away"; } +wait "$ipid" 2>/dev/null || : +# online 1: the lock is held while the file says 1, released when it says 0 +echo 1 > "$tmp/online"; run_blocker +for _ in $(seq 20); do [[ -s $stub/child ]] && break; sleep 0.2; done +child=$(cat "$stub/child" 2>/dev/null); sleep 2 +[[ -n $child ]] && kill -0 "$child" 2>/dev/null || { kill "$ipid"; fail "the blocker holds the lock while charging"; } +echo 0 > "$tmp/online" +gone "$child" || { kill "$ipid" "$child"; fail "the lock is released when charging stops"; } +rm -f "$tmp/online"; gone "$ipid" || { kill "$ipid"; fail "the blocker stops when the charger goes away"; } +wait "$ipid" 2>/dev/null || : +grep -q -- '--what=sleep --mode=block --who=omamobile-charger' "$stub/calls" || fail "the blocker holds a sleep block while charging" +(( $(wc -l < "$stub/calls") == 1 )) || fail "one lock per plug-in" +unit=vendor/systemd/system/omamobile-plugged-inhibit.service +grep -qx 'StartLimitIntervalSec=0' "$unit" && grep -qx 'RestartSec=5' "$unit" \ + || fail "the blocker unit never hits the start limit and stays failed" +pass "the sleep blocker starts with the charger, blocks sleep while it is online, and does nothing without it" bash -n bin/omamobile-usb-rescue || fail "the USB rescue parses" grep -q '10cb0000.i2c' bin/omamobile-usb-rescue || fail "the USB rescue watches husky's bus (hsi2c_11)" grep -q 'i2cset -f -y "$bus" $tcpc 0x93 0x09' bin/omamobile-usb-rescue || fail "the USB rescue closes the data switch" diff --git a/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf new file mode 100644 index 000000000..16f722650 --- /dev/null +++ b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: MIT +# Charging policy for max77759_charger, the Pixel 7 Pro's and the Pixel 7's +# two lines. Inert for now: omamobile-max77759.conf still blacklists the +# charger, so these apply only to a modprobe by hand (a runbook step), never +# at boot. Both options belong together: +# - default_ilim_ua: without a Type-C source (tcpci_maxim stays blacklisted) +# the upstream driver turns charging off at probe; this keeps it on at a +# 500 mA input limit instead; +# - temp_guard: stock's step-charging bands from the gauge's temperature +# and voltage, every 30 s; no reading or out of range stops charging. +# The gauge loads first, so the guard's first reading succeeds. +options max77759_charger default_ilim_ua=500000 temp_guard=1 +softdep max77759_charger pre: max17042_battery diff --git a/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-max77759.conf b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-max77759.conf index bc887b273..eb576ba1f 100644 --- a/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-max77759.conf +++ b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-max77759.conf @@ -4,6 +4,7 @@ # GPIO and NVMEM cells, and the charger driver programs the charge limits from # the battery node, so none of the cell drivers may load on their own yet. # The fuel gauge (max17042_battery) and the MFD core (max77759) still autoload. +# A charger loaded by hand gets its policy from omamobile-charger.conf. # tcpci_maxim would take over the USB-C port we use for SSH: it waits for the # Type-C step. blacklist max77759_charger diff --git a/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service b/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service new file mode 100644 index 000000000..4e837a253 --- /dev/null +++ b/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service @@ -0,0 +1,10 @@ +[Unit] +Description=Block sleep while charging (the charge guard pauses in s2idle) +Wants=systemd-logind.service +After=systemd-logind.service +StartLimitIntervalSec=0 + +[Service] +ExecStart=/usr/bin/omamobile-plugged-inhibit +Restart=on-failure +RestartSec=5 diff --git a/packages/omamobile-device-husky/vendor/udev/rules.d/80-omamobile-charger.rules b/packages/omamobile-device-husky/vendor/udev/rules.d/80-omamobile-charger.rules new file mode 100644 index 000000000..ed2655a4c --- /dev/null +++ b/packages/omamobile-device-husky/vendor/udev/rules.d/80-omamobile-charger.rules @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile: block sleep while the MAX77759 charger is online +# (omamobile-plugged-inhibit.service). Only when the charger driver binds, +# so nothing runs while omamobile-max77759.conf blacklists it. +ACTION=="add", SUBSYSTEM=="power_supply", KERNEL=="max77759-charger", TAG+="systemd", ENV{SYSTEMD_WANTS}+="omamobile-plugged-inhibit.service" diff --git a/packages/omamobile-device-husky/version b/packages/omamobile-device-husky/version index e8e277f2f..f8bc4c625 100644 --- a/packages/omamobile-device-husky/version +++ b/packages/omamobile-device-husky/version @@ -1 +1 @@ -0.1.16 +0.1.18 From 8fd7a0551412fdbf890c3e05a31d9361219f5e4e Mon Sep 17 00:00:00 2001 From: Lef Date: Wed, 18 Nov 2026 20:38:56 +0200 Subject: [PATCH 2/2] omamobile-device-husky: the sleep blocker holds on a failed read, and the charger's husky limits The lock goes only on a 0 or when the online file is gone; an empty or failed read keeps holding, and test/all checks both. The charger's modprobe file and the README say what a load by hand gets on husky today (the gs201 table, a 22.0 C temperature, the node's 4.20 V) and what lifts each. SPDX line on the new unit, and 10 s waits in the test. --- packages/omamobile-device-husky/README.md | 4 ++-- .../bin/omamobile-plugged-inhibit | 5 +++-- packages/omamobile-device-husky/test/all | 10 ++++++++-- .../vendor/modprobe.d/omamobile-charger.conf | 8 ++++++++ .../systemd/system/omamobile-plugged-inhibit.service | 1 + 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/omamobile-device-husky/README.md b/packages/omamobile-device-husky/README.md index cb2e9c151..3271e3a00 100644 --- a/packages/omamobile-device-husky/README.md +++ b/packages/omamobile-device-husky/README.md @@ -16,8 +16,8 @@ Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename hu | `bin/omamobile-usb-rescue` + `vendor/systemd/system/omamobile-usb-rescue.service` | `/usr/bin`, `/usr/lib/systemd/system` (enabled by a vendor wants link) | Keeps the USB link across an unplug. The MAX77759's Type-C side opens its USB2 data switch (TCPC 0x25, register 0x93) on unplug and, with no Type-C driver, nothing closes it again until the bootloader runs: the phone stays off the bus after a replug. While VBUS is valid the script writes 0x09 back (the only register it writes) and logs every change of the switch, VBUS and the UDC state to the journal. It stands aside once a Type-C driver owns 0x25. It needs the hsi2c_11 bus (kernel #163, enabled by a bring-up overlay): without it the script says so and exits. Tested on a Pixel 8 Pro: unplug, replug, the link was back in two seconds with no reboot. Same logic as the Pixel 7 Pro's, on husky's bus | | `bin/omamobile-husky-aoc-start` + `vendor/systemd/system/omamobile-husky-aoc.service` + `vendor/modprobe.d/omamobile-husky-aoc.conf` | `/usr/bin`, `/usr/lib/systemd/system` (enabled by a vendor wants link), `/usr/lib/modprobe.d` | Starts the AoC audio DSP and the two speaker amplifiers, hang-safe, as the Pixel 7 Pro's `omamobile-aoc-start` does: Trusty, the GSA mailbox, the AoC System MMU, mailbox and core with the firmware load off, the service front ends, the sound card's driver and the CS35L41 amplifiers, then the `aoc.bin` firmware load and a wait for the card. A marker is written and synced before any of it and a start that never returns leaves it behind, so the next boot leaves the AoC off until `omamobile-husky-aoc-start --retry`. The unit is skipped by its condition on a kernel without the AoC node (154b0000.aoc). The modprobe file only blacklists the stack so nothing else loads it out of order; no `speaker_protection` option, the card driver's analog ceiling stays at 10. `aoc.bin` comes from the phone's own vendor partition, never from this package. The kernel side is not merged yet (the Trusty, GSA, AoC and sound card drivers are on the maintainer's list), so today this does nothing on the published kernel | | `vendor/modprobe.d/omamobile-max77759.conf` | `/usr/lib/modprobe.d` | Keeps max77759_charger, gpio_max77759, nvmem_max77759 and tcpci_maxim from autoloading: binding the PMIC creates the charger cell, which programs charge limits from the battery node. Blacklist only, so a runbook can still load them by hand. The fuel gauge and the MFD core are not blacklisted | -| `vendor/modprobe.d/omamobile-charger.conf` | `/usr/lib/modprobe.d` | The charger's policy, the same two lines as the Pixel 7 Pro and the Pixel 7 (#827): a 500 mA input without a Type-C source (`default_ilim_ua`; without it the upstream driver turns charging off at probe) and stock's temperature bands from the gauge (`temp_guard`), the gauge loading first. Inert for now: the MAX77759 file still blacklists the charger, so these apply only when a runbook loads it by hand | -| `bin/omamobile-plugged-inhibit` + `vendor/systemd/system/omamobile-plugged-inhibit.service` + `vendor/udev/rules.d/80-omamobile-charger.rules` | `/usr/bin`, `/usr/lib/systemd/system`, `/usr/lib/udev/rules.d` | Sleep on the cable: holds a logind sleep block while `max77759-charger` is online, since the temperature guard is delayed work that s2idle stops while the chip goes on charging. The udev rule starts it when the charger's power supply appears; it is not enabled at boot, so with the charger blacklisted it never runs. It exits when the charger goes away. Not covered: a cable plugged in while the phone is already asleep, and a suspend within about a second of plug-in (1 s polling) | +| `vendor/modprobe.d/omamobile-charger.conf` | `/usr/lib/modprobe.d` | The charger's policy, the same two lines as the Pixel 7 Pro and the Pixel 7 (#827): a 500 mA input without a Type-C source (`default_ilim_ua`; without it the upstream driver turns charging off at probe) and stock's temperature bands from the gauge (`temp_guard`), the gauge loading first. Inert for now: the MAX77759 file still blacklists the charger, so these apply only when a runbook loads it by hand. On husky with a published kernel such a load gets the gs201 phones' table (until linux-omarchy-mobile#265), a temperature that reads 22.0 C whatever the cell does (until the gauge fix), and the battery node's 4.20 V, where the charge ends near 82 % (until the float is raised, limits on #761) | +| `bin/omamobile-plugged-inhibit` + `vendor/systemd/system/omamobile-plugged-inhibit.service` + `vendor/udev/rules.d/80-omamobile-charger.rules` | `/usr/bin`, `/usr/lib/systemd/system`, `/usr/lib/udev/rules.d` | Sleep on the cable: holds a logind sleep block while `max77759-charger` is online, since the temperature guard is delayed work that s2idle stops while the chip goes on charging. The udev rule starts it when the charger's power supply appears; it is not enabled at boot, so with the charger blacklisted it never runs. It exits when the charger goes away. Once held, the lock goes only on a `0` or when the file is gone; an empty or failed read keeps holding. Not covered: a cable plugged in while the phone is already asleep, and a suspend within about a second of plug-in (1 s polling) | | `vendor/systemd/system/plymouth-quit.service.d/10-omamobile-retain-splash.conf` | `/usr/lib/systemd/system/plymouth-quit.service.d` | Makes `plymouth quit` keep its last frame on screen (`--retain-splash`) until Hyprland draws, instead of a black screen. The same three unit lines as cheetah and raven (the comments differ): gs-decon has no fbdev console to hand back, and on raven a plain quit hung for 27 s and held the session back. It only does anything with `splash` on the kernel command line, which husky's descriptor gets from #278; without it Plymouth never runs and the drop-in is inert. Booted from the package on a Pixel 8 Pro (2026-11-02, kernel 7.3.0-rc6-omamobile-push1-g5899fec2bd28): Plymouth started at 3.30 s and its quit, with --retain-splash, finished at 4.94 s without a hang | | `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 | diff --git a/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit b/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit index 065665053..8ff20b6c4 100755 --- a/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit +++ b/packages/omamobile-device-husky/bin/omamobile-plugged-inhibit @@ -8,14 +8,15 @@ # appears, and this never runs. It exits when the charger goes away. # Limits: a cable plugged in while already asleep is not covered (nothing # wakes the phone), and polling is 1 s, so a suspend within about a second -# of plug-in can get through. +# of plug-in can get through. Once held, the lock goes only on a 0 or when +# the file is gone: an empty or failed read (an I2C error) keeps holding. C=${OMAMOBILE_CHARGER_ONLINE:-/sys/class/power_supply/max77759-charger/online} while [ -r "$C" ]; do if [ "$(cat "$C" 2>/dev/null)" = 1 ]; then # the lock lives exactly as long as the cable is in systemd-inhibit --what=sleep --mode=block --who=omamobile-charger \ --why="charging: the charge guard does not run during sleep" \ - sh -c 'while [ "$(cat "$1" 2>/dev/null)" = 1 ]; do sleep 1; done' _ "$C" \ + sh -c 'while [ -e "$1" ] && [ "$(cat "$1" 2>/dev/null)" != 0 ]; do sleep 1; done' _ "$C" \ || { echo "omamobile-plugged-inhibit: systemd-inhibit failed, sleep is not blocked" >&2; exit 1; } fi sleep 1 diff --git a/packages/omamobile-device-husky/test/all b/packages/omamobile-device-husky/test/all index 020a90f39..49f5f6366 100755 --- a/packages/omamobile-device-husky/test/all +++ b/packages/omamobile-device-husky/test/all @@ -179,7 +179,7 @@ exec "\$@" STUB chmod +x "$stub/systemd-inhibit" run_blocker() { PATH=$stub:$PATH OMAMOBILE_CHARGER_ONLINE=$tmp/online sh bin/omamobile-plugged-inhibit 2>/dev/null & ipid=$!; } -gone() { for _ in $(seq 10); do kill -0 "$1" 2>/dev/null || return 0; sleep 0.3; done; return 1; } +gone() { for _ in $(seq 34); do kill -0 "$1" 2>/dev/null || return 0; sleep 0.3; done; return 1; } # no charger: exits at once and blocks nothing PATH=$stub:$PATH OMAMOBILE_CHARGER_ONLINE=$tmp/no-such-file timeout 5 sh bin/omamobile-plugged-inhibit 2>/dev/null \ || fail "the blocker exits by itself when there is no charger" @@ -191,9 +191,15 @@ rm -f "$tmp/online"; gone "$ipid" || { kill "$ipid"; fail "the blocker stops whe wait "$ipid" 2>/dev/null || : # online 1: the lock is held while the file says 1, released when it says 0 echo 1 > "$tmp/online"; run_blocker -for _ in $(seq 20); do [[ -s $stub/child ]] && break; sleep 0.2; done +for _ in $(seq 50); do [[ -s $stub/child ]] && break; sleep 0.2; done child=$(cat "$stub/child" 2>/dev/null); sleep 2 [[ -n $child ]] && kill -0 "$child" 2>/dev/null || { kill "$ipid"; fail "the blocker holds the lock while charging"; } +# an empty or failed read (an I2C error) keeps holding +: > "$tmp/online"; sleep 3 +kill -0 "$child" 2>/dev/null || { kill "$ipid"; fail "an empty read keeps the lock"; } +echo 1 > "$tmp/online"; chmod 000 "$tmp/online"; sleep 3 +kill -0 "$child" 2>/dev/null || { kill "$ipid"; fail "a failed read keeps the lock"; } +chmod 644 "$tmp/online" echo 0 > "$tmp/online" gone "$child" || { kill "$ipid" "$child"; fail "the lock is released when charging stops"; } rm -f "$tmp/online"; gone "$ipid" || { kill "$ipid"; fail "the blocker stops when the charger goes away"; } diff --git a/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf index 16f722650..0ec3d0b52 100644 --- a/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf +++ b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-charger.conf @@ -9,5 +9,13 @@ # - temp_guard: stock's step-charging bands from the gauge's temperature # and voltage, every 30 s; no reading or out of range stops charging. # The gauge loads first, so the guard's first reading succeeds. +# On husky with a published kernel, a charger loaded by hand is not yet the +# 7 Pro's guard: +# - it gets the gs201 phones' table, until linux-omarchy-mobile#265 gives +# husky its own; +# - the gauge's temperature reads 22.0 C whatever the cell does, until the +# gauge fix lands, so the guard cannot see heat; +# - it charges to the battery node's 4.20 V, where the charge ends near 82 %, +# until the float is raised (the limits on #761). options max77759_charger default_ilim_ua=500000 temp_guard=1 softdep max77759_charger pre: max17042_battery diff --git a/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service b/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service index 4e837a253..848f5bb52 100644 --- a/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service +++ b/packages/omamobile-device-husky/vendor/systemd/system/omamobile-plugged-inhibit.service @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT [Unit] Description=Block sleep while charging (the charge guard pauses in s2idle) Wants=systemd-logind.service