diff --git a/device/panther/FINGERPRINT-PLAN.md b/device/panther/FINGERPRINT-PLAN.md new file mode 100644 index 000000000..7ee0d34bc --- /dev/null +++ b/device/panther/FINGERPRINT-PLAN.md @@ -0,0 +1,156 @@ + +# Fingerprint plan (panther / gs201): what the Pixel 7 shares with the 7 Pro + +Status (2026-11-07): **P1 to P5 passed on the phone** (section 5): a finger +enrolled and the lock screen unlocked with it, also after a reboot with the +unit starting the stack by itself. The sensor is the 7 Pro's; the panel and +the touchscreen are not. linux-omarchy-mobile#207 (merged 2026-11-07) +describes the sensor, its supply and pins, all disabled; this repo adds the +two bring-up overlays and the Pixel 7 to `omamobile-fingerprint` and +`tools/extract-fingerprint-vendor`. The 7 Pro's plan and research +([FINGERPRINT-PLAN](../cheetah/FINGERPRINT-PLAN.md), +[FINGERPRINT-RESEARCH](../cheetah/FINGERPRINT-RESEARCH.md)) apply to +everything below unless this file says otherwise. + +## 1. The sensor: the same as the 7 Pro's + +Sources: the stock dtbo from the Pixel 7's OTA (CP3A.261005.002.A1), +decompiled: `dtbo22_id30406` (PANTHER MP, the one ABL picks on this phone, +`ro.boot.dtbo_idx 22`) against `dtbo12_id30306` (CHEETAH MP); the OTA's +`vendor.img` read with debugfs; the phone, read only. + +| What | Pixel 7 (panther) | Same as cheetah? | +|---|---|---| +| Sensor node | `goodixfp`, `compatible = "goodix,fingerprint"`, `interrupts = <2 0>` on `gpa9`, `fp-gpio-reset = <&gpp1 1 1>`, `spi-max-frequency = 1 MHz` (dtbo22 lines 4435-4446) | Yes: the fragment differs only in phandle numbers (dtbo12 4453-4464). All ten panther board dtbos (13-22) have the same node and reset pin | +| Reset pin | `gpp1-1`, function 1 (output), no pull (dtbo22 4419-4425) | Yes | +| Supply | S2MPG13 `LDO15S`, "L15S_UDFPS_AVDD", 2.5-3.3 V, `regulator-always-on` (dtbo22 1669-1677) | Yes, identical lines | +| Touch hook | `fps_touch_handler` (dtbo22 4447-4450) | Yes (our props.conf turns it off on both) | +| Trusted app | `/firmware/g7.app`, 13 537 619 bytes; `ro.vendor.fingerprint.ta.name=g7.app` (vendor `build.prop`) | Same name and loader; the bytes are not compared (no cheetah image on this computer) | +| HAL and Trusty services | `android.hardware.biometrics.fingerprint-service.goodix`, `gatekeeper-service.trusty`, `keymint-service.trusty` (C++), `storageproxyd`, `trusty_apploader`, `vndservicemanager`, `libgf_hal.so`, `fp_utils.so` | Same file names as the 7 Pro list in `tools/extract-fingerprint-vendor` | +| `fingerprint-goodix.rc` | apploader on `ro.vendor.trusty.storage.fs_ready=1`, then the HAL | Same flow | +| Partitions | `mfg_data` (sdd4, 6560 sectors), not blank: 35 525 of its 16-byte rows are non-zero; RPMB LUN `0:0:0:49476` present | As cheetah; whether `mfg_data` holds a valid calibration is not checked | +| Kernel config (running kernel) | `GOODIX_FP=m`, `TRUSTY=m` (+log, virtio, ipc), `CHR_DEV_SG=m`, `DMABUF_HEAPS_SYSTEM=y`, `ANDROID_BINDERFS=y`; `goodix-fp.ko` and the trusty modules installed | Yes | + +So no new sensor driver and no new TA: the 7 Pro's `goodix-fp`, Trusty +drivers, chroot, bridge and libfprint driver are the ones to use. + +## 2. What differs + +| Piece | Pixel 7 | Consequence | +|---|---|---| +| Trusty | Started on the Pixel 7 on 2026-11-03 with the sound bring-up's overlay, which enables `/trusty` (kernel `g89edef70d4d5`, 23:43): "trusty version: Project: cloudripper", "selected api version: 5", trusty_ipc virtio0 vrings, "trusty-virtio ... initializing done". `/dev/trusty-ipc-dev0` and the cpu 7 hotplug were not checked | Gate P2 is mostly seen already; what is left of it is in P2 | +| Sub-PMIC | Not described before linux-omarchy-mobile#207 (running regulators: `ldo*m` only) | #207 adds `pmic-2` with LDO15S only | +| Panel | Samsung S6E3FC3 (`panel-samsung-s6e3fc3`, `samsung,s6e3fc3-p10`), 1080x2400, ABL's `exynos_drm.panel_name=sdc-s6e3fc3-p10` | Local HBM is in a local kernel commit (branch `panther-lhbm`, not on the phone yet): section 4 | +| Touchscreen | FocalTech FT3658 (`focaltech_ft3658`, input "FocalTech FT3658") | The runner looked only for the Synaptics name: now per device | +| `omamobile-fp-chroot` | Any board but the 9a ran as cheetah | Now detects `google,gs201-panther`: g7.app, C++ KeyMint, 1080x2400 at 60 Hz, `sdc-s6e3fc3-p10`, FT3658 (untested) | +| Sensor position | Not known here: the bridge asks the HAL (`getSensorProps`), which has its own per-device data | Check in P5 that the circle lands on the sensor | +| `tools/phone-provision` | Accepts cheetah and raven only | Google's files go in by hand until it learns panther | +| Factory image | Ángel has the OTA (payload), not the factory zip the extractor reads | Repack `vendor.img` + `system.img` as a zip and use `-f`, or get the factory zip (a download: Ángel's call) | + +## 3. Bring-up gates + +Rules from the 7 Pro, unchanged: nothing writes `persist`, `mfg_data` or the +RPMB without Ángel's explicit "yes" in that session; `storageproxyd`'s first +run (cheetah F4) is irreversible. Before any reboot: Vol- + Power, +`fastboot --set-active=b` (slot B's retry counter). The NV backup of +2026-11-03 exists (`tools/nv-backup -d panther`, 7 partitions, `--check` SAME). + +Kernel: the bring-up ran on a local branch with linux-omarchy-mobile#207's +commit on top (section 5 names the kernel). Overlays apply +with `DTB_OVERLAYS="..."` in `device/panther/device.conf` (a local edit for +the test, never committed) before `bin/omamobile images`. + +**P1. New DTB, no overlay.** Expect: the phone as before; +`cat /proc/device-tree/fingerprint/status` = `disabled`; no `vdd_udfps` in +`/sys/class/regulator/*/name`. **Stop if** anything else changed (display, +touch, wifi, charging) or `fingerprint` is missing. + +**P2. Trusty (`DTB_OVERLAYS="fingerprint-trusty"`).** +Trusty's start was already seen with the sound overlay (section 2); what is +new here is the device node and the cpu 7 line. +`tools/fingerprint-capture --watchdog trusty-core`, then `trusty-log`, +`trusty-ipc`, `hotplug`. Expect as cheetah F2: "trusty version", "selected +api version", `/dev/trusty-ipc-dev0`, "refusing to take cpu 7 offline". +**Stop if** the phone hangs or resets (the watchdog feeder catches it), any +SError/panic, or the version line is missing: back to the previous images. + +**P3. Connect-only probe.** `omamobile-tipc-probe keymint gatekeeper +apploader` (connects and closes, sends nothing; never the storage proxy +port). Expect three "open". **Stop if** any fails: Trusty is up but not +serving. + +**P4. Sensor power (`DTB_OVERLAYS="fingerprint-trusty fingerprint-sensor"`).** +Check `vdd_udfps` appears with 0 users, then `tools/fingerprint-capture +--watchdog goodix`. Expect "goodix-fp ... supply switched", LDO15S 1 user +while `/dev/goodix_fp` is open, 0 after. **Stop if** any other rail changes +state (`regulator_summary` before and after), or LDO15S is not the one +switched. + +**P5. TA, HAL, enroll (the irreversible part: Ángel's "yes" first).** +Google's files from the Pixel 7's own image (`extract-fingerprint-vendor -d +panther`), then the 7 Pro's F3-F9 with the runner's stages. Expect "g7.app +loaded", "HAL/TA version is match", "Initialization successful". **Stop if** +the HAL reports a calibration error (the 9a's "spmt is not pass" / +CALIBRATION_NOT_READY): the calibration question is then panther's own. + +## 4. Local HBM on the S6E3FC3 + +The optical sensor reads the finger lit by the panel's local HBM circle. The +bridge drives it through `local_hbm_mode`; without it the bridge logs "LHBM +on refused" and captures run unlit, which is expected to fail or match +poorly (not measured). The panel driver on `omamobile` has no +`local_hbm_mode` yet: a local kernel commit (branch `panther-lhbm`, not +proposed yet) adds it to +`panel-samsung-s6e3fc3`, from Google's GPL `panel-samsung-s6e3fc3-p10.c` +(android-gs-pantah-5.10-android15-qpr1): the 7 Pro's interface +(`local_hbm_mode`, `local_hbm_max_timeout` up to 3 s, `allow_lhbm`, off on +blank/unprepare), the gamma copy from 0xD8 to 0x65 and the circle centred +at x 540, y 1713. `omamobile-fingerprint-lhbm.conf` has the +`panel_samsung_s6e3fc3` line. Not run on the phone: check the circle's +place and the 3 s timeout before P5. + +## 5. Results + +On 2026-11-04, kernel `7.3.0-rc6-omamobile-push1-g44048a9aa795` with the +fingerprint DT commit (its LDO15S `disabled`, enabled by this overlay) and +the sound and camera overlays the phone already ran; only +`vendor_kernel_boot` was reflashed, rebuilt byte for byte the same way first. + +| Gate | Result | +|---|---| +| P1 | Passed: `fingerprint` present and `disabled`, no `vdd_udfps`; modules, Wi-Fi, touch, sound, failed units as before; kernel errors the same kinds as the three boots before (60-72) | +| P2 | Passed (Trusty was on through the sound overlay): "trusty version: Project: cloudripper", "selected api version: 5", `/dev/trusty-ipc-dev0`, "refusing to take cpu 7 offline" | +| P3 | Passed: keymaster, gatekeeper and apploader "open" | +| P4 | Passed with goodix_fp blacklisted and loaded by hand: "irq 129, supply switched, netlink 25"; `vdd_udfps` 0 users before, 1 (enabled) while `/dev/goodix_fp` was open (152 sensor interrupts), 0 (disabled) after; `regulator_summary` otherwise identical (81 lines) | +| P5 | Passed (Ángel's yes, 2026-11-04 and 11-06): see below | + +**P5.** The runner first refused: this phone's `persist:/ss/0` is a 0-byte +file with the factory date (1 Jan 2020), in the 11-03 and 11-04 backups +alike, so its Trusty never committed TDP, and stock's `storageproxyd` +serves that empty file on every boot (`init.gs201.rc` links +`/data/vendor/ss/persist` to persist's `/ss`). With the runner taking an +empty `/ss/0` as an empty TDP copy (its hash recorded, refused once either +side changes), the first start (11-04 18:24) copied `mfg_data` and +`persist:/ss`, ran `storageproxyd`, loaded `g7.app`, and brought up KeyMint, +Gatekeeper, the Goodix HAL and the bridge; the HAL reported the sensor at +(540, 1713), radius 100, and no calibration error ("injectMtCali: +Calibration file already sent" only). On 11-06, same kernel and DTB, +`omamobile-fp` started the stack again; `fprintd-list` showed "Under-display +fingerprint sensor (Omarchy Mobile)". A right index finger was enrolled from +the shell's enrollment screen (quick settings, Fingerprint) and the lock +screen unlocked with it (the bridge logged `MATCH`). The TDP copy was still +the empty file (`e3b0c442…`) two days and one enrollment later: Trusty did +not write TDP. Then, with `omamobile-fp` enabled and this package's +`omamobile-fingerprint.conf` in place of the hand-written blacklist, a +reboot (11-06 19:02): Trusty loaded from the DT, `/dev/trusty-ipc-dev0` +and `goodix_fp` were there, the unit started the stack by itself ("g7.app +loaded", the bridge ready), no unit failed, the finger was still enrolled, +the TDP copy still empty, and the lock screen unlocked with it (`MATCH`). +Not checked: the packages installed with `pacman -U` (their files were +copied by hand), a wrong finger, sudo through `pam_fprintd`, and stock +Android after a factory reset (cheetah's T2). + +Before a Pixel 7 DTB turns `/trusty` on by default (not just the bring-up +overlay): Trusty loads straight from the DT here and calls into the secure +world at probe, while the 7 Pro loads it from a start script behind a hang +marker. The Pixel 7 gets the same guarded start first. diff --git a/device/panther/overlays/fingerprint-sensor.dtso b/device/panther/overlays/fingerprint-sensor.dtso new file mode 100644 index 000000000..832f744fc --- /dev/null +++ b/device/panther/overlays/fingerprint-sensor.dtso @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +/* + * Bring-up only (device/panther/FINGERPRINT-PLAN.md, gate P4): enable the + * sub-PMIC, LDO15S (the sensor's supply, disabled in the base DTB like the + * camera's LDO12S, so a camera overlay leaves it alone) and the Goodix + * sensor node. Apply after fingerprint-trusty.dtso. The PERIC0 + * pin controller (the sensor's reset line, gpp1-1) is already on in the + * default DTB. Paths, not labels, so the base DTB needs no __symbols__. + */ +/dts-v1/; +/plugin/; + +&{/firmware/power-management/pmic-2} { + status = "okay"; +}; + +&{/firmware/power-management/pmic-2/regulators/ldo15s} { + status = "okay"; +}; + +&{/fingerprint} { + status = "okay"; +}; diff --git a/device/panther/overlays/fingerprint-trusty.dtso b/device/panther/overlays/fingerprint-trusty.dtso new file mode 100644 index 000000000..863e1e046 --- /dev/null +++ b/device/panther/overlays/fingerprint-trusty.dtso @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +/* + * Bring-up only (device/panther/FINGERPRINT-PLAN.md, gate P2): enable the + * Trusty node, so the trusty modules can bind. Nothing on the Pixel 7 + * starts Trusty yet; the modules are loaded by hand. Paths, not labels, so + * the base DTB needs no __symbols__. + */ +/dts-v1/; +/plugin/; + +&{/trusty} { + status = "okay"; +}; diff --git a/fingerprint/bridge/omamobile-fp-bridge.c b/fingerprint/bridge/omamobile-fp-bridge.c index ec55b1cbf..ec539260a 100644 --- a/fingerprint/bridge/omamobile-fp-bridge.c +++ b/fingerprint/bridge/omamobile-fp-bridge.c @@ -64,6 +64,8 @@ * arguments to __libc_init() as bionic's crtbegin does. fingerprint/Makefile * builds it against the extracted chroot's libc and libbinder_ndk. */ + +#define _GNU_SOURCE #include #include #include diff --git a/packages/omamobile-device-panther/README.md b/packages/omamobile-device-panther/README.md index 59291f7c2..450340033 100644 --- a/packages/omamobile-device-panther/README.md +++ b/packages/omamobile-device-panther/README.md @@ -15,6 +15,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe | `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/modprobe.d/omamobile-fingerprint.conf` | `/usr/lib/modprobe.d` | Keeps `sg` and `goodix_fp` from autoloading: omamobile-fp loads them (the RPMB LUN, the sensor). Trusty is left to the DT's `/trusty` node, since this package has no sound start that loads it as the 7 Pro's does (device/panther/FINGERPRINT-PLAN.md) | | `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 | diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index ed3167754..ab280452e 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -53,6 +53,8 @@ done install -d "$destination/usr/lib/systemd/system/timers.target.wants" ln -sfn ../omamobile-camera.timer \ "$destination/usr/lib/systemd/system/timers.target.wants/omamobile-camera.timer" +install -Dm644 vendor/modprobe.d/omamobile-fingerprint.conf \ + "$destination/usr/lib/modprobe.d/omamobile-fingerprint.conf" install -Dm644 vendor/NetworkManager/conf.d/10-omamobile-usb.conf \ "$destination/usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf" install -Dm644 device.conf \ diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index 66fec6208..d32084c25 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -101,6 +101,7 @@ for f in usr/bin/reboot-to \ usr/lib/modprobe.d/omamobile-camera.conf \ usr/lib/systemd/system/omamobile-camera.service \ usr/lib/systemd/system/omamobile-camera.timer \ + usr/lib/modprobe.d/omamobile-fingerprint.conf \ usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf \ usr/share/omamobile/device.conf \ usr/share/omamobile/device-panther/version \ @@ -136,6 +137,13 @@ grep -q '^MemorySleepMode=s2idle$' "$tmp/root/usr/lib/systemd/sleep.conf.d/10-om || fail "suspend must be s2idle: gs201 never wakes from deep" grep -qx 'options gs_dsim_cmd allow_tx=1' "$tmp/root/usr/lib/modprobe.d/omamobile-display.conf" \ || fail "the DSI command host may send to the panel (brightness)" +f=$tmp/root/usr/lib/modprobe.d/omamobile-fingerprint.conf +for m in sg goodix_fp; do + grep -qx "blacklist $m" "$f" || fail "$m is loaded by omamobile-fp only" +done +# No package here loads Trusty by hand (the 7 Pro's sound start does), so +# blacklisting it would leave omamobile-fp without /dev/trusty-ipc-dev0 +grep -q 'trusty' <(grep -v '^#' "$f") && fail "Trusty must load from the DT, not be blacklisted" [[ -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" diff --git a/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-fingerprint.conf b/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-fingerprint.conf new file mode 100644 index 000000000..1578e8160 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-fingerprint.conf @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: MIT +# Fingerprint: omamobile-fp's unit loads goodix_fp and its runner loads sg +# (device/panther/FINGERPRINT-PLAN.md P4, P5). +# - sg: SCSI generic is needed only for the UFS RPMB well-known LUN, but it +# creates a raw SG_IO node for every LUN, which bypasses the block layer's +# read-only guard on the calibration partitions. systemd-udevd would load +# it for every SCSI device. +# - goodix_fp: switches the sensor supply and reset. +# Unlike the 7 Pro's file, Trusty is not blacklisted: there its sound start +# (omamobile-aoc-start) loads it, and this package has none, so with the +# trusty_* lines nothing would create /dev/trusty-ipc-dev0 and omamobile-fp +# would be skipped. Trusty loads from the DT's /trusty node, as on the Pixel 7 +# where P5 passed. +blacklist sg +blacklist goodix_fp diff --git a/packages/omamobile-fingerprint/install b/packages/omamobile-fingerprint/install index cbe06a891..58c8aec76 100755 --- a/packages/omamobile-fingerprint/install +++ b/packages/omamobile-fingerprint/install @@ -18,6 +18,7 @@ install -Dm755 lib/omamobile-fp-ctl "$l/omamobile-fp-ctl" install -Dm644 lib/props.conf "$l/props.conf" install -Dm644 lib/props-cheetah.conf "$l/props-cheetah.conf" install -Dm644 lib/props-tegu.conf "$l/props-tegu.conf" +install -Dm644 lib/props-panther.conf "$l/props-panther.conf" install -Dm644 prebuilt/omamobile-fp-shim.so "$l/omamobile-fp-shim.so" install -Dm755 prebuilt/omamobile-fp-bridge "$l/omamobile-fp-bridge" install -Dm644 vendor/systemd/system/omamobile-fp.service "$d/usr/lib/systemd/system/omamobile-fp.service" diff --git a/packages/omamobile-fingerprint/lib/omamobile-fp-chroot b/packages/omamobile-fingerprint/lib/omamobile-fp-chroot index b511a8fbb..3cadc7b93 100755 --- a/packages/omamobile-fingerprint/lib/omamobile-fp-chroot +++ b/packages/omamobile-fingerprint/lib/omamobile-fp-chroot @@ -78,12 +78,16 @@ fp_device() { c=$(tr '\0' '\n' < /proc/device-tree/compatible 2>/dev/null || true) case $c in *google,zumapro-tegu*) echo tegu ;; + *google,gs201-panther*) echo panther ;; *) echo cheetah ;; esac } # From the board's compatible string; only test/preflight may override it DEVICE=$(fp_device) [[ ${OMAMOBILE_FP_TEST:-} == 1 ]] && DEVICE=${OMAMOBILE_FP_DEVICE:-$DEVICE} +# Our touchscreen driver's input device name (synaptics_tcm); panther's +# case replaces it. +TOUCH_NAME="Synaptics TouchComm Touchscreen" case $DEVICE in cheetah) TA=g7.app @@ -102,7 +106,16 @@ case $DEVICE in # ("On: WxH@Hz") and captures at pointer down, so the circle comes first PANEL=1080x2424 PANEL_HZ=120 PANEL_STATE="On: 1080x2424@120" LHBM_FIRST=1 PANEL_NAME=google-tg4c MAP_STORES=1 ;; - *) echo "omamobile-fp: unknown device '$DEVICE' (cheetah, tegu)" >&2; exit 1 ;; + panther) + # the Pixel 7: the 7 Pro's TA and HALs (its vendor image ships the same + # files), its own panel (ABL's exynos_drm.panel_name) and touchscreen + # (focaltech_ft3658); device/panther/FINGERPRINT-PLAN.md. + TA=g7.app + KEYMINT=/vendor/bin/hw/android.hardware.security.keymint-service.trusty + PANEL=1080x2400 PANEL_HZ=60 PANEL_STATE=on LHBM_FIRST=0 + PANEL_NAME=sdc-s6e3fc3-p10 MAP_STORES=0 + TOUCH_NAME="FocalTech FT3658" ;; + *) echo "omamobile-fp: unknown device '$DEVICE' (cheetah, tegu, panther)" >&2; exit 1 ;; esac PANEL_NAME=${OMAMOBILE_FP_PANEL_NAME:-$PANEL_NAME} PROPS_DEVICE=${OMAMOBILE_FP_PROPS_DEVICE:-/usr/lib/omamobile-fp/props-$DEVICE.conf} @@ -133,8 +146,6 @@ NSPID=$RUN/ns.pid # The UFS RPMB well-known LUN (stock storageproxyd: -r /dev/sg1). RPMB_LUN=49476 -# Our touchscreen driver's input device name (synaptics_tcm). -TOUCH_NAME="Synaptics TouchComm Touchscreen" # The bridge's socket directory on the host (root only); in the chroot it # is /dev/socket/omamobile-fp. SOCKDIR=$RUN/sock @@ -294,6 +305,19 @@ persist_dump() { # $1 path in persist, $2 output, $3 the partition's device [[ -s $2 ]] } +# persist:/ss/0 (TDP) the same way, but an empty regular file counts when +# persist's own /ss/0 is empty: a phone whose Trusty never committed TDP +# (the Pixel 7 here: 0 bytes, ctime from the factory) gives stock an empty +# TDP too, so serving the same empty file is what stock does. +persist_dump_tdp() { # $1 output, $2 the partition's device + local st + persist_dump /ss/0 "$1" "$2" && return 0 + st=$(debugfs -R "stat /ss/0" "$DEVDIR/$2" 2>/dev/null) || return 1 + grep -c 'Type: regular' <<<"$st" >/dev/null || return 1 + [[ $(grep -o -m1 'Size: [0-9]*' <<<"$st") == "Size: 0" ]] || return 1 + : > "$1" +} + # Two files the same? cmp(1) (diffutils) answers 0 same, 1 different and # anything else for trouble (127: not installed). Trouble is never "differs": # it stops the start with its own reason, so the guard stays closed and honest. @@ -324,12 +348,12 @@ provision() { rm -rf "$tmp" install -d -m 0700 "$tmp" if [[ -e $STATE/persist-ss/0 ]]; then - persist_dump /ss/0 "$tmp/0" "$p" || die "can't read persist:/ss/0 to check the existing TDP copy" + persist_dump_tdp "$tmp/0" "$p" || die "can't read persist:/ss/0 to check the existing TDP copy" same_file "$tmp/0" "$STATE/persist-ss/0" || refuse "$STATE/persist-ss/0 differs from persist:/ss/0: Linux's TDP copy and stock's no longer agree. Not starting: ask (FINGERPRINT-PLAN F19)" say "the existing TDP copy matches persist:/ss/0: recording it" else - persist_dump /ss/0 "$tmp/0" "$p" || + persist_dump_tdp "$tmp/0" "$p" || refuse "persist has no /ss/0 (or it can't be read): without a TDP copy storageproxyd won't start" persist_dump /ss/nsp "$tmp/nsp" "$p" || say "persist has no /ss/nsp: Trusty starts an empty one (it has no rollback check)" @@ -376,7 +400,7 @@ tdp_guard() { refuse "no TDP copy ($STATE/tdp.img): storageproxyd won't start without it (device/tegu/FINGERPRINT-PLAN.md F4b)" return 0 fi - [[ -s $STATE/persist-ss/0 ]] || + [[ -f $STATE/persist-ss/0 ]] || refuse "no TDP copy ($STATE/persist-ss/0, recorded in $PROVENANCE): storageproxyd won't start without it. Don't recreate it by hand: ask (FINGERPRINT-PLAN F19)" want=$(recorded persist-ss/0) [[ -n $want ]] || die "$PROVENANCE has no persist-ss/0 line" @@ -386,7 +410,7 @@ tdp_guard() { p=$(ro_part persist) install -d -m 0755 "$RUN" tmp=$RUN/persist-ss0.check - persist_dump /ss/0 "$tmp" "$p" || die "can't read persist:/ss/0 to check it against the copy" + persist_dump_tdp "$tmp" "$p" || die "can't read persist:/ss/0 to check it against the copy" got=$(sha "$tmp") rm -f "$tmp" [[ $got == "$want" ]] || diff --git a/packages/omamobile-fingerprint/lib/props-panther.conf b/packages/omamobile-fingerprint/lib/props-panther.conf new file mode 100644 index 000000000..f9a2bf0ab --- /dev/null +++ b/packages/omamobile-fingerprint/lib/props-panther.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# The Pixel 7's properties for the fingerprint chroot, applied after +# props.conf: what Android's init would have set from the bootloader. +ro.boot.hardware.platform=gs201 +ro.hardware=panther diff --git a/packages/omamobile-fingerprint/test/all b/packages/omamobile-fingerprint/test/all index 3f14c39a9..ce21394c9 100755 --- a/packages/omamobile-fingerprint/test/all +++ b/packages/omamobile-fingerprint/test/all @@ -47,22 +47,30 @@ grep -c 'PANEL=1080x2424 PANEL_HZ=120 PANEL_STATE="On: 1080x2424@120" LHBM_FIRST grep -c -- '--lhbm-first "\$LHBM_FIRST"' lib/omamobile-fp-chroot >/dev/null || fail "the runner passes the circle order" # Under set -u, each phone's case sets every value the spawn line uses. cases=$(sed -n '/^case \$DEVICE in/,/^esac/p' lib/omamobile-fp-chroot) -for d in cheetah tegu; do - DEVICE=$d bash -uc "$cases"' - [[ -n $PANEL && -n $PANEL_HZ && -n $PANEL_STATE && -n $LHBM_FIRST ]]' || +for d in cheetah tegu panther; do + DEVICE=$d TOUCH_NAME=x bash -uc "$cases"' + [[ -n $PANEL && -n $PANEL_HZ && -n $PANEL_STATE && -n $LHBM_FIRST && -n $TOUCH_NAME ]]' || fail "$d: the case leaves a panel value unset" done grep -c '^ro.hardware=tegu$' lib/props-tegu.conf >/dev/null || fail "props-tegu.conf" grep -c '^ro.hardware=cheetah$' lib/props-cheetah.conf >/dev/null || fail "props-cheetah.conf" +grep -c '^ro.hardware=panther$' lib/props-panther.conf >/dev/null || fail "props-panther.conf" +# The Pixel 7: found by its board, the 7 Pro's TA, its own panel and touchscreen. +grep -c '\*google,gs201-panther\*) echo panther' lib/omamobile-fp-chroot >/dev/null || fail "panther not detected" +DEVICE=panther bash -uc "$cases"' + [[ $TA == g7.app && $PANEL == 1080x2400 && $PANEL_NAME == sdc-s6e3fc3-p10 && $TOUCH_NAME == "FocalTech FT3658" && $MAP_STORES == 0 ]]' || + fail "panther's TA, panel and touchscreen" grep -c '^ro.hardware=' lib/props.conf >/dev/null && fail "props.conf keeps a phone's ro.hardware" for f in lib/omamobile-tipc-probe lib/omamobile-fp-ctl; do python3 -c 'import ast, sys; ast.parse(open(sys.argv[1]).read())' "$f" || fail "python: $f" done -# both panels keep their allow_lhbm line (the 7 Pro's s6e3hc4, the 9a's tg4c), +# the panels keep their allow_lhbm line (the 7 Pro's s6e3hc4, the 9a's tg4c, +# the 7's s6e3fc3), # read from the file the package ships, so CI checks it without the prebuilts lhbm=vendor/modprobe.d/omamobile-fingerprint-lhbm.conf [[ $(grep -c '^options panel_samsung_s6e3hc4 allow_lhbm=1$' "$lhbm") == 1 ]] || fail "s6e3hc4 allow_lhbm line missing" [[ $(grep -c '^options panel_google_tg4c allow_lhbm=1$' "$lhbm") == 1 ]] || fail "tg4c allow_lhbm line missing" +[[ $(grep -c '^options panel_samsung_s6e3fc3 allow_lhbm=1$' "$lhbm") == 1 ]] || fail "s6e3fc3 allow_lhbm line missing" # The bionic prebuilts are built on the computer with the Android toolchain # and never committed; a checkout without them (CI) checks the rest only. # The resume hook restarts fprintd after a wake, and stands aside where @@ -172,6 +180,7 @@ for f in usr/lib/omamobile-fp/omamobile-fp-chroot usr/lib/omamobile-fp/omamobile usr/lib/omamobile-fp/omamobile-fp-ctl \ usr/lib/omamobile-fp/props.conf usr/lib/omamobile-fp/omamobile-fp-shim.so \ usr/lib/omamobile-fp/props-cheetah.conf usr/lib/omamobile-fp/props-tegu.conf \ + usr/lib/omamobile-fp/props-panther.conf \ usr/lib/omamobile-fp/omamobile-fp-bridge usr/lib/systemd/system/omamobile-fp.service \ usr/lib/systemd/system/fprintd.service.d/omamobile-udfps.conf; do [[ -e $stage/$f ]] || fail "not staged: $f" diff --git a/packages/omamobile-fingerprint/test/preflight b/packages/omamobile-fingerprint/test/preflight index 9d3b0b4b4..2b362c5c5 100755 --- a/packages/omamobile-fingerprint/test/preflight +++ b/packages/omamobile-fingerprint/test/preflight @@ -10,6 +10,9 @@ # a second start -> refused until a reboot (the /run marker) # the TDP copy missing -> refused (and never quietly recreated) # no /ss/0 in persist -> refused +# an empty /ss/0 -> an empty copy, refused once either side changes +# /ss/0 unreadable -> refused: a dump that yields nothing from a +# non-empty or non-regular /ss/0 is not "empty" # the TDP copy changed -> refused # persist:/ss/0 changed -> refused # a writable partition -> refused @@ -48,7 +51,17 @@ phone() { echo "debugfs \$*" >> "$p/debugfs.log" [[ \$1 == -R ]] || exit 1 read -r cmd flag src dst <<<"\$2" -[[ \$cmd == dump && \$flag == -p && \$3 == "$p/dev/sda5" ]] || exit 1 +[[ \$3 == "$p/dev/sda5" ]] || exit 1 +if [[ \$cmd == stat ]]; then + # what stat says, when a case sets it + [[ -f "$p/stat-says" ]] && { cat "$p/stat-says"; exit 0; } + [[ -f "$p/persistfs\$flag" ]] && echo "Inode: 15 Type: regular Mode: 0600" && + echo "User: 1000 Group: 1000 Project: 0 Size: \$(stat -c %s "$p/persistfs\$flag")" + exit 0 +fi +[[ \$cmd == dump && \$flag == -p ]] || exit 1 +# a read error: the dump writes nothing (debugfs still exits 0) +[[ -e "$p/dump-fails" ]] && exit 0 [[ -f "$p/persistfs\$src" ]] && cp "$p/persistfs\$src" "\$dst" exit 0 EOF @@ -108,6 +121,36 @@ pf && fail "no /ss/0 in persist: refused" [[ ! -e $S/provenance && ! -e $marker ]] || fail "nothing recorded without a TDP copy" pass "persist without /ss/0: refused, no TDP copy, no storage start" +# An empty /ss/0 in persist (a TDP stock never committed): an empty copy, +# its hash recorded, and still refused once persist:/ss/0 is no longer empty +phone; : > "$t/p/persistfs/ss/0" +pf || { cat "$t/out"; fail "an empty persist:/ss/0 passes preflight"; } +[[ -f $S/persist-ss/0 && ! -s $S/persist-ss/0 ]] || fail "the TDP copy is the empty file" +[[ $(awk '$2 == "persist-ss/0" {print $1}' "$S/provenance") == "$(sha256sum < /dev/null | cut -d' ' -f1)" ]] || + fail "provenance records the empty file's sha256" +newboot +pf || { cat "$t/out"; fail "the empty TDP copy passes again on the next boot"; } +newboot; echo stock > "$t/p/persistfs/ss/0" +pf && fail "persist:/ss/0 written after an empty copy is refused" +grep -c 'persist:/ss/0 changed' "$t/out" >/dev/null || { cat "$t/out"; fail "says persist:/ss/0 changed"; } +newboot; : > "$t/p/persistfs/ss/0"; echo x > "$S/persist-ss/0" +pf && fail "an empty TDP copy that Linux wrote to is refused" +pass "an empty persist:/ss/0: an empty TDP copy, recorded, refused once either side changes" + +# /ss/0 that can't be read is not an empty /ss/0: the dump yields nothing +# while stat says a regular file of 4096 bytes, or something that isn't a +# regular file. Refused, with no copy and nothing recorded, so a failed read +# never hands Trusty an empty TDP while persist holds a real one. +phone; touch "$t/p/dump-fails" +pf && fail "a non-empty /ss/0 that dumps nothing is refused" +grep -c "can't be read" "$t/out" >/dev/null || { cat "$t/out"; fail "says /ss/0 can't be read"; } +[[ ! -e $S/persist-ss/0 && ! -e $S/provenance && ! -e $marker ]] || fail "no TDP copy and nothing recorded after a failed read" +phone; touch "$t/p/dump-fails"; : > "$t/p/persistfs/ss/0" +printf 'Inode: 15 Type: directory Mode: 0700\nUser: 1000 Group: 1000 Project: 0 Size: 0\n' > "$t/p/stat-says" +pf && fail "a /ss/0 that isn't a regular file is refused" +[[ ! -e $S/persist-ss/0 && ! -e $S/provenance && ! -e $marker ]] || fail "no TDP copy and nothing recorded for a non-regular /ss/0" +pass "an unreadable persist:/ss/0 (4096 bytes dumping nothing, or not a regular file): refused, nothing copied or recorded" + # The TDP copy changed after the record (Linux wrote TDP) phone; pf || fail "setup" newboot; echo x >> "$S/persist-ss/0" diff --git a/packages/omamobile-fingerprint/vendor/modprobe.d/omamobile-fingerprint-lhbm.conf b/packages/omamobile-fingerprint/vendor/modprobe.d/omamobile-fingerprint-lhbm.conf index 96ef4f1c0..ab8dc51e3 100644 --- a/packages/omamobile-fingerprint/vendor/modprobe.d/omamobile-fingerprint-lhbm.conf +++ b/packages/omamobile-fingerprint/vendor/modprobe.d/omamobile-fingerprint-lhbm.conf @@ -5,6 +5,8 @@ # omamobile-fp-bridge turns it on, during a touch on the sensor, and the # panel driver turns it off again after at most 3 s # (device/cheetah/FINGERPRINT-PLAN.md F7; the Pixel 9a's panel in -# device/tegu/FINGERPRINT-PLAN.md F6c-F10). +# device/tegu/FINGERPRINT-PLAN.md F6c-F10; the Pixel 7's panel in +# device/panther/FINGERPRINT-PLAN.md section 4). options panel_samsung_s6e3hc4 allow_lhbm=1 options panel_google_tg4c allow_lhbm=1 +options panel_samsung_s6e3fc3 allow_lhbm=1 diff --git a/packages/omamobile-fingerprint/version b/packages/omamobile-fingerprint/version index c34958a47..04c5555c6 100644 --- a/packages/omamobile-fingerprint/version +++ b/packages/omamobile-fingerprint/version @@ -1 +1 @@ -0.1.15 +0.1.17 diff --git a/tools/extract-fingerprint-vendor b/tools/extract-fingerprint-vendor index e05c2088c..eec9bd40b 100755 --- a/tools/extract-fingerprint-vendor +++ b/tools/extract-fingerprint-vendor @@ -1,8 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: MIT # extract-fingerprint-vendor: build the fingerprint chroot's Android files for -# the Pixel 7 Pro (cheetah) or, with -d tegu, the Pixel 9a out of a Google -# factory image, on the user's own machine. +# the Pixel 7 Pro (cheetah), the Pixel 7 (-d panther) or, with -d tegu, the +# Pixel 9a out of a Google factory image, on the user's own machine. # # Fingerprint on Omarchy Mobile runs Google's own fingerprint HAL against the # Goodix trusted application (g7.app) in Trusty, inside a small chroot @@ -61,7 +61,7 @@ Usage: extract-fingerprint-vendor [-d DEVICE] [-o OUTDIR] [-w WORKDIR] [-f] SOUR SOURCE Google factory zip (DEVICE-*-factory-*.zip) or the image-DEVICE-*.zip inside it - -d NAME cheetah (default) or tegu + -d NAME cheetah (default), panther or tegu -o DIR output directory (default: ./out/fingerprint-vendor) -w DIR scratch directory for vendor.img and system.img, about 2.5 GB (default: a temp dir in \$TMPDIR) @@ -91,7 +91,9 @@ done shift $((OPTIND - 1)) [[ $# -eq 1 ]] || { usage >&2; exit 2; } case $DEVICE in - cheetah) ;; + # The Pixel 7's vendor image ships the 7 Pro's files under the same names + # (device/panther/FINGERPRINT-PLAN.md). + cheetah|panther) ;; tegu) # The Pixel 9a: the same Goodix HAL family against g7a.app, and the Rust # KeyMint (device/tegu/FINGERPRINT-PLAN.md). fp_utils.so and @@ -106,7 +108,7 @@ case $DEVICE in ) VENDOR_FILES=(firmware/g7a.app build.prop) ;; - *) die "unknown device '$DEVICE' (cheetah, tegu)" ;; + *) die "unknown device '$DEVICE' (cheetah, panther, tegu)" ;; esac SRC=$(readlink -f "$1") [[ -f "$SRC" ]] || die "no such file: $1"