diff --git a/packages/omamobile-device-panther/PKGBUILD b/packages/omamobile-device-panther/PKGBUILD index ed30bf0c6..f01769587 100644 --- a/packages/omamobile-device-panther/PKGBUILD +++ b/packages/omamobile-device-panther/PKGBUILD @@ -3,7 +3,7 @@ pkgname=omamobile-device-panther pkgver=$(cat "${startdir:-.}/version") pkgrel=1 -pkgdesc="Omarchy Mobile support for the Google Pixel 7 (panther): storage guard, USB networking, GPU, haptics, suspend-to-idle, USB after a replug and display brightness" +pkgdesc="Omarchy Mobile support for the Google Pixel 7 (panther): storage guard, USB networking, GPU, haptics, suspend-to-idle, USB after a replug, display brightness, Wi-Fi" arch=(aarch64) url="https://github.com/derekross/omarchy-mobile" license=(MIT) diff --git a/packages/omamobile-device-panther/README.md b/packages/omamobile-device-panther/README.md index 3fdeaa71e..59291f7c2 100644 --- a/packages/omamobile-device-panther/README.md +++ b/packages/omamobile-device-panther/README.md @@ -1,6 +1,6 @@ # omamobile-device-panther -Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panther, Tensor G2 / gs201). It hides the Android partitions from desktop tools, holds the USB address and brings USB back after a replug, and gives pacman the same `[omamobile]` repository as the Pixel 7 Pro. It loads the camera drivers after the boot has settled. It does not drive the radio or the charger, and it does not mark a boot slot successful. +Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panther, Tensor G2 / gs201). It hides the Android partitions from desktop tools, holds the USB address and brings USB back after a replug, brings up Wi-Fi with the Pixel 7 Pro's guarded start, and gives pacman the same `[omamobile]` repository as the Pixel 7 Pro. It loads the camera drivers after the boot has settled. It does not drive the modem or the charger, and it does not mark a boot slot successful. | Path | Installs to | What it does | | --- | --- | --- | @@ -11,9 +11,12 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe | `bin/omamobile-camera-start` + `vendor/systemd/system/omamobile-camera.{service,timer}` + `vendor/modprobe.d/omamobile-camera.conf` | `/usr/bin`, `/usr/lib/systemd/system` (the timer enabled by a vendor wants link), `/usr/lib/modprobe.d` | Loads the camera drivers 40 s into the boot (PMIC supplies, the three sensors and the main camera's lens, the DC-PHY and CSIS), skipping them on the next boot if a load never finished, and only when the DTB enables the camera receiver (`1a450000.csis`). The modules are blacklisted for autoload so only this guard (or a runbook) loads them. The Pixel 7 Pro's script, unit and list, with panther's CSIS and without the telephoto's `sem1215` | | `vendor/systemd/network/20-usb-gadget.network` | `/usr/lib/systemd/network` | Sets usb0 to 172.16.42.1/24 after handover | | `bin/omamobile-usb-rescue`, `vendor/systemd/system/omamobile-usb-rescue.service` | `/usr/bin`, `/usr/lib/systemd/system` (enabled for `multi-user.target`) | Brings USB back after a replug: the MAX77759 opens its USB2 data switch on unplug, and with no Type-C driver nothing closes it. While VBUS is valid, puts the switch back to 0x09 on the chip's I2C bus (USI13, which the board file enables). Reads two registers and writes that one; stands aside once a Type-C driver owns the chip. Same script and unit as the Pixel 7 Pro; needs `i2c-tools` | +| `bin/omamobile-wifi-start`, `vendor/systemd/system/omamobile-wifi.service`, `vendor/modprobe.d/omamobile-wifi.conf` | `/usr/bin`, `/usr/lib/systemd/system` (enabled for `multi-user.target`), `/usr/lib/modprobe.d` | Brings up Wi-Fi (BCM4389 on PCIe) at boot: the PCIe controller, then brcmfmac, behind a hang marker, so a bring-up that hangs the phone skips Wi-Fi on the next boot (`omamobile-wifi-start --retry`). The modules are blacklisted for autoload so only this guard loads them, and the unit runs only when the DTB enables the controller. Same script, unit and drop-in as the Pixel 7 Pro. The firmware is the phone's own (`tools/extract-vendor-firmware -d panther`) | +| `bin/omamobile-wlan-mac`, `vendor/udev/rules.d/80-omamobile-wlan-mac.rules` | `/usr/bin`, `/usr/lib/udev/rules.d` | Gives the Wi-Fi link the MAC address the bootloader writes into the device tree, before NetworkManager takes it. Same as the Pixel 7 Pro | | `vendor/systemd/logind.conf.d/10-omamobile-power-key.conf` | `/usr/lib/systemd/logind.conf.d` | A short power press does not power the phone off. Same drop-in as the Pixel 7 Pro. The long press stays the PMIC reset | | `vendor/modprobe.d/omamobile-display.conf` | `/usr/lib/modprobe.d` | Lets `gs_dsim_cmd` send DCS packets to the panel (`allow_tx=1`), so the panel driver can set the brightness and turn the display off and on. The driver ships with sending off; brightness passed DISPLAY-PLAN gate D2 on the Pixel 7 | | `vendor/systemd/sleep.conf.d/10-omamobile.conf` | `/usr/lib/systemd/sleep.conf.d` | Suspend means suspend-to-idle: the kernel offers `deep`, but Linux has no gs201 sleep sequence, and the phone doesn't wake from it. No hibernation. Same drop-in as the Pixel 7 Pro | +| `bin/omamobile-sleep`, `vendor/systemd/system-sleep/omamobile` | `/usr/bin`, `/usr/lib/systemd/system-sleep` (a link to the script) | Unloads Wi-Fi before every suspend and reloads it through the guarded service after, unless `/etc/omamobile/wifi-keep-across-sleep` exists; after a wake that fails in the Wi-Fi device it goes back to unloading for the rest of the boot. Also logs the wake reason and restarts fprintd after a wake. Wi-Fi staying loaded across suspend hasn't run on a Pixel 7. Same script as the Pixel 7 Pro | | `vendor/NetworkManager/conf.d/10-omamobile-usb.conf` | `/usr/lib/NetworkManager/conf.d` | Keeps NetworkManager off that link | | `etc/omamobile-mirrorlist` | `/etc/pacman.d/omamobile-mirrorlist` | Where pacman finds the `[omamobile]` repository. Same file as the Pixel 7 Pro package | | `omamobile-device-panther.install` | pacman hook | Adds `[omamobile]` to `pacman.conf` before `[omarchy]`, once. Same script as the Pixel 7 Pro package | @@ -22,4 +25,4 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe `./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, Wi-Fi, the charger, and the slot-B image hook. Those stay out until each one has its own runbook. +Not in this package: the boot-success marker, the modem, the charger, and the slot-B image hook. Those stay out until each one has its own runbook. diff --git a/packages/omamobile-device-panther/bin/omamobile-sleep b/packages/omamobile-device-panther/bin/omamobile-sleep new file mode 100755 index 000000000..c54f2a3c9 --- /dev/null +++ b/packages/omamobile-device-panther/bin/omamobile-sleep @@ -0,0 +1,102 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# systemd-sleep hook (device/cheetah/SUSPEND-PLAN.md, section 6.2), linked +# from /usr/lib/systemd/system-sleep/omamobile. systemd-sleep runs it as +# omamobile-sleep pre|post suspend|hibernate|hybrid-sleep|suspend-then-hibernate +# Only "systemctl suspend" (through logind) gets here; tests that write +# /sys/power/state directly bypass it. +# +# pre: unload Wi-Fi unless it is allowed to stay up across sleep (the +# brcmfmac D3 handshake for BCM4389 is new; stage S5), and note the +# suspend failure count. +# post: reload Wi-Fi if pre unloaded it (through the hang-safe service), log +# the wake reason, and if the suspend failed in the Wi-Fi device, fall +# back to unloading Wi-Fi for the rest of this boot and reload it now +# (a chip stuck in D3 only comes back with a reload of the stack), +# and restart fprintd if it runs: a fingerprint exchange cut by the +# freeze left it waiting for a reply that never came, and every unlock +# by fingerprint failed until a restart (SUSPEND-PLAN P2). +# +# Wi-Fi stays loaded across sleep only with /etc/omamobile/wifi-keep-across-sleep +# present (create it once stage S5 passes on the running kernel). +set -uo pipefail + +keep=/etc/omamobile/wifi-keep-across-sleep +run=/run/omamobile +unloaded=$run/wifi-unloaded-for-sleep +fallback=$run/wifi-sleep-fallback +failcount=$run/sleep-fail-count +wifi_pci=0000:01:00.0 + +log() { echo "omamobile-sleep: $*"; } + +wifi_loaded() { [[ -d /sys/module/brcmfmac || -d /sys/module/pcie_gs201 ]]; } + +wifi_unload() { + wifi_loaded || return 0 + # brcmfmac_wcc holds brcmfmac; removing it first unbinds the device cleanly. + if modprobe -r brcmfmac_wcc brcmfmac pcie_gs201; then + touch "$unloaded" + log "Wi-Fi unloaded for sleep" + else + log "Wi-Fi unload failed; sleeping with it loaded" + fi +} + +wifi_reload() { + [[ -e $unloaded ]] || return 0 + rm -f "$unloaded" + # --no-block: we run inside systemd-suspend.service. + systemctl --no-block restart omamobile-wifi.service + log "Wi-Fi reload queued" +} + +wake_reason() { + local irq name + irq=$(cat /sys/power/pm_wakeup_irq 2>/dev/null) || irq= + if [[ -n $irq ]]; then + name=$(awk -v i="$irq:" '$1 == i { $1 = ""; print; exit }' /proc/interrupts | tr -s ' ') + log "woken by IRQ $irq:${name:- (unknown)}" + else + log "no wake IRQ recorded" + fi +} + +case "${1:-}/${2:-}" in + pre/suspend) + mkdir -p "$run" + cat /sys/power/suspend_stats/fail > "$failcount" 2>/dev/null || true + if [[ -e $keep && ! -e $fallback ]]; then + log "Wi-Fi stays up across sleep ($keep)" + else + wifi_unload + fi + ;; + post/suspend) + wifi_reload + wake_reason + # --no-block, as above; try-restart leaves a stopped fprintd alone. + systemctl --no-block try-restart fprintd.service + before=$(cat "$failcount" 2>/dev/null || echo 0) + after=$(cat /sys/power/suspend_stats/fail 2>/dev/null || echo 0) + if ((after > before)); then + dev=$(cat /sys/power/suspend_stats/last_failed_dev 2>/dev/null) + log "suspend failed (last failed device: ${dev:-unknown})" + if [[ $dev == "$wifi_pci" ]]; then + touch "$fallback" + log "Wi-Fi refused D3; unloading it for sleep until the next boot" + # The chip may be stuck in D3: only a reload of the whole stack + # (which power-cycles it) brings it back. + wifi_unload + wifi_reload + fi + fi + ;; + pre/*|post/*) + ;; + *) + echo "Usage: omamobile-sleep pre|post suspend" >&2 + exit 1 + ;; +esac +exit 0 diff --git a/packages/omamobile-device-panther/bin/omamobile-wifi-start b/packages/omamobile-device-panther/bin/omamobile-wifi-start new file mode 100755 index 000000000..7914922f2 --- /dev/null +++ b/packages/omamobile-device-panther/bin/omamobile-wifi-start @@ -0,0 +1,62 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Bring up Wi-Fi at boot, hang-safe (device/cheetah/WIFI-BATTERY-PLAN.md). +# +# Order: the PCIe controller (powers the chip, trains the link), then +# brcmfmac. The chip's DMA buffers come from its restricted DMA pool (DT); +# that keeps driver bugs away from the rest of RAM, but is not a firewall +# against the chip's firmware. A marker file is written and synced before +# anything touches the hardware, and removed once the interface exists. If the +# phone hangs during bring-up, the next boot finds the marker and skips Wi-Fi; +# run "omamobile-wifi-start --retry" to try again. +# omamobile-wifi-start [--retry] +set -uo pipefail + +state=/var/lib/omamobile +marker=$state/wifi-bringup-started +controller=/sys/bus/platform/devices/14520000.pcie +pool=/proc/device-tree/reserved-memory/wifi-dma-pool + +log() { echo "omamobile-wifi: $*"; } + +[[ ${1:-} == --retry ]] && rm -f "$marker" + +if [[ -e $marker ]]; then + log "the last bring-up ($(cat "$marker" 2>/dev/null)) never finished; Wi-Fi stays off this boot." + log "after checking the previous boot's log, retry with: omamobile-wifi-start --retry" + exit 0 +fi + +mkdir -p "$state" +date -Is > "$marker" +sync -f "$marker" 2>/dev/null || sync + +finish() { rm -f "$marker"; sync -f "$state" 2>/dev/null || sync; } + +# 1. Only with the controller enabled and the DMA pool present (both from DT). +if [[ ! -e $controller ]]; then + log "the PCIe controller is not enabled in this DTB; nothing to do" + finish; exit 0 +fi +if [[ ! -d $pool ]] || { [[ -e $pool/status ]] && [[ $(tr -d '\0' < "$pool/status") != okay ]]; }; then + log "no Wi-Fi DMA pool in this DTB; not powering the Wi-Fi chip" + finish; exit 1 +fi + +# 2. Link, then the driver. Explicit modprobe works despite the autoload blacklist. +modprobe pcie_gs201 || { log "pcie_gs201 failed"; finish; exit 1; } +modprobe brcmfmac || { log "brcmfmac failed"; finish; exit 1; } + +# 3. Done once brcmfmac has an interface. +for _ in $(seq 60); do + for dev in /sys/class/net/*; do + if [[ $(readlink -f "$dev/device/driver" 2>/dev/null) == */brcmfmac ]]; then + log "up: ${dev##*/}" + finish; exit 0 + fi + done + sleep 0.5 +done +log "no Wi-Fi interface after 30 s (the hardware answered; see dmesg)" +finish +exit 1 diff --git a/packages/omamobile-device-panther/bin/omamobile-wlan-mac b/packages/omamobile-device-panther/bin/omamobile-wlan-mac new file mode 100755 index 000000000..097108a94 --- /dev/null +++ b/packages/omamobile-device-panther/bin/omamobile-wlan-mac @@ -0,0 +1,20 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Give the Wi-Fi interface the phone's real MAC address, as Android does. +# The bootloader writes it into the device tree at every boot +# (/chosen/config/wlan_mac1). brcmfmac doesn't read it there, so without +# this the chip comes up with a random address. +# omamobile-wlan-mac IFACE (run by udev when brcmfmac adds the link) +set -euo pipefail + +iface=${1:?Usage: omamobile-wlan-mac IFACE} +source=/proc/device-tree/chosen/config/wlan_mac1 +[[ -s $source ]] || exit 0 +mac=$(tr -d '\0' < "$source" | tr 'A-F' 'a-f') + +# A unicast, globally administered address only, as Google's driver checks. +[[ $mac =~ ^[0-9a-f]{2}(:[0-9a-f]{2}){5}$ ]] || exit 0 +(( (16#${mac:0:2} & 3) == 0 )) || exit 0 + +ip link set dev "$iface" down +ip link set dev "$iface" address "$mac" diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index 58fb25dd4..ed3167754 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -1,7 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: MIT # Stage omamobile-device-panther into DESTDIR. Nothing is enabled that would -# mark a slot successful or start the radio or the charger. The camera +# mark a slot successful or start the modem or the charger. Wi-Fi starts at +# boot only through its hang-safe guard (omamobile-wifi.service). The camera # drivers load only from omamobile-camera.timer, 40 s into the boot, behind # a hang marker, and only on a DTB with the camera receiver enabled. # ./install DESTDIR [BUILDDIR] @@ -17,10 +18,18 @@ install -Dm644 vendor/systemd/system/omamobile-usb-rescue.service \ install -d "$destination/usr/lib/systemd/system/multi-user.target.wants" ln -sfn ../omamobile-usb-rescue.service \ "$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-usb-rescue.service" +for tool in omamobile-wifi-start omamobile-wlan-mac; do + install -Dm755 "bin/$tool" "$destination/usr/bin/$tool" +done +for unit in omamobile-wifi.service; do + install -Dm644 "vendor/systemd/system/$unit" "$destination/usr/lib/systemd/system/$unit" +done +ln -sfn ../omamobile-wifi.service \ + "$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-wifi.service" install -Dm644 vendor/udev/rules.d/10-omamobile-storage.rules \ "$destination/usr/lib/udev/rules.d/10-omamobile-storage.rules" for rules in 20-omamobile-gpu-always-on.rules 72-omamobile-feedbackd.rules \ - 70-omamobile-dma-heap.rules; do + 70-omamobile-dma-heap.rules 80-omamobile-wlan-mac.rules; do install -Dm644 "vendor/udev/rules.d/$rules" "$destination/usr/lib/udev/rules.d/$rules" done install -Dm644 vendor/systemd/network/20-usb-gadget.network \ @@ -29,11 +38,14 @@ install -Dm644 vendor/systemd/logind.conf.d/10-omamobile-power-key.conf \ "$destination/usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf" install -Dm644 vendor/systemd/sleep.conf.d/10-omamobile.conf \ "$destination/usr/lib/systemd/sleep.conf.d/10-omamobile.conf" -install -Dm644 vendor/modprobe.d/omamobile-display.conf \ - "$destination/usr/lib/modprobe.d/omamobile-display.conf" +install -Dm755 bin/omamobile-sleep "$destination/usr/bin/omamobile-sleep" +install -d "$destination/usr/lib/systemd/system-sleep" +ln -sfn "$(readlink vendor/systemd/system-sleep/omamobile)" \ + "$destination/usr/lib/systemd/system-sleep/omamobile" +for conf in omamobile-display.conf omamobile-wifi.conf omamobile-camera.conf; do + install -Dm644 "vendor/modprobe.d/$conf" "$destination/usr/lib/modprobe.d/$conf" +done # The camera drivers never autoload; omamobile-camera-start loads them. -install -Dm644 vendor/modprobe.d/omamobile-camera.conf \ - "$destination/usr/lib/modprobe.d/omamobile-camera.conf" install -Dm755 bin/omamobile-camera-start "$destination/usr/bin/omamobile-camera-start" for unit in omamobile-camera.service omamobile-camera.timer; do install -Dm644 "vendor/systemd/system/$unit" "$destination/usr/lib/systemd/system/$unit" diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index 8ccb320dd..66fec6208 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -11,7 +11,7 @@ tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT bash -n build || fail "build parses" bash -n install || fail "install parses" -bash -n bin/omamobile-usb-rescue || fail "omamobile-usb-rescue parses" +for script in bin/*; do bash -n "$script" || fail "$script parses"; done pass "scripts parse" grep -q '\.\./\.\.' build install && fail "build or install reaches outside the package directory" @@ -55,6 +55,22 @@ if [[ -f ../omamobile-device-cheetah/src/reboot-to.c ]]; then ../omamobile-device-cheetah/vendor/systemd/system/omamobile-usb-rescue.service \ || fail "the usb-rescue unit drifted from the cheetah package" pass "omamobile-usb-rescue and its unit match the cheetah package" + # Wi-Fi is the 7 Pro's: same chip (BCM4389), same PCIe + # controller, same bootloader-written MAC address. + for f in bin/omamobile-wifi-start bin/omamobile-wlan-mac \ + vendor/modprobe.d/omamobile-wifi.conf vendor/systemd/system/omamobile-wifi.service \ + vendor/udev/rules.d/80-omamobile-wlan-mac.rules; do + cmp -s "$f" "../omamobile-device-cheetah/$f" || fail "$f drifted from the cheetah package" + done + pass "the Wi-Fi files match the cheetah package" + # So does sleep: Wi-Fi unloads around suspend unless + # /etc/omamobile/wifi-keep-across-sleep exists, and for the rest of the + # boot after a wake fails in the Wi-Fi device. + cmp -s bin/omamobile-sleep ../omamobile-device-cheetah/bin/omamobile-sleep \ + || fail "omamobile-sleep drifted from the cheetah package" + [[ $(readlink vendor/systemd/system-sleep/omamobile) == "$(readlink ../omamobile-device-cheetah/vendor/systemd/system-sleep/omamobile)" ]] \ + || fail "the system-sleep link drifted from the cheetah package" + pass "omamobile-sleep and its system-sleep link match the cheetah package" fi grep -q 'omamobile-keyring' PKGBUILD || fail "pacman needs omamobile-keyring" grep -q '^install=omamobile-device-panther.install$' PKGBUILD \ @@ -91,6 +107,10 @@ for f in usr/bin/reboot-to \ usr/share/licenses/omamobile-device-panther/LICENSE \ usr/bin/omamobile-usb-rescue \ usr/lib/systemd/system/omamobile-usb-rescue.service \ + usr/bin/omamobile-wifi-start usr/lib/systemd/system/omamobile-wifi.service \ + usr/lib/modprobe.d/omamobile-wifi.conf \ + usr/bin/omamobile-wlan-mac usr/lib/udev/rules.d/80-omamobile-wlan-mac.rules \ + usr/bin/omamobile-sleep \ etc/pacman.d/omamobile-mirrorlist; do [[ -f $tmp/root/$f ]] || fail "install stages $f" done @@ -119,16 +139,43 @@ grep -qx 'options gs_dsim_cmd allow_tx=1' "$tmp/root/usr/lib/modprobe.d/omamobil [[ -x $tmp/root/usr/bin/omamobile-usb-rescue ]] || fail "omamobile-usb-rescue is executable" [[ $(readlink "$tmp/root/usr/lib/systemd/system/multi-user.target.wants/omamobile-usb-rescue.service") == ../omamobile-usb-rescue.service ]] \ || fail "omamobile-usb-rescue starts at boot" +for tool in omamobile-wifi-start omamobile-wlan-mac omamobile-sleep; do + [[ -x $tmp/root/usr/bin/$tool ]] || fail "$tool is executable" +done +# Wi-Fi is the one radio started at boot, and only through its guard: the +# modules are blacklisted for autoload, the script writes a hang marker +# before it loads them, and it never loads the SysMMU firewall. +[[ $(readlink "$tmp/root/usr/lib/systemd/system/multi-user.target.wants/omamobile-wifi.service") == ../omamobile-wifi.service ]] \ + || fail "omamobile-wifi.service starts at boot" +grep -qx 'blacklist pcie_gs201' "$tmp/root/usr/lib/modprobe.d/omamobile-wifi.conf" \ + || fail "pcie_gs201 only loads through the guarded service" +grep -qx 'blacklist brcmfmac' "$tmp/root/usr/lib/modprobe.d/omamobile-wifi.conf" \ + || fail "brcmfmac only loads through the guarded service" +grep -q 'marker=' bin/omamobile-wifi-start || fail "omamobile-wifi-start keeps a hang marker" +grep -q 'mode=' bin/omamobile-wifi-start && fail "omamobile-wifi-start never loads the SysMMU firewall" +grep -q '^ConditionPathExists=/sys/bus/platform/devices/14520000.pcie$' \ + "$tmp/root/usr/lib/systemd/system/omamobile-wifi.service" \ + || fail "omamobile-wifi.service needs the PCIe controller in the DTB" +[[ $(readlink "$tmp/root/usr/lib/systemd/system-sleep/omamobile") == /usr/bin/omamobile-sleep ]] \ + || fail "systemd-sleep runs omamobile-sleep" +grep -q 'modprobe -r brcmfmac_wcc brcmfmac pcie_gs201' bin/omamobile-sleep \ + || fail "omamobile-sleep unloads Wi-Fi before suspend" grep -q 'i2c-tools' PKGBUILD || fail "omamobile-usb-rescue needs i2c-tools" grep -q '^PACKAGE=omamobile-device-panther$' "$tmp/root/usr/share/omamobile/device.conf" \ || fail "the installed descriptor is panther" for absent in usr/bin/omamobile-boot-success usr/bin/omamobile-bootctl \ usr/lib/systemd/system/omamobile-boot-success.service \ - usr/bin/omamobile-wifi-start usr/bin/omamobile-charge-guard \ + usr/bin/omamobile-charge-guard usr/bin/omamobile-aoc-start \ usr/lib/systemd/logind.conf.d/10-omamobile-lid.conf; do [[ ! -e $tmp/root/$absent ]] || fail "install includes $absent" done -pass "install stages the udev rules, the USB link and its rescue, and the mirrorlist, and nothing that marks a slot or starts the radio or the charger" +for wants in "$tmp"/root/usr/lib/systemd/system/*.wants/*; do + case ${wants##*/} in + omamobile-usb-rescue.service|omamobile-wifi.service|omamobile-camera.timer) ;; + *) fail "install enables ${wants#$tmp/root/}" ;; + esac +done +pass "install stages the udev rules, the USB link and its rescue, Wi-Fi, and the mirrorlist; it starts only the USB rescue, guarded Wi-Fi and the camera timer, and nothing that marks a slot or starts the modem or the charger" # The cameras: drivers blacklisted, loaded only by omamobile-camera-start # from the timer, on panther's CSIS (1a450000; cheetah's is 1a460000). cam=$tmp/root/usr/bin/omamobile-camera-start diff --git a/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-wifi.conf b/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-wifi.conf new file mode 100644 index 000000000..f8a289b95 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-wifi.conf @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT +# Wi-Fi is brought up by omamobile-wifi.service (omamobile-wifi-start), which +# loads these explicitly after writing a hang marker, so a bring-up that hangs +# the phone skips Wi-Fi on the next boot. Blacklisting only stops udev from +# autoloading them ahead of that guard; "modprobe pcie_gs201" still works. +blacklist pcie_gs201 +blacklist brcmfmac diff --git a/packages/omamobile-device-panther/vendor/systemd/system-sleep/omamobile b/packages/omamobile-device-panther/vendor/systemd/system-sleep/omamobile new file mode 120000 index 000000000..3629a2ee6 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/systemd/system-sleep/omamobile @@ -0,0 +1 @@ +/usr/bin/omamobile-sleep \ No newline at end of file diff --git a/packages/omamobile-device-panther/vendor/systemd/system/omamobile-wifi.service b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-wifi.service new file mode 100644 index 000000000..4ec557e02 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-wifi.service @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: MIT +# Wi-Fi at boot, enabled by the vendor multi-user.target.wants link. pcie_gs201 +# and brcmfmac are blacklisted for autoload (modprobe.d/omamobile-wifi.conf), +# so this hang-safe script is the only thing that powers the chip. +[Unit] +Description=Bring up Wi-Fi (hang-safe) +After=local-fs.target systemd-modules-load.service +ConditionPathExists=/sys/bus/platform/devices/14520000.pcie + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-wifi-start +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/packages/omamobile-device-panther/vendor/udev/rules.d/80-omamobile-wlan-mac.rules b/packages/omamobile-device-panther/vendor/udev/rules.d/80-omamobile-wlan-mac.rules new file mode 100644 index 000000000..c88f4c8d4 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/udev/rules.d/80-omamobile-wlan-mac.rules @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile: set the Wi-Fi MAC from the bootloader before NetworkManager +# takes the link (omamobile-wlan-mac). $name, not %k: by the time RUN +# runs, 80-net-setup-link has renamed wlan0 to wlp1s0. +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="brcmfmac", RUN+="/usr/bin/omamobile-wlan-mac $name" diff --git a/packages/omamobile-device-panther/version b/packages/omamobile-device-panther/version index 1a030947e..9767cc98e 100644 --- a/packages/omamobile-device-panther/version +++ b/packages/omamobile-device-panther/version @@ -1 +1 @@ -0.1.9 +0.1.10