From 001d879d5401f4973f8dc6b545ae4235fca04961 Mon Sep 17 00:00:00 2001 From: Marsel Nenaj <201385099+marselnenaj@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:15:18 +0100 Subject: [PATCH 01/66] omamobile-settings 0.1.0: add a native device information foundation Introduce an optional Qt Quick application with searchable, read-only device and software information. Keep navigation, theme observation, desktop launching and the single-instance D-Bus entrypoint together so native settings pages can be contributed independently with their backend contracts. Exercise navigation, atomic theme updates, resource loading, process teardown and the D-Bus entrypoint using neutral data and a private offscreen session. Install QtSvg in CI for the application's declared module and SVG icons. Co-Authored-By: Codex --- .github/workflows/checks.yml | 2 +- packages/omamobile-settings/.gitignore | 4 + packages/omamobile-settings/LICENSE | 21 +++ packages/omamobile-settings/PKGBUILD | 15 ++ packages/omamobile-settings/README.md | 37 +++++ packages/omamobile-settings/app/AboutPage.qml | 87 ++++++++++ packages/omamobile-settings/app/Main.qml | 85 ++++++++++ packages/omamobile-settings/app/backend.cpp | 154 ++++++++++++++++++ packages/omamobile-settings/app/backend.h | 66 ++++++++ packages/omamobile-settings/app/catalog.json | 18 ++ .../app/deviceinfocontroller.cpp | 84 ++++++++++ .../app/deviceinfocontroller.h | 28 ++++ .../omamobile-settings/app/icons/system.svg | 1 + packages/omamobile-settings/app/main.cpp | 68 ++++++++ packages/omamobile-settings/app/resources.qrc | 9 + packages/omamobile-settings/bin/build | 9 + packages/omamobile-settings/install | 12 ++ .../omamobile-settings/omamobile-settings.pro | 9 + .../org.omamobile.Settings.desktop | 10 ++ .../org.omamobile.Settings.svg | 1 + packages/omamobile-settings/test/all | 38 +++++ .../test/single-instance.py | 64 ++++++++ .../omamobile-settings/tests/core_tests.cpp | 110 +++++++++++++ .../omamobile-settings/tests/core_tests.pro | 9 + .../tests/deviceinfo_lifetime_tests.cpp | 46 ++++++ .../tests/deviceinfo_lifetime_tests.pro | 8 + .../omamobile-settings/tests/session_app.pro | 10 ++ packages/omamobile-settings/version | 1 + 28 files changed, 1005 insertions(+), 1 deletion(-) create mode 100644 packages/omamobile-settings/.gitignore create mode 100644 packages/omamobile-settings/LICENSE create mode 100644 packages/omamobile-settings/PKGBUILD create mode 100644 packages/omamobile-settings/README.md create mode 100644 packages/omamobile-settings/app/AboutPage.qml create mode 100644 packages/omamobile-settings/app/Main.qml create mode 100644 packages/omamobile-settings/app/backend.cpp create mode 100644 packages/omamobile-settings/app/backend.h create mode 100644 packages/omamobile-settings/app/catalog.json create mode 100644 packages/omamobile-settings/app/deviceinfocontroller.cpp create mode 100644 packages/omamobile-settings/app/deviceinfocontroller.h create mode 100644 packages/omamobile-settings/app/icons/system.svg create mode 100644 packages/omamobile-settings/app/main.cpp create mode 100644 packages/omamobile-settings/app/resources.qrc create mode 100755 packages/omamobile-settings/bin/build create mode 100755 packages/omamobile-settings/install create mode 100644 packages/omamobile-settings/omamobile-settings.pro create mode 100644 packages/omamobile-settings/org.omamobile.Settings.desktop create mode 100644 packages/omamobile-settings/org.omamobile.Settings.svg create mode 100755 packages/omamobile-settings/test/all create mode 100644 packages/omamobile-settings/test/single-instance.py create mode 100644 packages/omamobile-settings/tests/core_tests.cpp create mode 100644 packages/omamobile-settings/tests/core_tests.pro create mode 100644 packages/omamobile-settings/tests/deviceinfo_lifetime_tests.cpp create mode 100644 packages/omamobile-settings/tests/deviceinfo_lifetime_tests.pro create mode 100644 packages/omamobile-settings/tests/session_app.pro create mode 100644 packages/omamobile-settings/version diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 405ef3d6d..46579b273 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -47,7 +47,7 @@ jobs: run: | pacman -Syu --noconfirm --needed git base-devel e2fsprogs zstd openssl \ python python-dbus python-gobject dbus nodejs dtc cpio file jq busybox \ - xz gzip qt6-declarative shellcheck rsync + xz gzip qt6-declarative qt6-svg shellcheck rsync # Arch's nodejs can lag a simdjson soname bump: on 2026-10-29 # simdjson 5.0.8 dropped the libsimdjson.so.34 that nodejs still # linked, and node no longer started. Only while node can't start, diff --git a/packages/omamobile-settings/.gitignore b/packages/omamobile-settings/.gitignore new file mode 100644 index 000000000..db2d1eb9c --- /dev/null +++ b/packages/omamobile-settings/.gitignore @@ -0,0 +1,4 @@ +/build/ +/pkg/ +/src/ +/*.pkg.tar.* diff --git a/packages/omamobile-settings/LICENSE b/packages/omamobile-settings/LICENSE new file mode 100644 index 000000000..131001a56 --- /dev/null +++ b/packages/omamobile-settings/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Marsel Nenaj + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/omamobile-settings/PKGBUILD b/packages/omamobile-settings/PKGBUILD new file mode 100644 index 000000000..a99e7a27a --- /dev/null +++ b/packages/omamobile-settings/PKGBUILD @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: MIT +pkgname=omamobile-settings +pkgver=$(cat "${startdir:-.}/version") +pkgrel=1 +pkgdesc="Native mobile Settings framework and device information" +arch=(aarch64 x86_64) +url="https://github.com/derekross/omarchy-mobile" +license=(MIT) +depends=(omarchy qt6-base qt6-declarative qt6-svg) +makedepends=(gcc make) +checkdepends=(dbus python) + +build() { "$startdir/bin/build"; } +check() { "$startdir/test/all"; } +package() { "$startdir/install" "$pkgdir"; } diff --git a/packages/omamobile-settings/README.md b/packages/omamobile-settings/README.md new file mode 100644 index 000000000..384b911e5 --- /dev/null +++ b/packages/omamobile-settings/README.md @@ -0,0 +1,37 @@ + +# Native Settings foundation + +A native Qt Quick application with mobile navigation, search, a live Omarchy +palette and a read-only About page. It shows the model, operating system, kernel, +architecture, memory, root-filesystem capacity and installed package versions. +Unknown values remain unavailable. It opens from the desktop launcher. + +This initial package contains the read-only foundation. Omarchy's existing tools +continue to provide settings changes. Network, wallpaper, app management and +recording controls are separate future contributions with their own runtime +contracts and tests; this catalog does not offer those routes. + +Build with `bin/build`, test with `test/all`, and stage with `install DESTDIR`. +Checked-in application sources live in `app/`; `src/` remains makepkg’s +extracted-source directory. +The build and test directories can be selected using +`OMAMOBILE_SETTINGS_BUILD_DIR` and `OMAMOBILE_SETTINGS_TEST_BUILD_DIR`. +`omamobile-settings --check` validates the catalog without opening a window. +`--preview` displays neutral fictional device information; `--page about` opens +the implemented detail page directly. + +The application reads the current theme's colors.toml and observes atomic theme +replacements. Rounded corners follow Hyprland's read-only decoration:rounding +option. It does not change compositor settings. A session D-Bus service handles +repeat launches and exposes a focused-window-only opaque surface palette hint. +That hint contains colors and availability, not device information. + +Copyright 2026 Marsel Nenaj, MIT; see LICENSE. Extracted from the existing native +Settings implementation, with Codex assistance. Omarchy's theme and desktop APIs +remain the work of their upstream authors, including David Heinemeier Hansson; +this package does not claim authorship of those interfaces. + +Tests run the D-Bus entrypoint in a separately compiled fixture which supplies +neutral data through DeviceInfoController's preview constructor. The D-Bus +registration and repeat-launch paths stay unchanged. Tests do not read real +hardware/model paths or run the host's package query. diff --git a/packages/omamobile-settings/app/AboutPage.qml b/packages/omamobile-settings/app/AboutPage.qml new file mode 100644 index 000000000..495a8d924 --- /dev/null +++ b/packages/omamobile-settings/app/AboutPage.qml @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +ScrollView { + id: page + required property var controller + required property var colors + contentWidth: availableWidth + clip: true + function value(key) { return controller.info[key] || qsTr("Unavailable") } + ScrollBar.vertical: ScrollBar { + width: 3; padding: 0; interactive: false + active: page.contentItem.moving; opacity: active ? 0.65 : 0 + contentItem: Rectangle { implicitWidth: 3; radius: 1.5; color: page.colors.muted } + background: Item {} + } + ColumnLayout { + width: page.availableWidth + spacing: 20 + Label { + Layout.fillWidth: true + text: page.value("model") + textFormat: Text.PlainText; wrapMode: Text.Wrap + font.pixelSize: 28; font.weight: Font.DemiBold + color: page.colors.foreground + } + Label { + Layout.fillWidth: true + text: page.value("system") + textFormat: Text.PlainText; wrapMode: Text.Wrap + font.pixelSize: 15; color: page.colors.muted + } + Rectangle { + Layout.fillWidth: true + implicitHeight: storage.implicitHeight + 32 + radius: Math.min(page.colors.radius, width / 2, height / 2) + color: Qt.rgba(page.colors.foreground.r, page.colors.foreground.g, page.colors.foreground.b, 0.045) + ColumnLayout { + id: storage + anchors.fill: parent; anchors.margins: 16 + spacing: 10 + Label { text: qsTr("Storage"); color: page.colors.foreground; font.pixelSize: 17; font.weight: Font.DemiBold } + Label { + Layout.fillWidth: true + text: page.controller.info.storageKnown + ? qsTr("%1 available of %2").arg(page.value("storageFree")).arg(page.value("storageTotal")) + : qsTr("Unavailable") + wrapMode: Text.Wrap; color: page.colors.muted; font.pixelSize: 14 + } + Rectangle { + Layout.fillWidth: true; height: 6; radius: 3 + visible: !!page.controller.info.storageKnown + color: Qt.rgba(page.colors.foreground.r, page.colors.foreground.g, page.colors.foreground.b, 0.10) + Rectangle { + width: parent.width * Math.max(0, Math.min(1, page.controller.info.storageFraction || 0)) + height: parent.height; radius: 3; color: page.colors.accent + } + } + } + } + Repeater { + model: [ + {label: qsTr("Manufacturer"), key: "manufacturer"}, + {label: qsTr("Memory"), key: "memory"}, + {label: qsTr("Architecture"), key: "architecture"}, + {label: qsTr("Kernel"), key: "kernel"}, + {label: qsTr("Omarchy"), key: "omarchyVersion"}, + {label: qsTr("Mobile shell"), key: "shellVersion"}, + {label: qsTr("Settings"), key: "settingsVersion"} + ] + delegate: ColumnLayout { + required property var modelData + Layout.fillWidth: true + spacing: 5 + Label { text: modelData.label; color: page.colors.muted; font.pixelSize: 13 } + Label { + Layout.fillWidth: true + text: page.value(modelData.key) + textFormat: Text.PlainText; wrapMode: Text.Wrap + color: page.colors.foreground; font.pixelSize: 16 + } + } + } + } +} diff --git a/packages/omamobile-settings/app/Main.qml b/packages/omamobile-settings/app/Main.qml new file mode 100644 index 000000000..493253064 --- /dev/null +++ b/packages/omamobile-settings/app/Main.qml @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import QtQuick.Window +ApplicationWindow { + id: window + width: Math.min(420, Screen.width) + height: Math.min(880, Screen.height) + visible: true + title: backend.title + color: backend.background + Material.theme: (backend.background.r * .2126 + backend.background.g * .7152 + backend.background.b * .0722) > .5 ? Material.Light : Material.Dark + Material.accent: backend.accent + Material.background: backend.background + Material.foreground: backend.foreground + function goBack() { + search.focus = false + Qt.inputMethod.hide() + if (backend.searching) search.clear() + backend.back() + } + readonly property bool showingAbout: backend.page === "about" && !backend.searching + Connections { + target: backend + function onCloseRequested() { window.close() } + function onRaiseRequested() { window.show(); window.raise(); window.requestActivate() } + function onPageChanged() { search.text = ""; search.focus = false; Qt.inputMethod.hide(); if (backend.page === "about") deviceInfo.refresh() } + } + Component.onCompleted: if (backend.page === "about") deviceInfo.refresh() + Shortcut { sequence: "Escape"; onActivated: window.goBack() } + ColumnLayout { + anchors.fill: parent; anchors.margins: 20 + spacing: 18 + Button { + visible: backend.page !== "root" || backend.searching + Layout.preferredHeight: 52 + leftPadding: 0; rightPadding: 12 + onClicked: window.goBack() + contentItem: Row { + spacing: 4 + Label { text: "‹"; font.pixelSize: 30; color: backend.foreground } + Label { text: qsTr("Back"); font.pixelSize: 17; color: backend.foreground; anchors.verticalCenter: parent.verticalCenter } + } + background: Rectangle { color: parent.down ? Qt.rgba(backend.foreground.r, backend.foreground.g, backend.foreground.b, 0.06) : "transparent"; radius: Math.min(backend.radius, width / 2, height / 2) } + } + Label { text: backend.title; Layout.fillWidth: true; color: backend.foreground; font.pixelSize: 30; font.weight: Font.DemiBold; wrapMode: Text.Wrap } + TextField { + id: search + objectName: "settingsSearch" + Layout.fillWidth: true; Layout.preferredHeight: 52 + visible: !window.showingAbout + placeholderText: qsTr("Search settings") + color: backend.foreground; placeholderTextColor: backend.muted + onTextEdited: backend.search(text) + background: Rectangle { radius: Math.min(backend.radius, width / 2, height / 2); color: Qt.rgba(backend.foreground.r, backend.foreground.g, backend.foreground.b, 0.06) } + } + AboutPage { visible: window.showingAbout; Layout.fillWidth: true; Layout.fillHeight: true; controller: deviceInfo; colors: backend } + ListView { + id: list + visible: !window.showingAbout + Layout.fillWidth: true; Layout.fillHeight: true + clip: true; model: backend.rows + delegate: ItemDelegate { + required property var modelData + width: list.width; implicitHeight: Math.max(80, copy.implicitHeight + 28) + onClicked: { search.focus = false; Qt.inputMethod.hide(); backend.activate(modelData.id) } + contentItem: RowLayout { + spacing: 14 + Image { source: backend.icon(modelData.icon); sourceSize: Qt.size(24, 24); Layout.preferredWidth: 24; Layout.preferredHeight: 24; Accessible.ignored: true } + ColumnLayout { + id: copy + Layout.fillWidth: true; spacing: 5 + Label { text: modelData.title; color: backend.foreground; font.pixelSize: 17; wrapMode: Text.Wrap; Layout.fillWidth: true } + Label { text: modelData.detail; color: backend.muted; font.pixelSize: 13; wrapMode: Text.Wrap; Layout.fillWidth: true } + } + Label { text: "›"; color: backend.muted; font.pixelSize: 24; Accessible.ignored: true } + } + background: Rectangle { radius: Math.min(backend.radius, width / 2, height / 2); color: parent.down ? Qt.rgba(backend.accent.r, backend.accent.g, backend.accent.b, 0.10) : Qt.rgba(backend.foreground.r, backend.foreground.g, backend.foreground.b, 0.045) } + } + } + } +} diff --git a/packages/omamobile-settings/app/backend.cpp b/packages/omamobile-settings/app/backend.cpp new file mode 100644 index 000000000..55a81c8ff --- /dev/null +++ b/packages/omamobile-settings/app/backend.cpp @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#include "backend.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +Backend::Backend(QObject *parent) : QObject(parent) { + QFile file(":/catalog.json"); + if (file.open(QIODevice::ReadOnly)) + m_catalog = QJsonDocument::fromJson(file.readAll()).object(); + m_themeFile = QDir::homePath() + "/.local/state/omarchy/current/theme/colors.toml"; + connect(&m_watcher, &QFileSystemWatcher::fileChanged, this, &Backend::reloadTheme); + connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &Backend::reloadTheme); + connect(&m_roundingQuery, &QProcess::finished, this, [this](int code, QProcess::ExitStatus status) { + const auto raw = m_roundingQuery.readAllStandardOutput(); + m_roundingQuery.readAllStandardError(); + const auto value = QJsonDocument::fromJson(raw).object()["int"]; + if (code == 0 && status == QProcess::NormalExit && raw.size() <= 4096 + && value.isDouble() && value.toDouble() >= 0 && value.toDouble() == value.toInt()) { + m_radius = value.toInt(); + emit themeChanged(); + } + }); + reloadTheme(); + rebuild(); +} +Backend::~Backend() { + m_roundingQuery.disconnect(this); + if (m_roundingQuery.state() != QProcess::NotRunning) { + m_roundingQuery.kill(); + m_roundingQuery.waitForFinished(1000); + } +} +QString Backend::title() const { + return searching() ? tr("Search settings") : m_catalog[m_page].toObject()["title"].toString(); +} +bool Backend::navigate(const QString &page) { + if (!m_catalog.contains(page)) return false; + if (page != m_page) m_history.append(m_page); + m_page = page; + m_query.clear(); + emit pageChanged(); + rebuild(); + return true; +} +bool Backend::Open(const QString &page) { + if (!navigate(page)) return false; + emit raiseRequested(); + return true; +} +void Backend::search(const QString &query) { + m_query = query.trimmed().left(160); + rebuild(); +} +void Backend::back() { + if (searching()) { search({}); return; } + if (m_history.isEmpty()) { emit closeRequested(); return; } + m_page = m_history.takeLast(); + emit pageChanged(); + rebuild(); +} +void Backend::rebuild() { + m_rows.clear(); + if (!searching()) { + for (const auto &row : m_catalog[m_page].toObject()["rows"].toArray()) + m_rows.append(row.toObject().toVariantMap()); + } else { + for (const auto &page : m_catalog) { + for (const auto &value : page.toObject()["rows"].toArray()) { + const auto row = value.toObject(); + if ((row["title"].toString() + " " + row["detail"].toString()).contains(m_query, Qt::CaseInsensitive)) + m_rows.append(row.toVariantMap()); + } + } + } + emit rowsChanged(); +} +void Backend::activate(const QString &id) { + // IDs resolve only through the currently displayed, source-owned catalog. + for (const auto &value : std::as_const(m_rows)) { + const auto row = value.toMap(); + if (row["id"].toString() == id) { navigate(row["page"].toString()); return; } + } +} +QStringList Backend::catalogProblems() const { + QStringList problems; + if (!m_catalog.contains("root")) problems.append("Missing root page"); + for (auto page = m_catalog.begin(); page != m_catalog.end(); ++page) { + QSet ids; + for (const auto &value : page.value().toObject()["rows"].toArray()) { + const auto row = value.toObject(); + const auto id = row["id"].toString(); + if (id.isEmpty() || ids.contains(id)) problems.append("Duplicate or empty row ID"); + ids.insert(id); + if (row.contains("command") || row.contains("notice") || !m_catalog.contains(row["page"].toString())) + problems.append("Unsupported route"); + } + } + return problems; +} +void Backend::reloadTheme() { + QFile file(m_themeFile); + if (file.open(QIODevice::ReadOnly) && file.size() <= 65536) { + const auto content = QString::fromUtf8(file.readAll()); + auto color = [&content](const QString &key, QColor previous) { + const auto match = QRegularExpression("(?:^|\\n)\\s*" + key + "\\s*=\\s*[\"'](#[0-9a-fA-F]{6})[\"']").match(content); + return match.hasMatch() ? QColor(match.captured(1)) : previous; + }; + m_background = color("background", m_background); + m_foreground = color("foreground", m_foreground); + m_accent = color("accent", m_accent); + m_muted = QColor::fromRgbF(m_foreground.redF() * .78 + m_background.redF() * .22, + m_foreground.greenF() * .78 + m_background.greenF() * .22, + m_foreground.blueF() * .78 + m_background.blueF() * .22); + } + const auto existing = m_watcher.files() + m_watcher.directories(); + for (const auto &path : {m_themeFile, QFileInfo(m_themeFile).absolutePath(), + QDir::homePath() + "/.local/state/omarchy/current"}) + if (QFileInfo::exists(path) && !existing.contains(path)) m_watcher.addPath(path); + if (m_roundingQuery.state() == QProcess::NotRunning) { + const auto generation = ++m_roundingGeneration; + m_roundingQuery.start("/usr/bin/hyprctl", {"-j", "getoption", "decoration:rounding"}); + QTimer::singleShot(1000, &m_roundingQuery, [this, generation] { + if (generation == m_roundingGeneration && m_roundingQuery.state() != QProcess::NotRunning) + m_roundingQuery.kill(); + }); + } + emit themeChanged(); +} +QString Backend::icon(const QString &name) const { + if (!QRegularExpression("^[a-z-]{1,32}$").match(name).hasMatch()) return {}; + QFile file(":/icons/" + name + ".svg"); + if (!file.open(QIODevice::ReadOnly)) return {}; + auto svg = file.readAll(); + svg.replace("#9ece6a", m_accent.name().toUtf8()); + return "data:image/svg+xml;base64," + QString::fromLatin1(svg.toBase64()); +} +QString Backend::SurfacePalette() const { + if (!m_background.isValid() || m_background.alpha() != 255 || !m_window + || !m_window->isVisible() || QGuiApplication::focusWindow() != m_window) + return "{\"version\":1,\"known\":false}"; + const auto color = m_background.name(QColor::HexRgb); + return QString::fromUtf8(QJsonDocument(QJsonObject{ + {"version", 1}, {"known", true}, {"top", color}, {"bottom", color} + }).toJson(QJsonDocument::Compact)); +} diff --git a/packages/omamobile-settings/app/backend.h b/packages/omamobile-settings/app/backend.h new file mode 100644 index 000000000..e81c150f9 --- /dev/null +++ b/packages/omamobile-settings/app/backend.h @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include + +class Backend : public QObject { + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.omamobile.Settings") + Q_PROPERTY(QVariantList rows READ rows NOTIFY rowsChanged) + Q_PROPERTY(QString page READ page NOTIFY rowsChanged) + Q_PROPERTY(QString title READ title NOTIFY rowsChanged) + Q_PROPERTY(bool searching READ searching NOTIFY rowsChanged) + Q_PROPERTY(QColor background READ background NOTIFY themeChanged) + Q_PROPERTY(QColor foreground READ foreground NOTIFY themeChanged) + Q_PROPERTY(QColor accent READ accent NOTIFY themeChanged) + Q_PROPERTY(QColor muted READ muted NOTIFY themeChanged) + Q_PROPERTY(int radius READ radius NOTIFY themeChanged) +public: + explicit Backend(QObject *parent = nullptr); + ~Backend() override; + QVariantList rows() const { return m_rows; } + QString page() const { return m_page; } + QString title() const; + bool searching() const { return !m_query.isEmpty(); } + QColor background() const { return m_background; } + QColor foreground() const { return m_foreground; } + QColor accent() const { return m_accent; } + QColor muted() const { return m_muted; } + int radius() const { return m_radius; } + Q_INVOKABLE bool navigate(const QString &page); + Q_INVOKABLE void search(const QString &query); + Q_INVOKABLE void activate(const QString &id); + Q_INVOKABLE void back(); + Q_INVOKABLE QString icon(const QString &name) const; + Q_INVOKABLE QStringList catalogProblems() const; + Q_SCRIPTABLE bool Open(const QString &page); + Q_SCRIPTABLE QString SurfacePalette() const; + void setSurfaceWindow(QWindow *window) { m_window = window; } +signals: + void rowsChanged(); + void pageChanged(); + void themeChanged(); + void closeRequested(); + void raiseRequested(); +private: + void rebuild(); + void reloadTheme(); + QJsonObject m_catalog; + QVariantList m_rows; + QString m_page = "root", m_query, m_themeFile; + QStringList m_history; + QFileSystemWatcher m_watcher; + QPointer m_window; + QProcess m_roundingQuery; + quint64 m_roundingGeneration = 0; + int m_radius = 0; + QColor m_background = QColor("#1a1b26"), m_foreground = QColor("#c0caf5"), + m_accent = QColor("#9ece6a"), m_muted = QColor("#8b93b8"); +}; diff --git a/packages/omamobile-settings/app/catalog.json b/packages/omamobile-settings/app/catalog.json new file mode 100644 index 000000000..9cd019e4f --- /dev/null +++ b/packages/omamobile-settings/app/catalog.json @@ -0,0 +1,18 @@ +{ + "root": { + "title": "Settings", + "rows": [ + { + "id": "about", + "title": "About this device", + "detail": "System, software and storage", + "icon": "system", + "page": "about" + } + ] + }, + "about": { + "title": "About this device", + "rows": [] + } +} diff --git a/packages/omamobile-settings/app/deviceinfocontroller.cpp b/packages/omamobile-settings/app/deviceinfocontroller.cpp new file mode 100644 index 000000000..fed1da83f --- /dev/null +++ b/packages/omamobile-settings/app/deviceinfocontroller.cpp @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#include "deviceinfocontroller.h" +#include +#include +#include +#include +#include +#include +#include +namespace { +QString readText(const QString &path,int limit=16384) { + QFile file(path);if(!file.open(QIODevice::ReadOnly))return {}; + auto data=file.read(limit+1);if(data.size()>limit)return {}; + data.replace('\0',QByteArray());return QString::fromUtf8(data).trimmed(); +} +QString osName() { + const auto text=readText("/etc/os-release"); + const auto match=QRegularExpression("(?:^|\\n)PRETTY_NAME=(?:\"([^\"\\n]*)\"|([^\\n]*))(?:\\n|$)").match(text); + return match.hasMatch()?(match.captured(1).isEmpty()?match.captured(2):match.captured(1)):QString(); +} +} +QString DeviceInfoController::formatBytes(quint64 bytes) { + if(!bytes)return {}; + const char *units[]={"B","KB","MB","GB","TB"};double value=double(bytes);int unit=0; + while(value>=1000. && unit<4){value/=1000.;++unit;} + return QString::number(value,'f',value>=100. || unit==0?0:1)+" "+units[unit]; +} +DeviceInfoController::DeviceInfoController(bool preview,QObject *parent):QObject(parent),m_preview(preview) { + m_timeout.setSingleShot(true); + connect(&m_timeout,&QTimer::timeout,this,[this]{m_query.kill();}); + connect(&m_query,&QProcess::errorOccurred,this,[this](QProcess::ProcessError){m_timeout.stop();emit changed();}); + connect(&m_query,&QProcess::finished,this,[this](int code,QProcess::ExitStatus status){ + m_timeout.stop();const auto data=m_query.readAllStandardOutput(); + if((code==0 || code==1) && status==QProcess::NormalExit && data.size()<65536) { + for(const auto &line:QString::fromUtf8(data).split('\n')) { + const auto parts=line.split(' ',Qt::SkipEmptyParts);if(parts.size()!=2)continue; + if(parts[0]=="omarchy")m_info["omarchyVersion"]=parts[1]; + else if(parts[0]=="omamobile-settings")m_info["settingsVersion"]=parts[1]; + else if(parts[0]=="omamobile-shell")m_info["shellVersion"]=parts[1]; + } + } + emit changed(); + }); +} +DeviceInfoController::~DeviceInfoController() { + // QProcess can emit finished while its destructor reaps a live query. + // Disconnect before member teardown, while the timer and data still live. + m_timeout.stop(); + m_query.disconnect(this); + if (m_query.state() != QProcess::NotRunning) { + m_query.kill(); + m_query.waitForFinished(1000); + } +} +void DeviceInfoController::refresh() { + if(busy())return; + if(m_preview) { + m_info={{"model","Mobile device"},{"manufacturer","Preview"},{"system","Arch Linux ARM"}, + {"omarchyVersion","Preview"},{"kernel","Linux · Preview"},{"architecture","aarch64"}, + {"memory","8.0 GB"},{"storageTotal","128 GB"},{"storageUsed","24.0 GB"},{"storageFree","104 GB"}, + {"storageFraction",.1875},{"storageKnown",true},{"settingsVersion",QCoreApplication::applicationVersion()},{"shellVersion","Preview"}}; + emit changed();return; + } + QString model=readText("/sys/firmware/devicetree/base/model",512); + if(model.isEmpty())model=readText("/proc/device-tree/model",512); + if(model.isEmpty())model=readText("/sys/devices/virtual/dmi/id/product_name",512); + QString manufacturer=readText("/sys/devices/virtual/dmi/id/sys_vendor",256); + if(manufacturer.isEmpty() && (model.startsWith("Google ") || model.startsWith("Pixel ")))manufacturer="Google"; + const auto memory=QRegularExpression("(?:^|\\n)MemTotal:\\s+([0-9]+) kB").match(readText("/proc/meminfo")); + bool ok=false;const quint64 ram=memory.hasMatch()?memory.captured(1).toULongLong(&ok)*1024:0; + m_info={{"model",model},{"manufacturer",manufacturer},{"system",osName()}, + {"kernel",QSysInfo::kernelVersion()},{"architecture",QSysInfo::currentCpuArchitecture()}, + {"memory",ok?formatBytes(ram):QString()},{"settingsVersion",QCoreApplication::applicationVersion()},{"storageKnown",false}}; + const QStorageInfo disk(QStringLiteral("/")); + if(disk.isValid() && disk.isReady() && disk.bytesTotal()>0 && disk.bytesFree()>=0 && disk.bytesAvailable()>=0 && disk.bytesFree()<=disk.bytesTotal()) { + const auto used=disk.bytesTotal()-disk.bytesFree(); + m_info["storageKnown"]=true;m_info["storageTotal"]=formatBytes(disk.bytesTotal()); + m_info["storageUsed"]=formatBytes(used);m_info["storageFree"]=formatBytes(disk.bytesAvailable()); + m_info["storageFraction"]=double(used)/double(disk.bytesTotal()); + } + emit changed();auto env=QProcessEnvironment::systemEnvironment();env.insert("LC_ALL","C"); + m_query.setProcessEnvironment(env);m_query.start("/usr/bin/pacman",{"-Q","omarchy","omamobile-settings","omamobile-shell"});m_timeout.start(3500);emit changed(); +} diff --git a/packages/omamobile-settings/app/deviceinfocontroller.h b/packages/omamobile-settings/app/deviceinfocontroller.h new file mode 100644 index 000000000..be997d663 --- /dev/null +++ b/packages/omamobile-settings/app/deviceinfocontroller.h @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#pragma once +#include +#include +#include +#include + +class DeviceInfoController : public QObject { + Q_OBJECT + Q_PROPERTY(QVariantMap info READ info NOTIFY changed) + Q_PROPERTY(bool busy READ busy NOTIFY changed) +public: + explicit DeviceInfoController(bool preview = false, QObject *parent = nullptr); + ~DeviceInfoController() override; + QVariantMap info() const { return m_info; } + bool busy() const { return m_query.state()!=QProcess::NotRunning; } + Q_INVOKABLE void refresh(); + static QString formatBytes(quint64 bytes); +signals: + void changed(); +private: + friend class DeviceInfoLifetimeTests; + bool m_preview; + QVariantMap m_info; + QProcess m_query; + QTimer m_timeout; +}; diff --git a/packages/omamobile-settings/app/icons/system.svg b/packages/omamobile-settings/app/icons/system.svg new file mode 100644 index 000000000..2d3713539 --- /dev/null +++ b/packages/omamobile-settings/app/icons/system.svg @@ -0,0 +1 @@ + diff --git a/packages/omamobile-settings/app/main.cpp b/packages/omamobile-settings/app/main.cpp new file mode 100644 index 000000000..40b6ef142 --- /dev/null +++ b/packages/omamobile-settings/app/main.cpp @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#include "backend.h" +#include "deviceinfocontroller.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char **argv) { + bool preview = false, check = false; + QString page = "root"; + for (int i = 1; i < argc; ++i) { + const auto argument = QString::fromLocal8Bit(argv[i]); + if (argument == "--preview") preview = true; + else if (argument == "--check") check = preview = true; + else if (argument == "--page" && i + 1 < argc) page = QString::fromLocal8Bit(argv[++i]); + else { std::fprintf(stderr, "Usage: omamobile-settings [--page PAGE] [--preview] [--check]\n"); return 2; } + } + if (check) qputenv("QT_QPA_PLATFORM", "offscreen"); + QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); + QGuiApplication app(argc, argv); + app.setApplicationName("omamobile-settings"); + app.setApplicationVersion("0.1.0"); + app.setDesktopFileName("org.omamobile.Settings"); + QQuickStyle::setStyle("Material"); + Backend backend; +#ifdef OMAMOBILE_SETTINGS_TEST_DEVICE_INFO + // Only the separately built test entrypoint fixes read-only model data. + DeviceInfoController deviceInfo(true); +#else + DeviceInfoController deviceInfo(preview); +#endif + if (check) { + const auto errors = backend.catalogProblems(); + std::puts(QJsonDocument(QJsonObject{{"ok", errors.isEmpty()}, {"errors", QJsonArray::fromStringList(errors)}}).toJson(QJsonDocument::Compact).constData()); + return errors.isEmpty() ? 0 : 1; + } + if (!backend.catalogProblems().isEmpty() || !backend.navigate(page)) return 2; + if (!preview) { + auto bus = QDBusConnection::sessionBus(); + if (!bus.isConnected()) return 1; + if (!bus.registerService("org.omamobile.Settings")) { + QDBusInterface existing("org.omamobile.Settings", "/Settings", "org.omamobile.Settings", bus); + const auto reply = existing.call("Open", page); + return reply.type() == QDBusMessage::ReplyMessage && reply.arguments().size() == 1 + && reply.arguments().first().metaType().id() == QMetaType::Bool + && reply.arguments().first().toBool() ? 0 : 1; + } + if (!bus.registerObject("/Settings", &backend, QDBusConnection::ExportScriptableSlots + | QDBusConnection::ExportScriptableInvokables)) return 1; + } + QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty("backend", &backend); + engine.rootContext()->setContextProperty("deviceInfo", &deviceInfo); + engine.load(QUrl("qrc:/Main.qml")); + if (engine.rootObjects().isEmpty()) return 1; + backend.setSurfaceWindow(qobject_cast(engine.rootObjects().first())); + return app.exec(); +} diff --git a/packages/omamobile-settings/app/resources.qrc b/packages/omamobile-settings/app/resources.qrc new file mode 100644 index 000000000..d240fb3e6 --- /dev/null +++ b/packages/omamobile-settings/app/resources.qrc @@ -0,0 +1,9 @@ + + + + Main.qml + AboutPage.qml + catalog.json + icons/system.svg + + diff --git a/packages/omamobile-settings/bin/build b/packages/omamobile-settings/bin/build new file mode 100755 index 000000000..9d53be8d7 --- /dev/null +++ b/packages/omamobile-settings/bin/build @@ -0,0 +1,9 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +set -eu +source_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +build_dir=${OMAMOBILE_SETTINGS_BUILD_DIR:-"$source_dir/build"} +mkdir -p "$build_dir" +cd "$build_dir" +qmake6 "$source_dir/omamobile-settings.pro" +make -j1 diff --git a/packages/omamobile-settings/install b/packages/omamobile-settings/install new file mode 100755 index 000000000..9458d0709 --- /dev/null +++ b/packages/omamobile-settings/install @@ -0,0 +1,12 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +set -eu +source_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +dest=${1:?Usage: install ABSOLUTE_DESTDIR} +case "$dest" in /*) ;; *) echo 'Use an absolute staging directory.' >&2; exit 2 ;; esac +[ "$(realpath -m -- "$dest")" != / ] || { echo 'Refusing to stage into the running system.' >&2; exit 1; } +build_dir=${OMAMOBILE_SETTINGS_BUILD_DIR:-"$source_dir/build"} +install -Dm755 "$build_dir/omamobile-settings" "$dest/usr/bin/omamobile-settings" +install -Dm644 "$source_dir/org.omamobile.Settings.desktop" "$dest/usr/share/applications/org.omamobile.Settings.desktop" +install -Dm644 "$source_dir/org.omamobile.Settings.svg" "$dest/usr/share/icons/hicolor/scalable/apps/org.omamobile.Settings.svg" +install -Dm644 "$source_dir/LICENSE" "$dest/usr/share/licenses/omamobile-settings/LICENSE" diff --git a/packages/omamobile-settings/omamobile-settings.pro b/packages/omamobile-settings/omamobile-settings.pro new file mode 100644 index 000000000..6ad4c5b0e --- /dev/null +++ b/packages/omamobile-settings/omamobile-settings.pro @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: MIT +QT += core gui qml quick quickcontrols2 dbus svg +CONFIG += c++17 release no_include_pwd +TEMPLATE = app +TARGET = omamobile-settings +INCLUDEPATH += $$PWD/app +HEADERS += app/backend.h app/deviceinfocontroller.h +SOURCES += app/main.cpp app/backend.cpp app/deviceinfocontroller.cpp +RESOURCES += app/resources.qrc diff --git a/packages/omamobile-settings/org.omamobile.Settings.desktop b/packages/omamobile-settings/org.omamobile.Settings.desktop new file mode 100644 index 000000000..adfa3f0e3 --- /dev/null +++ b/packages/omamobile-settings/org.omamobile.Settings.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=Settings +Comment=System and device information for Omarchy Mobile +Exec=omamobile-settings +Icon=org.omamobile.Settings +Categories=Settings;System; +StartupNotify=true +StartupWMClass=org.omamobile.Settings +Keywords=System;Storage;About; diff --git a/packages/omamobile-settings/org.omamobile.Settings.svg b/packages/omamobile-settings/org.omamobile.Settings.svg new file mode 100644 index 000000000..6211fd4dc --- /dev/null +++ b/packages/omamobile-settings/org.omamobile.Settings.svg @@ -0,0 +1 @@ + diff --git a/packages/omamobile-settings/test/all b/packages/omamobile-settings/test/all new file mode 100755 index 000000000..1d2ca963d --- /dev/null +++ b/packages/omamobile-settings/test/all @@ -0,0 +1,38 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +set -eu +source_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +build_dir=${OMAMOBILE_SETTINGS_TEST_BUILD_DIR:-"$source_dir/build/tests"} +"$source_dir/bin/build" +mkdir -p "$build_dir" +fixture=$(mktemp -d) +trap 'rm -rf -- "$fixture"' EXIT HUP INT TERM +mkdir -p "$fixture/runtime" +chmod 700 "$fixture/runtime" +cd "$build_dir" +qmake6 "$source_dir/tests/core_tests.pro" +make -j1 +HOME="$fixture" XDG_CONFIG_HOME="$fixture/config" XDG_CACHE_HOME="$fixture/cache" \ + XDG_RUNTIME_DIR="$fixture/runtime" QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \ + QT_QPA_PLATFORMTHEME= NO_AT_BRIDGE=1 GSETTINGS_BACKEND=memory ./settings-core-tests + +lifetime="$build_dir/lifetime" +mkdir -p "$lifetime" +( + cd "$lifetime" + qmake6 "$source_dir/tests/deviceinfo_lifetime_tests.pro" + make -j1 + HOME="$fixture" XDG_CONFIG_HOME="$fixture/config" XDG_RUNTIME_DIR="$fixture/runtime" \ + QT_QPA_PLATFORMTHEME= NO_AT_BRIDGE=1 ./settings-deviceinfo-lifetime-tests +) +session="$build_dir/session" +mkdir -p "$session" +( + cd "$session" + qmake6 "$source_dir/tests/session_app.pro" + make -j1 +) +HOME="$fixture" XDG_CONFIG_HOME="$fixture/config" XDG_CACHE_HOME="$fixture/cache" \ + XDG_RUNTIME_DIR="$fixture/runtime" QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \ + QT_QPA_PLATFORMTHEME= NO_AT_BRIDGE=1 GSETTINGS_BACKEND=memory dbus-run-session -- python3 "$source_dir/test/single-instance.py" \ + "$session/settings-session-test-app" diff --git a/packages/omamobile-settings/test/single-instance.py b/packages/omamobile-settings/test/single-instance.py new file mode 100644 index 000000000..0183ead00 --- /dev/null +++ b/packages/omamobile-settings/test/single-instance.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Exercise the application entrypoint with a neutral constructor fixture.""" +import json +import re +import subprocess +import sys +import time + +binary = sys.argv[1] +application = subprocess.Popen( + [binary, '--page', 'about'], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, +) + + +def call(method, *arguments): + return subprocess.run( + ['dbus-send', '--session', '--print-reply=literal', + '--dest=org.omamobile.Settings', '/Settings', + 'org.omamobile.Settings.' + method, *arguments], + capture_output=True, text=True, timeout=2, + ) + + +try: + deadline = time.monotonic() + 5 + while True: + reply = call('Open', 'string:about') + if reply.returncode == 0: + break + if application.poll() is not None or time.monotonic() >= deadline: + raise AssertionError('The private application service did not become ready.') + time.sleep(0.05) + assert re.search(r'\bboolean\s+true\b', reply.stdout) + unknown = call('Open', 'string:nonexistent') + assert unknown.returncode == 0 + assert re.search(r'\bboolean\s+false\b', unknown.stdout) + palette = call('SurfacePalette') + assert palette.returncode == 0 + value = palette.stdout.strip() + start, end = value.find('{'), value.rfind('}') + assert start >= 0 and end > start + decoded = json.loads(value[start:end + 1]) + assert decoded['version'] == 1 and isinstance(decoded['known'], bool) + if decoded['known']: + assert re.fullmatch(r'#[0-9a-fA-F]{6}', decoded['top']) + assert decoded['bottom'] == decoded['top'] + second = subprocess.run( + [binary, '--page', 'about'], + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=5, + ) + assert second.returncode == 0 + assert application.poll() is None + print('PASS private-bus entrypoint Open, route rejection, palette schema and repeat launch') +finally: + if application.poll() is None: + application.terminate() + try: + application.wait(timeout=3) + except subprocess.TimeoutExpired: + application.kill() + application.wait(timeout=3) diff --git a/packages/omamobile-settings/tests/core_tests.cpp b/packages/omamobile-settings/tests/core_tests.cpp new file mode 100644 index 000000000..576fe42d1 --- /dev/null +++ b/packages/omamobile-settings/tests/core_tests.cpp @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#include "backend.h" +#include "deviceinfocontroller.h" +#include +#include +#include +#include +#include +#include +#include +#include + +class CoreTests : public QObject { + Q_OBJECT +private slots: + void initTestCase() { QCoreApplication::setApplicationVersion("0.1.0"); } + void navigationRejectsUnknownAndHiddenActions() { + Backend backend; + QVERIFY(backend.catalogProblems().isEmpty()); + QCOMPARE(backend.rows().size(), 1); + QVERIFY(!backend.navigate("recording")); + backend.activate("arbitrary-command"); + QCOMPARE(backend.page(), QString("root")); + backend.activate("about"); + QCOMPARE(backend.page(), QString("about")); + backend.activate("about"); + QCOMPARE(backend.page(), QString("about")); + backend.back(); + QCOMPARE(backend.page(), QString("root")); + } + void searchHasOnlyImplementedRoutesAndBackClearsIt() { + Backend backend; + backend.search("STORAGE"); + QCOMPARE(backend.rows().size(), 1); + QVERIFY(backend.searching()); + backend.back(); + QVERIFY(!backend.searching()); + backend.search("nonexistent preference"); + QVERIFY(backend.rows().isEmpty()); + backend.activate("about"); + QCOMPARE(backend.page(), QString("root")); + backend.search("About"); + backend.activate("about"); + QCOMPARE(backend.page(), QString("about")); + QVERIFY(!backend.searching()); + } + void iconNamesCannotEscapeResources() { + Backend backend; + QVERIFY(backend.icon("../catalog").isEmpty()); + QVERIFY(backend.icon("unknown").isEmpty()); + QVERIFY(backend.icon("system").startsWith("data:image/svg+xml;base64,")); + } + void atomicThemeReplacementIsObserved() { + const auto directory = QDir::homePath() + "/.local/state/omarchy/current/theme"; + QVERIFY(QDir().mkpath(directory)); + const auto path = directory + "/colors.toml"; + auto save = [&path](const QByteArray &text) { + QSaveFile file(path); + return file.open(QIODevice::WriteOnly) && file.write(text) == text.size() && file.commit(); + }; + QVERIFY(save("background = '#112233'\nforeground = '#eeeeee'\naccent = '#66aa88'\n")); + Backend backend; + QCOMPARE(backend.background(), QColor("#112233")); + QVERIFY(save("background = '#ddeeff'\nforeground = '#112233'\naccent = '#557799'\n")); + QTRY_COMPARE(backend.background(), QColor("#ddeeff")); + QCOMPARE(backend.accent(), QColor("#557799")); + QVERIFY(save("background = 'not-a-color'\n")); + QTest::qWait(100); + QCOMPARE(backend.background(), QColor("#ddeeff")); + } + void neutralPreviewAndUnknownValues() { + DeviceInfoController info(true); + QSignalSpy changed(&info, &DeviceInfoController::changed); + info.refresh(); + QCOMPARE(changed.size(), 1); + QVERIFY(!info.busy()); + QCOMPARE(info.info()["settingsVersion"].toString(), QString("0.1.0")); + QCOMPARE(info.info()["model"].toString(), QString("Mobile device")); + QVERIFY(info.info()["storageKnown"].toBool()); + QVERIFY(DeviceInfoController::formatBytes(0).isEmpty()); + QCOMPARE(DeviceInfoController::formatBytes(1000000000), QString("1.0 GB")); + for (const auto &key : {"serial", "imei", "hostname", "username", "address"}) + QVERIFY(!info.info().contains(key)); + } + void actualWindowAndReadOnlyPalette() { + Backend backend; + DeviceInfoController info(true); + QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty("backend", &backend); + engine.rootContext()->setContextProperty("deviceInfo", &info); + engine.load(QUrl("qrc:/Main.qml")); + QCOMPARE(engine.rootObjects().size(), 1); + auto *window = engine.rootObjects().first(); + auto *search = window->findChild("settingsSearch"); + QVERIFY(search); + search->setProperty("text", "Storage"); + backend.search("Storage"); + QVERIFY(QMetaObject::invokeMethod(window, "goBack")); + QVERIFY(!backend.searching()); + QCOMPARE(search->property("text").toString(), QString()); + QVERIFY(backend.navigate("about")); + QTRY_COMPARE(info.info()["model"].toString(), QString("Mobile device")); + const auto palette = QJsonDocument::fromJson(backend.SurfacePalette().toUtf8()).object(); + QCOMPARE(palette["version"].toInt(), 1); + QCOMPARE(palette["known"].toBool(), false); + } +}; +QTEST_MAIN(CoreTests) +#include "core_tests.moc" diff --git a/packages/omamobile-settings/tests/core_tests.pro b/packages/omamobile-settings/tests/core_tests.pro new file mode 100644 index 000000000..0b1d6ace6 --- /dev/null +++ b/packages/omamobile-settings/tests/core_tests.pro @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: MIT +QT += core gui testlib qml quick quickcontrols2 svg +CONFIG += testcase c++17 console no_include_pwd +TARGET = settings-core-tests +TEMPLATE = app +INCLUDEPATH += ../app +SOURCES += core_tests.cpp ../app/backend.cpp ../app/deviceinfocontroller.cpp +HEADERS += ../app/backend.h ../app/deviceinfocontroller.h +RESOURCES += ../app/resources.qrc diff --git a/packages/omamobile-settings/tests/deviceinfo_lifetime_tests.cpp b/packages/omamobile-settings/tests/deviceinfo_lifetime_tests.cpp new file mode 100644 index 000000000..118bf5061 --- /dev/null +++ b/packages/omamobile-settings/tests/deviceinfo_lifetime_tests.cpp @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#include "deviceinfocontroller.h" +#include +#include +#include +#include + +class DeviceInfoLifetimeTests : public QObject { + Q_OBJECT +private slots: + void activeQueryIsReapedBeforeTimerDestruction() { + QObject observer; + bool timerDestroyed = false; + bool finishedAfterTimerDestroyed = false; + int finished = 0; + auto *controller = new DeviceInfoController(true); + QSignalSpy changed(controller, &DeviceInfoController::changed); + connect(&controller->m_timeout, &QObject::destroyed, &observer, [&] { + timerDestroyed = true; + }); + connect(&controller->m_query, &QProcess::finished, &observer, [&] { + ++finished; + finishedAfterTimerDestroyed = timerDestroyed; + }); + // No controller refresh: the owned child is harmless fixture work. + controller->m_query.start("/usr/bin/python3", {"-c", "import time; time.sleep(5)"}); + QVERIFY(controller->m_query.waitForStarted(1000)); + const auto pid = controller->m_query.processId(); + QVERIFY(pid > 0); + controller->m_timeout.start(3500); + QElapsedTimer elapsed; + elapsed.start(); + delete controller; + QVERIFY(elapsed.elapsed() < 2000); + QVERIFY(timerDestroyed); + QCOMPARE(finished, 1); + QVERIFY(!finishedAfterTimerDestroyed); + QCOMPARE(changed.size(), 0); + errno = 0; + QCOMPARE(::kill(static_cast(pid), 0), -1); + QCOMPARE(errno, ESRCH); + } +}; +QTEST_GUILESS_MAIN(DeviceInfoLifetimeTests) +#include "deviceinfo_lifetime_tests.moc" diff --git a/packages/omamobile-settings/tests/deviceinfo_lifetime_tests.pro b/packages/omamobile-settings/tests/deviceinfo_lifetime_tests.pro new file mode 100644 index 000000000..1211e3dcf --- /dev/null +++ b/packages/omamobile-settings/tests/deviceinfo_lifetime_tests.pro @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT +QT += core testlib +CONFIG += testcase c++17 console no_include_pwd +TARGET = settings-deviceinfo-lifetime-tests +TEMPLATE = app +INCLUDEPATH += ../app +SOURCES += deviceinfo_lifetime_tests.cpp ../app/deviceinfocontroller.cpp +HEADERS += ../app/deviceinfocontroller.h diff --git a/packages/omamobile-settings/tests/session_app.pro b/packages/omamobile-settings/tests/session_app.pro new file mode 100644 index 000000000..122f5991c --- /dev/null +++ b/packages/omamobile-settings/tests/session_app.pro @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: MIT +QT += core gui qml quick quickcontrols2 dbus svg +CONFIG += c++17 release no_include_pwd +TEMPLATE = app +TARGET = settings-session-test-app +INCLUDEPATH += ../app +DEFINES += OMAMOBILE_SETTINGS_TEST_DEVICE_INFO +HEADERS += ../app/backend.h ../app/deviceinfocontroller.h +SOURCES += ../app/main.cpp ../app/backend.cpp ../app/deviceinfocontroller.cpp +RESOURCES += ../app/resources.qrc diff --git a/packages/omamobile-settings/version b/packages/omamobile-settings/version new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/packages/omamobile-settings/version @@ -0,0 +1 @@ +0.1.0 From 7832cc95c18fd178703e36cde1016e5baae4619c Mon Sep 17 00:00:00 2001 From: "Lefteris @SomniusX" Date: Sun, 8 Nov 2026 17:54:25 +0200 Subject: [PATCH 02/66] device/husky: say what slot B reads on Lef's phone, and the DEVICES Boot cell wording (#488) Two optional points from the review of #472, and the record of slot B on Lef's phone. The roadmap dates the marked state: B stayed marked (0x35 read 06) from the local unit's last write until the first flash after the unit was masked on 2026-11-07, when it read 04. Since then a boot spends one of B's tries (retry count 3 after set_active, 2 after one boot), so the flash-before-the-last-try routine applies. slot-successful:b was not read after those flashes; Lef will add it after the next one. The bit is not cleared by hand. The DEVICES Boot cell says Lef's phone, not this phone. Signed-off-by: Lef --- device/husky/ROADMAP.md | 2 +- docs/DEVICES.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device/husky/ROADMAP.md b/device/husky/ROADMAP.md index acbe4a867..93e86a9b4 100644 --- a/device/husky/ROADMAP.md +++ b/device/husky/ROADMAP.md @@ -81,7 +81,7 @@ A proposal, not a verdict; Brett and Derek know the hardware better. - Which microphone id is which hole, and what do the earpiece and headset paths need (#450, #453)? - Why does the phone draw about 0.5 A idle with the screen off, and why did the CPU idle-state and power-domain overlays reboot-loop it? Not known; no measurement plan yet. - In which file shape should the zuma System MMU v9 code and the AoC core port go (asked on #1)? -- Marking slot B successful (a `devinfo` write): decided on [#252](https://github.com/derekross/omarchy-mobile/issues/252) (2026-11-07). It is a manual, attended step, once per install of a smoke-tested image, never from a unit, with per-phone layout evidence first. The boot LUNs get the whole-disk node removed and each partition's own flag set first (its own PR, booted on the maintainer's Pixel 7 Pro), then the marking tool ([#483](https://github.com/derekross/omarchy-mobile/pull/483)). Until both are in nothing marks slot B on the 8 Pro: flash a known-good set before the boot that would use B's last try, and count every deliberate reset as a boot. On Lef's phone a local unit marked it from 2026-11-01 to 2026-11-07, after it ran out of retries once; stopped pending #252. +- Marking slot B successful (a `devinfo` write): decided on [#252](https://github.com/derekross/omarchy-mobile/issues/252) (2026-11-07). It is a manual, attended step, once per install of a smoke-tested image, never from a unit, with per-phone layout evidence first. The boot LUNs get the whole-disk node removed and each partition's own flag set first (its own PR, booted on the maintainer's Pixel 7 Pro), then the marking tool ([#483](https://github.com/derekross/omarchy-mobile/pull/483)). Until both are in nothing marks slot B on the 8 Pro: flash a known-good set before the boot that would use B's last try, and count every deliberate reset as a boot. On Lef's phone a local unit marked it from 2026-11-01 to 2026-11-07, after it ran out of retries once; stopped pending #252. On Lef's phone slot B stayed marked (`devinfo` byte 0x35 read `06`) from the unit's last write until the first flash after the unit was masked on 2026-11-07, when it read `04`. Since then, about a dozen flashes on 2026-11-07 (each followed by `fastboot set_active b`; a `flash`, which also sets B active, clears the bit) have read `slot-retry-count:b` as 3 after `set_active` and 2 after one boot, so a boot spends one of B's tries and the flash-before-the-last-try routine above applies. `slot-successful:b` was not read after those flashes, so "cleared" rests on the retry count and byte 0x35, not on the bootloader's own answer. The bit is not cleared by hand: that would be a `devinfo` write too. - Does touch survive a long idle with the screen off? One 12 h idle on 2026-11-04 left only Power working; not reproduced, not cause-checked. ## Credits and sources diff --git a/docs/DEVICES.md b/docs/DEVICES.md index 6deb59bec..d8fe9294f 100644 --- a/docs/DEVICES.md +++ b/docs/DEVICES.md @@ -26,7 +26,7 @@ The status of each device, as verified on real hardware. Rows in the matrix have | Pixel 4 | flame | SM8150 (Snapdragon 855) | testing (temporary RAM boot; [notes](../device/flame/BRINGUP-M1.md)) | testing (RAM probe; all UFS read-only) | testing (1080x2280 console; software desktop in separate Arch payload) | testing (separate Arch payload; FD640 contexts, llvmpipe desktop) | testing (separate Arch payload; events and PIN unlock verified) | no | testing (NCM + ACM + SSH; sustained transfers can disconnect) | testing (guarded RAM scan; association untested) | no | no | no | no | no | no | - | no | no | no | no | no | no | - | | Pixel 4 XL ([notes](../device/coral/NOTES.md)) | coral | SM8150 (Snapdragon 855) | WIP (direct ABL v2 boot on the test handset's slot A; slot-B install and §3.1 entry pending; [notes](../device/coral/BRINGUP-M1.md)) | testing (read-only `blockdev` guard + RAM `overlayfs`) | testing (1440x3040@60Hz S6E3HC2 DSC 1.1 KMS, DPMS, brightness) | testing (Adreno 640 / FD640 Mesa Freedreno, Hyprland) | testing (FTS SPI multitouch + read-only flash guard) | testing (power via `qcom-pon` + volume via `gpio-keys`) | testing (CDC ECM + ACM + SSH; stays up with host USB switched off) | testing (`WCN3990` `ath10k_snoc` + `rmtfs -r`, WPA2/DHCP/HTTPS; radio sessions ran before the modem baseline) | WIP (`WCN3990` `hci_qca` `hci0` up + BLE scan; audio/pairing open) | WIP (PM8150B ADC `VBAT_SNS` voltage + FG temp; aftermarket pack on test unit: no reply from `1-0036`) | testing (PM8150B SMB5 charger with `4.20 V` / `500 mA` kernel clamp) | testing (`CS40L25A` I2C click waveform) | testing (PM8150L flash LEDs + quick-settings tile) | no | - | testing (QDSP6 + dual `CS35L36` amps capped at `-26 dB` + `IA8508` SPI mic DSP) | testing (`SLPI` + `fastrpc` + RAM-backed `hexagonrpcd` + QMI SSC: 7 sensors + Soli radar) | WIP (`MPSS` boots with `rmtfs -r` + patched `tqftpserv`, SIM detected; no IPA/voice yet; radio sessions ran before the modem baseline) | no | testing (`CAMSS` + `IMX363`, `IMX481`, `IMX520`, dual `OV7251` NIR; `libcamera` softISP) | no | - | | Pixel 9a ([notes](../device/tegu/NOTES.md)) | tegu | zumapro (Tensor G4) | works ([#28](https://github.com/derekross/omarchy-mobile/issues/28): native boot from slot B, the Arch root on `userdata`, `omamobile-device-tegu`; slot B was marked successful by hand on 2026-10-28 with the `devinfo` write approved on 2026-10-22, now on hold ([#125](https://github.com/derekross/omarchy-mobile/pull/125)), unmarked by the 10-31 fastboot recovery and marked again on 2026-10-31 during the hold ([record](../device/tegu/NOTES.md#2026-10-31-a-fastboot-flash-of-slot-b-cleared-its-successful-mark-and-b-was-marked-again)), and the package does not mark it; unpublished kernel: the SoC and board device tree is [kernel #81](https://github.com/derekross/linux-omarchy-mobile/pull/81), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (UFS behind the read-only guard; unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (120 Hz through gs-decon; the panel driver [kernel #89](https://github.com/derekross/linux-omarchy-mobile/pull/89), 120 Hz [kernel #88](https://github.com/derekross/linux-omarchy-mobile/pull/88), merged, the display DT, merged with [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96); brightness, DPMS off and on and the 60/120 Hz switch on the boot of [kernel #125](https://github.com/derekross/linux-omarchy-mobile/pull/125), merged, which also checks the panel's ID; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on), [brightness record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) | works (Panthor, the desktop renders, runtime suspend when idle; this boot runs at a fixed 160 MHz; the GPU's levels and its thermal zone are merged with [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96) ([kernel #85](https://github.com/derekross/linux-omarchy-mobile/pull/85) and [kernel #87](https://github.com/derekross/linux-omarchy-mobile/pull/87) landed through it), not yet run from it; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (Synaptics S3908 over SPI, [kernel #81](https://github.com/derekross/linux-omarchy-mobile/pull/81), merged; survives sleep, [kernel #82](https://github.com/derekross/linux-omarchy-mobile/pull/82), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (gpio-keys: power and volume; the power key wakes from sleep; unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (CDC NCM and SSH; reconnects after a replug, `omamobile-tegu-usb-rescue`, also after a replug the gadget didn't see ([#280](https://github.com/derekross/omarchy-mobile/pull/280); [the replug record](../device/tegu/NOTES.md#2026-10-28-what-the-device-tables-claims-rest-on)); [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (BCM4383 on PCIe channel 1 through the shared gs201 host and zuma PHY, [kernel #178](https://github.com/derekross/linux-omarchy-mobile/pull/178) on [kernel #156](https://github.com/derekross/linux-omarchy-mobile/pull/156), in review, and brcmfmac, [kernel #56](https://github.com/derekross/linux-omarchy-mobile/pull/56) in review; started at boot by `omamobile-device-tegu` 0.2.4 ([#238](https://github.com/derekross/omarchy-mobile/pull/238)) with the extractor's firmware; WPA2 with iwd, kept loaded across sleep by the package's sleep hook; [record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) | works (hci_uart on the bootloader's address, BlueZ, A2DP; [kernel #94](https://github.com/derekross/linux-omarchy-mobile/pull/94); unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (MAX77779 gauge with temperature, current and time estimates through UPower; [kernel #66](https://github.com/derekross/linux-omarchy-mobile/pull/66); unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (the MAX77779 charger binds from the device tree, [kernel #161](https://github.com/derekross/linux-omarchy-mobile/pull/161), merged, built by [#227](https://github.com/derekross/omarchy-mobile/pull/227); the charge limit in `omamobile-device-tegu` 0.2.3 holds charging off at the limit through `charge_behaviour` and lets it run again 5 below; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (CS40L26A through feedbackd, with brownout prevention, [kernel #95](https://github.com/derekross/linux-omarchy-mobile/pull/95); its DT [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (LM3644, 25 steps to 75 mA, quick-settings tile; its DT [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | testing (Omarchy's Location switch serves fixes from GPS, Galileo, BeiDou and GLONASS once the modem is up, started by hand: a 30-minute session through the switch on 2026-11-01 (omamobile-gnss 0.2.5's start, the modem link left to cycle) ran clean, 1763 of 1765 GGA sentences fixed, first fix 37 s after a client connected; needs [kernel #150](https://github.com/derekross/linux-omarchy-mobile/pull/150), merged, the PERIC0 clock fix [kernel #172](https://github.com/derekross/linux-omarchy-mobile/pull/172), merged (without it the modem link hung the palmtop within minutes), and [#114](https://github.com/derekross/omarchy-mobile/pull/114), merged, from whose package build a session in a moving car fixed 145 of 153 times; the GNSS link driver is merged, [kernel #185](https://github.com/derekross/linux-omarchy-mobile/pull/185), loaded by hand with the modem off, and a session through it waits on the modem link; [plan](../device/tegu/MODEM-PLAN.md), record with [#202](https://github.com/derekross/omarchy-mobile/pull/202)) | works (audio and sensor DSP through the GSA and Trusty, 93 services, started at boot by `omamobile-device-tegu` 0.2.3 from the device tree, [kernel #162](https://github.com/derekross/linux-omarchy-mobile/pull/162) in review; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (the TAS2572 amplifiers and the microphone through the AoC card and PipeWire, at boot with the AoC: a tone from the speaker, the microphone at -32 dBFS; speakers at a -10 dB ceiling; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (accelerometer, light, proximity, compass and gyroscope through the AoC and the sensor proxy, at boot with the AoC; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | WIP (registered on LTE, mobile data over `rmnet0`, texts both ways and speakerphone calls in and out with `omamobile-modem-sit` ([#356](https://github.com/derekross/omarchy-mobile/pull/356), [#367](https://github.com/derekross/omarchy-mobile/pull/367)), on the owner's kernel and on in-tree drivers from the open kernel PRs ([kernel #187](https://github.com/derekross/linux-omarchy-mobile/pull/187), [kernel #162](https://github.com/derekross/linux-omarchy-mobile/pull/162)); the package doesn't start the modem, the kernel PRs aren't merged, and calls have no echo cancellation or earpiece yet; [plan](../device/tegu/MODEM-PLAN.md), [record](../device/tegu/MODEM-PLAN.md#sim-test-results-2026-11-02-730-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty)) | works (NXP ST54L through nxp-nci, its clock pad from the PMU ([kernel #104](https://github.com/derekross/linux-omarchy-mobile/pull/104) and [kernel #105](https://github.com/derekross/linux-omarchy-mobile/pull/105), merged, with [kernel #131](https://github.com/derekross/linux-omarchy-mobile/pull/131), merged), loaded at boot by `omamobile-device-tegu` 0.2.3 with neard and the link opener: polls with no I2C errors and read a payment card; polling stops before sleep; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (main, ultrawide and front from the device tree, [kernel #164](https://github.com/derekross/linux-omarchy-mobile/pull/164) in review, with [kernel #63](https://github.com/derekross/linux-omarchy-mobile/pull/63) and [kernel #103](https://github.com/derekross/linux-omarchy-mobile/pull/103) in review: their drivers load at boot with nothing by hand, libcamera lists all three, and each streams, main at 19 fps and the others at 30 fps at 1280x960; basic picture quality through libcamera's software ISP; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | testing (s2idle when asked for, or through the shell's auto-sleep with the `omamobile-sleep` toggle on, which ships off; the power key lights the lock screen on the first press ([#268](https://github.com/derekross/omarchy-mobile/pull/268), [#275](https://github.com/derekross/omarchy-mobile/pull/275)), and the RTC wakes it; on 2026-11-01 thirty attended 120 s sleeps ([plan](../device/tegu/SLEEP-PLAN.md) S1) and a day of real use with auto-sleep on ([record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) all woke, but six test sleeps since 10-28 did not (one in 21 on the clock-fix kernel on 11-01, and one in 127 in an overnight series of 120 s sleeps on 11-01 to 11-02), so sleep tests stay attended ([plan](../device/tegu/SLEEP-PLAN.md) S1); the drain is about 300 mA asleep, the same as awake with the screen off, because nothing below the CPUs sleeps yet; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (opt-in) (enrolls, matches, refuses other fingers and unlocks the lock screen through Trusty and `omamobile-fingerprint`, 2026-10-29; the sensor binds from the device tree, [kernel #165](https://github.com/derekross/linux-omarchy-mobile/pull/165) in review, with [kernel #126](https://github.com/derekross/linux-omarchy-mobile/pull/126), merged; opt-in as on the 7 Pro, because the service's first run writes Trusty's secure storage; [plan](../device/tegu/FINGERPRINT-PLAN.md), [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | -| Pixel 8 Pro ([notes](../device/husky/NOTES.md)) | husky | zuma (Tensor G3) | WIP ([#1](https://github.com/derekross/omarchy-mobile/issues/1): slot B; from 2026-11-01 to 2026-11-07 a local unit marked slot B on this phone; stopped pending [#252](https://github.com/derekross/omarchy-mobile/issues/252); Omarchy's image from the signed repository boots to the lock screen; the zuma device tree is merged ([kernel #13](https://github.com/derekross/linux-omarchy-mobile/pull/13), [#53](https://github.com/derekross/linux-omarchy-mobile/pull/53))) | testing (UFS at HS-G4 behind the read-only guard; Arch on `userdata`; [UFS-PLAN](../device/husky/UFS-PLAN.md)) | WIP (simple-framebuffer with the panel's size, [kernel #154](https://github.com/derekross/linux-omarchy-mobile/pull/154): console and Omarchy's lock screen; 120 Hz with brightness on a test kernel, [kernel #160](https://github.com/derekross/linux-omarchy-mobile/pull/160), started by the device package, [#228](https://github.com/derekross/omarchy-mobile/pull/228)) | testing (panthor on the Mali-G715 on a test kernel, [kernel #157](https://github.com/derekross/linux-omarchy-mobile/pull/157); [ROADMAP](../device/husky/ROADMAP.md)) | works (ST FTM5 over SPI, merged, [kernel #153](https://github.com/derekross/linux-omarchy-mobile/pull/153); verified on both phones, [notes](../device/husky/NOTES.md#2026-10-31-the-touchscreen)) | works (power and volume through `gpio-keys`, merged, [kernel #148](https://github.com/derekross/linux-omarchy-mobile/pull/148); verified on both phones, [notes](../device/husky/NOTES.md#2026-10-30-the-buttons)) | testing (USB and SSH) | testing (BCM4398 on a test kernel, [kernel #156](https://github.com/derekross/linux-omarchy-mobile/pull/156); firmware from the owner's image, [#214](https://github.com/derekross/omarchy-mobile/pull/214); [NOTES](../device/husky/NOTES.md)) | testing (BCM4398D0 on the APM UART, pairing and A2DP, on a test kernel, [kernel #199](https://github.com/derekross/linux-omarchy-mobile/pull/199); firmware from the owner's image; [ROADMAP](../device/husky/ROADMAP.md)) | testing (gauge with Google's ATL model through a bring-up overlay, temperature, MFD, pack EEPROM, [kernel #163](https://github.com/derekross/linux-omarchy-mobile/pull/163) and [#175](https://github.com/derekross/linux-omarchy-mobile/pull/175); the bus on by default waits for [kernel #205](https://github.com/derekross/linux-omarchy-mobile/pull/205); [notes](../device/husky/BATTERY-NOTES.md)) | testing (the charger driver and `tcpci_maxim` as a sink, by hand under a dead-man tool: sink at the Type-C 3 A level (input limit 0xc2 0x13 to 0x77); +1.5 A measured from a 30 W charger without the driver (1.485 A is the device-tree cap); no host mode, [#282](https://github.com/derekross/omarchy-mobile/pull/282); [notes](../device/husky/BATTERY-NOTES.md), [#1](https://github.com/derekross/omarchy-mobile/issues/1#issuecomment-6562547503)) | testing (CS40L26 on a test kernel, [kernel #200](https://github.com/derekross/linux-omarchy-mobile/pull/200)) | testing (LM3644, 50 mA cap, on a test kernel, [kernel #200](https://github.com/derekross/linux-omarchy-mobile/pull/200)) | no (first steps as drafts: [kernel #210](https://github.com/derekross/linux-omarchy-mobile/pull/210), [#211](https://github.com/derekross/linux-omarchy-mobile/pull/211)) | testing (loads and runs through the GSA and Trusty on a test kernel; plan and results [AOC-PLAN](../device/husky/AOC-PLAN.md)) | testing (stereo speakers and one microphone through UCM2 and PipeWire on a test kernel, [kernel #203](https://github.com/derekross/linux-omarchy-mobile/pull/203), [#204](https://github.com/derekross/linux-omarchy-mobile/pull/204), package [#453](https://github.com/derekross/omarchy-mobile/pull/453)) | no | no | testing (a test kernel reads tags; [kernel #208](https://github.com/derekross/linux-omarchy-mobile/pull/208), [#209](https://github.com/derekross/linux-omarchy-mobile/pull/209)) | no | no | no | +| Pixel 8 Pro ([notes](../device/husky/NOTES.md)) | husky | zuma (Tensor G3) | WIP ([#1](https://github.com/derekross/omarchy-mobile/issues/1): slot B; from 2026-11-01 to 2026-11-07 a local unit marked slot B on Lef's phone; stopped pending [#252](https://github.com/derekross/omarchy-mobile/issues/252); Omarchy's image from the signed repository boots to the lock screen; the zuma device tree is merged ([kernel #13](https://github.com/derekross/linux-omarchy-mobile/pull/13), [#53](https://github.com/derekross/linux-omarchy-mobile/pull/53))) | testing (UFS at HS-G4 behind the read-only guard; Arch on `userdata`; [UFS-PLAN](../device/husky/UFS-PLAN.md)) | WIP (simple-framebuffer with the panel's size, [kernel #154](https://github.com/derekross/linux-omarchy-mobile/pull/154): console and Omarchy's lock screen; 120 Hz with brightness on a test kernel, [kernel #160](https://github.com/derekross/linux-omarchy-mobile/pull/160), started by the device package, [#228](https://github.com/derekross/omarchy-mobile/pull/228)) | testing (panthor on the Mali-G715 on a test kernel, [kernel #157](https://github.com/derekross/linux-omarchy-mobile/pull/157); [ROADMAP](../device/husky/ROADMAP.md)) | works (ST FTM5 over SPI, merged, [kernel #153](https://github.com/derekross/linux-omarchy-mobile/pull/153); verified on both phones, [notes](../device/husky/NOTES.md#2026-10-31-the-touchscreen)) | works (power and volume through `gpio-keys`, merged, [kernel #148](https://github.com/derekross/linux-omarchy-mobile/pull/148); verified on both phones, [notes](../device/husky/NOTES.md#2026-10-30-the-buttons)) | testing (USB and SSH) | testing (BCM4398 on a test kernel, [kernel #156](https://github.com/derekross/linux-omarchy-mobile/pull/156); firmware from the owner's image, [#214](https://github.com/derekross/omarchy-mobile/pull/214); [NOTES](../device/husky/NOTES.md)) | testing (BCM4398D0 on the APM UART, pairing and A2DP, on a test kernel, [kernel #199](https://github.com/derekross/linux-omarchy-mobile/pull/199); firmware from the owner's image; [ROADMAP](../device/husky/ROADMAP.md)) | testing (gauge with Google's ATL model through a bring-up overlay, temperature, MFD, pack EEPROM, [kernel #163](https://github.com/derekross/linux-omarchy-mobile/pull/163) and [#175](https://github.com/derekross/linux-omarchy-mobile/pull/175); the bus on by default waits for [kernel #205](https://github.com/derekross/linux-omarchy-mobile/pull/205); [notes](../device/husky/BATTERY-NOTES.md)) | testing (the charger driver and `tcpci_maxim` as a sink, by hand under a dead-man tool: sink at the Type-C 3 A level (input limit 0xc2 0x13 to 0x77); +1.5 A measured from a 30 W charger without the driver (1.485 A is the device-tree cap); no host mode, [#282](https://github.com/derekross/omarchy-mobile/pull/282); [notes](../device/husky/BATTERY-NOTES.md), [#1](https://github.com/derekross/omarchy-mobile/issues/1#issuecomment-6562547503)) | testing (CS40L26 on a test kernel, [kernel #200](https://github.com/derekross/linux-omarchy-mobile/pull/200)) | testing (LM3644, 50 mA cap, on a test kernel, [kernel #200](https://github.com/derekross/linux-omarchy-mobile/pull/200)) | no (first steps as drafts: [kernel #210](https://github.com/derekross/linux-omarchy-mobile/pull/210), [#211](https://github.com/derekross/linux-omarchy-mobile/pull/211)) | testing (loads and runs through the GSA and Trusty on a test kernel; plan and results [AOC-PLAN](../device/husky/AOC-PLAN.md)) | testing (stereo speakers and one microphone through UCM2 and PipeWire on a test kernel, [kernel #203](https://github.com/derekross/linux-omarchy-mobile/pull/203), [#204](https://github.com/derekross/linux-omarchy-mobile/pull/204), package [#453](https://github.com/derekross/omarchy-mobile/pull/453)) | no | no | testing (a test kernel reads tags; [kernel #208](https://github.com/derekross/linux-omarchy-mobile/pull/208), [#209](https://github.com/derekross/linux-omarchy-mobile/pull/209)) | no | no | no | | Pixel 8a ([notes](../device/akita/NOTES.md)) | akita | zuma (Tensor G3) | WIP ([#1](https://github.com/derekross/omarchy-mobile/issues/1): slot B into the initramfs with USB and SSH, no Arch root yet; `reboot-to bootloader` reaches fastboot; the first-light board file is merged, [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192); [BRINGUP-M1](../device/akita/BRINGUP-M1.md), [notes](../device/akita/NOTES.md#2026-11-03-first-light-m13-and-the-console-m14)) | WIP (UFS at HS-G4 behind the read-only guard, from the initramfs only, nothing run on `userdata`; merged, [kernel #206](https://github.com/derekross/linux-omarchy-mobile/pull/206); the device package and storage plan are in review, [#456](https://github.com/derekross/omarchy-mobile/pull/456)) | WIP (simple-framebuffer: the boot console over Omarchy's splash; merged with [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192); [notes](../device/akita/NOTES.md#2026-11-03-first-light-m13-and-the-console-m14)) | no | no | no | testing (USB and SSH from the initramfs; merged with [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192)) | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | | Pixel 7 ([notes](../device/panther/NOTES.md)) | panther | gs201 (Tensor G2) | WIP (slot B, not marked successful; Arch and Hyprland boot; `boot` and `init_boot` carry AVB footers, which a phone whose `vbmeta_b` is stock's needs to start slot B (device-panther 0.1.6, [#396](https://github.com/derekross/omarchy-mobile/pull/396), [notes](../device/panther/NOTES.md#2026-11-02-avb-footers-on-boot-and-init_boot)); `reboot-to bootloader` reaches fastboot with `reboot=warm`, merged, [kernel #198](https://github.com/derekross/linux-omarchy-mobile/pull/198); [BRINGUP-M1](../device/panther/BRINGUP-M1.md); board file merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | testing (UFS behind the read-only guard; Arch on `userdata`; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | WIP (simple-framebuffer: console and the Hyprland desktop; brightness and display off/on over DCS through the S6E3FC3 panel driver and device-panther 0.1.4, merged, [kernel #177](https://github.com/derekross/linux-omarchy-mobile/pull/177); [DISPLAY-PLAN](../device/panther/DISPLAY-PLAN.md)) | testing (Panthor on the Mali-G710; Hyprland renders on it; merged through [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), with the always-on rule in device-panther 0.1.1, [#145](https://github.com/derekross/omarchy-mobile/pull/145); [notes](../device/panther/NOTES.md#2026-10-28-the-gpu-and-the-haptics-power-off-and-usb-after-a-replug)) | WIP (FocalTech FT3658: touches drive Hyprland and unlock the PIN screen on a test kernel; the driver, [kernel #109](https://github.com/derekross/linux-omarchy-mobile/pull/109), and the touch node, [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), are merged; stock's interrupt pull-up and CS delay, [kernel #166](https://github.com/derekross/linux-omarchy-mobile/pull/166), the driver's review fixes, [kernel #133](https://github.com/derekross/linux-omarchy-mobile/pull/133), and the kernel option with the touch notes, [#149](https://github.com/derekross/omarchy-mobile/pull/149), are merged) | testing (gpio-keys: power, volume; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | testing (USB and SSH; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108); a replug comes back through `omamobile-usb-rescue` in device-panther 0.1.3, on the MAX77759's I2C bus, merged, [kernel #167](https://github.com/derekross/linux-omarchy-mobile/pull/167); [notes](../device/panther/NOTES.md#2026-10-29-usb-comes-back-after-a-replug-u1)) | no | testing (BCM4389 on the APM UART through hci_bcm with the phone's own patch, merged, [kernel #196](https://github.com/derekross/linux-omarchy-mobile/pull/196): a BLE mouse drives the shell, and headphones play over A2DP with their AVRCP buttons, on its author's Pixel 7; the Bluetooth address and the rest of the package side aren't merged yet; headset calls, suspend and power not tested) | WIP (MAX77759 fuel gauge with stock's battery model on a test kernel: percentage, capacity and temperature in upower and the bar; merged, [kernel #171](https://github.com/derekross/linux-omarchy-mobile/pull/171) and the driver fix [#170](https://github.com/derekross/linux-omarchy-mobile/pull/170); a second unit's Lishen pack isn't matched by that model yet, [notes](../device/panther/NOTES.md#2026-11-03-a-second-unit-angelrenefm); [BATTERY-PLAN](../device/panther/BATTERY-PLAN.md)) | no | testing (CS40L26 with the phone's own firmware, `tools/extract-vendor-firmware -d panther`; merged through [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), with the feedbackd rule in device-panther 0.1.1, [#145](https://github.com/derekross/omarchy-mobile/pull/145); [notes](../device/panther/NOTES.md#2026-10-28-the-gpu-and-the-haptics-power-off-and-usb-after-a-replug)) | testing (LM3644 rear flash, 36 steps, from the node merged in [kernel #197](https://github.com/derekross/linux-omarchy-mobile/pull/197) and the bring-up overlay `torch.dtso`, [#426](https://github.com/derekross/omarchy-mobile/pull/426): lit on a second Pixel 7; the quick-settings tile not checked) | no | no | no | no | no | no | no (the package's camera start and DMA heap rule are merged, device-panther 0.1.9, [#443](https://github.com/derekross/omarchy-mobile/pull/443), inert until the camera device tree is proposed) | no (s2idle by default since [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134) and device-panther 0.1.1; not run yet) | WIP (the sensor's node, disabled, is merged, [kernel #207](https://github.com/derekross/linux-omarchy-mobile/pull/207); with a bring-up overlay and the package side, which is in review ([#458](https://github.com/derekross/omarchy-mobile/pull/458)), a finger enrolled and unlocked its author's Pixel 7, also after a reboot) | | OnePlus 13 ([notes](../device/dodge/NOTES.md)) | dodge | sm8750 (Snapdragon 8 Elite) | testing (kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [BRINGUP](../device/dodge/BRINGUP-M1.md), [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing ([notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (msm/dpu; warm-boot drop fixed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (Adreno 830 / gpu2; Vulkan untested; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing ([notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing ([notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (CDC NCM + SSH; gadget stuck after replug until reboot; kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (WCN7860 / ath12k; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (pairing; A2DP untested; kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (gauge; charging path not claimed; kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | no | no | no | no | - | testing (speakers, earpiece, mics; headset plug untested; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (accel, prox, compass; autorotate; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (LTE data; calls/SMS untested; opt-in flag; [modem](../device/dodge/modem/README.md), [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | no | no | WIP (s2idle not default; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | no | From 4dcff11bdaff27c62ef4d68a5c0b7aa7215c3a56 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 8 Nov 2026 11:16:03 -0500 Subject: [PATCH 03/66] docs/review: round 44's lessons (L-531 to L-561) (#527) Thirty-one lessons from round 44's reviews, confirmed by the maintainer, plus a second instance of L-454 from #493. #420's and #471's reviews found the same patch-series lesson from either side; it is one entry (L-550). Co-Authored-By: Claude Opus 5.5 --- docs/review/LESSONS.md | 251 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 251 insertions(+) diff --git a/docs/review/LESSONS.md b/docs/review/LESSONS.md index abcf566f3..dd576e70c 100644 --- a/docs/review/LESSONS.md +++ b/docs/review/LESSONS.md @@ -468,6 +468,29 @@ never change, so reviews can cite them. 12 to 17). *Check:* grep the author's comments on the device issue since that date and diff the extent (levels, durations, parts). Extends L-435. *From:* #450, round 42, 2026-11-07. +- **L-531. An isolation check we suggest never reads the node it makes.** + Drafting W5's character-side check for #493 nearly suggested `head -c1` on a + `c 1:1` node, which, if the rule failed, reads physical address 0 through + `/dev/mem`. *Check:* every suggested proof of a device refusal stops at + `mknod` or `open` of a harmless device; `/dev/mem`, `/dev/port` and + register-backed nodes are tested by `mknod` only. Extends AGENTS.md section + 1 and L-454. *From:* #493, round 44 (a near miss in drafting); 2026-11-08. +- **L-532. A measuring tool we name for another phone is read for hard-coded + register addresses first.** `tools/display-hz` `devmem`-reads cheetah's + DECON at `0x1c24xxxx`; suggested for a 9a rate-switch check on kernel #212, + it would have read an unknown zumapro block. *Check:* `grep -n + 'devmem\|0x[0-9a-f]\{8\}' tools/` before a draft names it for a phone + that isn't cheetah; name a log line or a compositor query instead. Extends + L-295 and L-276. *From:* kernel #212, round 44 (a near miss in drafting); + 2026-11-08. +- **L-533. A lens or OIS controller at the same I2C address as the module's + calibration EEPROM is a calibration part.** Stock's tegu DT puts + `eeprom-nessie`, `act-nessie` and `ois-nessie` all at 0x24: the LC898129 + holds the module's calibration. *Check:* grep the device's `*-camera.dtsi` + for nodes sharing the actuator's `i2c-addr`; if one is an EEPROM, the driver + writes only the registers it names, and the notes list every register + written during bring-up. Extends L-90 and L-108. *From:* kernel #213, round + 44, 2026-11-08. ## Shared code and the reference device @@ -874,6 +897,12 @@ never change, so reviews can cite them. *Check:* `gh pr list` for PRs touching the file, grep their heads for `printf`/`strto*`, and build a no-bootctl device's initramfs. Extends L-104 and L-423. *From:* #459 with #403, round 42, 2026-11-07. +- **L-534. A tuning-file change is cheetah-neutral when the file's name is a + sensor model only another board's compatible produces.** libcamera picks + `.yaml` by the subdev name, which `s5kgn1.c` takes from the match + data's `model`. *Check:* the driver's `v4l2_i2c_subdev_set_name` argument, + the match table, and `git grep` of the compatible in the gs201 DTs. Extends + L-206. *From:* #494, round 44, 2026-11-08. ## Shell and scripts @@ -972,6 +1001,9 @@ never change, so reviews can cite them. holds only fakes; a generated-file check reads an input pinned in the repository with its version. Extends L-234 and L-410. *From:* #401, #408, issue #413, round 39, 2026-11-03. + Again in round 44: a "some `c N:*` line exists" pattern on #493 matched + unrelated wildcard lines (`c 5:*`, `c 136:*`); found by deleting the line + under test. - **L-467. `RestartPreventExitStatus=` covers the main process only; a pre-start refusal that must not be retried uses `ExecCondition=`.** #371's `ExecStartPre=` check exited 3 with `RestartPreventExitStatus=3`; on @@ -1053,6 +1085,67 @@ never change, so reviews can cite them. when sitd drops it mid-release, while sitd only drops ended calls. *Check:* list every way the daemon removes the object and the state the bridge is left in. Extends L-302. *From:* #461, round 42, 2026-11-07. +- **L-535. A patch that turns "a touch wakes" into "a touch is swallowed while + dark" changes what a stale dark flag costs.** Before #420's 0029, a lock + whose `displayDark` outlived the dark screen still woke on a touch; after + it, every touch is ignored until the lock's own wake clears the flag. + *Check:* list every path that can light the panel (power key, idle, call + watcher, Hyprland's own DPMS wakes, package version skew) and confirm each + clears the flag (here through `omarchy-shell lock wake`); where a skew can + light it without clearing it, ask for a `conflicts=` between the packages. + Extends L-161 and L-235. *From:* #420, round 44, 2026-11-08. +- **L-536. A guard that reads a display-synced sensor is checked for what the + sensor does with the display off.** omamobile-sensors' TMD3719 converts only + with the display state the HAL sends, the proxy sends "off" when the DSI + connector is off, and it keeps `ProximityNear` across releases, so #420's + pocket guard, claimed only while dark, may never read or may read stale. + *Check:* grep the backend for `DISPLAY_SYNCED` or its equivalent and the + proxy's `_release` before accepting a sensor-based guard, and ask for a + covered and an uncovered run with the panel off. Extends C-1. *From:* #420, + round 44, 2026-11-08. +- **L-537. "Reads the state before it acts" is checked for the time between + the read and the act.** #463's `unlock` reads the lock state, then wakes, + presses Return and waits 2 s before typing the PIN; an unlock in that window + (fingerprint, the person holding the phone) sends the PIN and a Return to + the focused app. *Check:* for any tool that injects input, list the sleeps + and actions between its guard and the sensitive write, and ask for the guard + again right before the write. Extends L-161. *From:* #463, round 44, + 2026-11-08. +- **L-538. A stricter check on a vendor tool's stderr is tried on a real input + with the system tool alone.** #491 started failing a copy on any debugfs + message outside a small allow-list, in a tool every install runs from the + release bundle, and its tests used stand-ins and a synthetic image. *Check:* + run only the host's tool (not the PR's) with the PR's exact command, as the + same user, on a scratch copy of a real image; count the lines the filter + would reject, then delete the copy. *From:* #491, round 44 (0 rejected on + the 7 Pro's 260705 vendor image); 2026-11-08. +- **L-539. A `--dry-run` that still writes local state is walked through every + runbook that pairs it with the real command.** `tools/release` runs + `repo-publish --dry-run stable` and then `stable`. On main the dry run + staged the new index, so the real promotion pruned stable's previous set at + every release (local stable: 45 files for 45 index entries); #492's record + fixes it, though the PR described only no-op dailies. *Check:* `git grep -n + -- '--dry-run' tools/release docs/` for each tool a PR changes, and run the + dry run and the real run back to back in the PR's test fixture. Extends + L-392. *From:* #492, round 44, 2026-11-08. +- **L-540. LXC 7's cgroup2 device rules are one-polarity lists, so "allow + before deny" is not a rule, and a global `a` after our include is the + hazard.** In the default allowlist mode, `bpf_device_add()` drops every + specific deny rule; a global `allow = a` or `deny = a` sets the mode and + clears every earlier rule. Our request on issue #465 and #493's comment both + assumed first-match order. *Check:* for any LXC device rule change, read + `src/lxc/cgroups/cgroup2_devices.c` at the packaged LXC tag, and ask what + mode the list is in, whether any `b` rule allows, and what in the generated + config is processed after our include. Extends L-31 and C-1. *From:* #493 + with issue #465, round 44, 2026-11-08. +- **L-541. A dynamic char major hard-coded in a shipped package couples it to + the kernel's built-in driver set.** Binder's 507 on cheetah comes from the + extended dynamic range, so a kernel update that adds a built-in driver with + a dynamic major moves it, and #493's fail-closed check then takes Waydroid + down until the package changes. *Check:* any `major:minor` in package config + at or above 234 and outside `Documentation/admin-guide/devices.txt`'s fixed + list gets a path-based rule, a value generated at start, or an update plan. + *From:* #493, round 44, 2026-11-08. ## Kernel (linux-omarchy-mobile) @@ -1628,6 +1721,55 @@ never change, so reviews can cite them. arch/arm64/boot/dts` for boards including a touched dtsi; `dt-validate` each on the merge. Extends L-195 and L-309. *From:* kernel #187, round 42, 2026-11-07. +- **L-542. "As Google's driver does" is traced to the end of the vendor + function, including what it does with the answer.** Kernel #194's fallback + follows `syna_tcm_v1_detect()` up to the `IDENTIFY`/`RESET` order, but + `syna_tcm_v1_parse_idinfo()` rejects a zero-length record, so on the unit + that needed the fix the stock driver would fail too: the empty-record path + is our own, and the real difference is probably earlier, in stock's + power-up. *Check:* follow the vendor function past the cited step to its + parse and error returns, and ask which branch the contributor's unit would + take under stock. Extends L-61 and L-77. *From:* kernel #194, round 44, + 2026-11-08. +- **L-543. A panel-ID guard relaxed for a new ID is checked against the byte + the vendor driver keys its commands on, and tested with the commands the + guard blocked.** Google's `tg4c_get_panel_rev()` reads only 0xDB, so kernel + #212's new ID3 gets the same command set; the guard existed for the rate + switch, which the PR hadn't run. *Check:* the vendor driver's + `get_panel_rev`/`read_id` for which ID bytes select commands, then ask for + the guarded paths (rate switch, DPMS) on the new panel. Extends L-117 and + L-211. *From:* kernel #212, round 44, 2026-11-08. +- **L-544. A register map with no public source gets its provenance in the + commit message.** LWIS DTs give a part's address and widths but leave + register sequences to the HAL, so a driver whose registers can't be cited + says how they were found. *Check:* grep Google's GPL tree for each register; + if one is absent, ask. Extends L-61 and L-177. *From:* kernel #213, round + 44, 2026-11-08. +- **L-545. A sentence corrected on one board is grepped across every board + that copied it.** Kernel #214 fixes akita's "the guard runs before the disks + appear" (L-528). The same words are in `zuma-husky.dts` and + `zumapro-tegu.dts`, and UFS is built in for every phone, so they are wrong + there too; only husky's had been noticed. *Check:* when a review corrects + copied text, `git grep -n '' github/omamobile -- arch/ + device/`, and judge each copy by the fact that made the first one wrong + (here `CONFIG_SCSI_UFS_EXYNOS=y` in the shared config). Extends L-528 and + L-257. *From:* kernel #214 with #206, round 44, 2026-11-08. +- **L-546. soc/gs is one tree, so an absent call in a shared driver says + nothing about one SoC.** We nearly told kernel #187's author that zuma has + no secure-ATU SMC because Google's `pcie-exynos-rc.c` has none; that file is + the same on the gs201 branch, where the SMC is real, so it comes from + another driver. *Check:* `cmp` the file across the board branches first, and + find where the vendor actually issues the SMC before saying "SoC X doesn't + use it". Extends L-58 and L-113. *From:* kernel #187, round 44 (a near miss + in drafting); 2026-11-08. +- **L-547. A phone run on a test kernel carries over a new base conflict when + the tested-to-resolved diff equals the base's own movement.** Kernel #187's + `zuma.dtsi` aliases conflicted hours after we said "merges cleanly"; the two + diffs matched exactly, which showed the 7 Pro kernel was still + representative without a rebuild. *Check:* resolve in scratch, compare `git + diff ` with `git diff `, and + grep the difference for any reference-phone path. Extends L-45, L-122 and + L-195. *From:* kernel #187, round 44, 2026-11-08. ## The gates themselves @@ -1982,6 +2124,19 @@ never change, so reviews can cite them. rewrite of a pathspec that behaved the same. *Check:* test what the tool does, and when replacing a filter, compare old and new outputs on real data. Extends L-454. *From:* #289, round 42, 2026-11-07. +- **L-548. CI skips the real-Omarchy run of `omamobile-omarchy`'s patch test, + so a new Omarchy patch is gated only by its author's run.** "the real + Omarchy package # SKIP no omarchy package (OMARCHY_PKG=...)" is in every CI + log. *Check:* apply the series with main's `omamobile-omarchy-patches apply + --root --series /patches` to the matching Omarchy package from the + pacman cache (the shell's files are arch-independent), and `diff -r` the + trees with and without the new patch. Extends L-103. *From:* #420, round 44, + 2026-11-08. +- **L-549. Every PR that adds a suite to `tests/all`'s one-line loop conflicts + with every other such PR.** #491 and #492 each appended to the same line and + comment, and both were green alone. *Check:* `git merge-tree` each open pair + that touches `tests/all`, and give the resolved line in both reviews. + Extends L-104 and L-375. *From:* #491 and #492, round 44, 2026-11-08. ## Reviews and merging @@ -2456,6 +2611,70 @@ never change, so reviews can cite them. shipped that day. *Check:* read what the selector accepts, and plan to replace the pinned files with the rehearsed version. *From:* #471, round 42, 2026-11-07. +- **L-550. A series split, or any rename of a directory, moves every open PR's + new file under the old path into the new meaning of that path.** #471 makes + `patches/` the Omarchy 4.5 family and moves 4.0.6's to `legacy-4.0.6/`; + #420's new `patches/0029-…` (a 4.0.6 patch) then merges into the 4.5 family + with only a `version` conflict, misses every 4.0.6 phone and probably breaks + the 4.5 family's all-or-nothing apply. *Check:* for each open PR that adds + files under a directory another open PR renames or repurposes, simulate the + merge both ways, `git ls-tree` where each new file lands, apply each new + file to the family it was written for, and give the merge order and the move + in both reviews. Extends L-104, L-423, L-424 and L-426. *From:* #420 with + #471, round 44, 2026-11-08. +- **L-551. A version we write into "I'll title it X" goes stale like any other + promise; check it again when merging.** On 11-05 we promised #421 the title + `shell 0.2.101`; #464 shipped 0.2.101 two days later, and the branch's + identical bump would have merged silently. *Check:* before every squash, + `git show origin/main:packages/

/version` and the versions on the open PR + heads (`gh api …/contents/packages/

/version?ref=`), then write the + next free number into the subject. Extends L-217, L-426 and L-480. *From:* + #421, round 44, 2026-11-08. +- **L-552. A sibling's descriptor list that changes between rounds is compared + with the PR's copy.** #456 took the 7 Pro's `NV_BACKUP_EXTRA="devinfo"`. Two + hours after our round asked about akita's NV list, husky's #449 added + `trusty_persist trusty_userdata` on the same SoC, and the reply's new NOTES + list still left `trusty_userdata` out. *Check:* every round, `git log ..origin/main -- packages/omamobile-device-/device.conf device//device.conf`, and diff each key the PR + sets against the sibling's current value. Extends L-195 and L-257. *From:* + #456 with #449, round 44, 2026-11-08. +- **L-553. A fix found in a builder copied from a sibling is checked in the + sibling's builder.** Akita's `build-u3-root` is husky's with the names + changed; the depmod gap #456's second tester found is in both, and only + akita's was fixed. *Check:* `diff <(sed s//X/g A) <(sed s//X/g B)` for + any device script the PR says it copied, then list the sibling's copy for + the maintainer. Extends L-492. *From:* #456, round 44, 2026-11-08. +- **L-554. A promised pre-merge build of a new package is checked against the + state of the output it writes.** With `out/repo` pinned as a release index, + `tools/build-packages` (which iterates `packages/*/`) would have added + #463's packages to it. *Check:* before advising "build it through + build-packages", read the current release state; use `--local ` (its + own `out//` and key) or the publish machine. Extends L-7. *From:* + #463, round 44, 2026-11-08. +- **L-555. "No phone test while phones stay on version X" is checked against + the phones that already left X.** #471's selector applies the 4.5 family to + any phone on Omarchy 4.5.0. #434 records a Pixel 7 Pro that took 4.5.0-3 + before the pin, and pacman won't move it back, so the merge is that phone's + first hardware run of an unqualified series. *Check:* for a selector or gate + keyed on an installed version, grep the pin's issue and the device threads + for phones already past the pin, and plan their first run before publishing. + Extends L-444, L-519 and L-523. *From:* #471, round 44, 2026-11-08. +- **L-556. A stacked PR's conflict can belong to its merged bottom's + commits.** #371's DEVICES.md conflict came from #367's old commits + underneath, and main already held their text. *Check:* before asking the + contributor to resolve, merge only the PR's own range (`git merge-tree + --merge-base= origin/main `), and grep main for the + strings the bottom's commits added. Extends L-275 and L-355. *From:* #371, + round 44, 2026-11-08. +- **L-557. A contributor's "I won't run it until I hear from you" is a hold we + track.** Somnius asked on #472 at 18:04Z, then reported modem power-line + steps on kernel #187 at 22:20Z, in the other repository, with no answer in + between. *Check:* before replying in any thread from that contributor, list + their hardware results posted after the hold, with times (`gh api + repos//issues/comments?since=` in both repositories, filtered + to the user). Extends L-109 and L-124. *From:* kernel #187 with #472, round + 44, 2026-11-08. ## Claims and evidence @@ -3184,6 +3403,38 @@ never change, so reviews can cite them. *Check:* for each result needing `switch_root`, match it to the named command line and slot history. Extends L-28 and L-109. *From:* #445, round 42, 2026-11-07. +- **L-558. A port of a patch series is diffed header by header against the + series it ports, not only applied.** #471's 4.5 family applied with fuzz 0 + and passed every test, yet eight of its 26 headers had lost their + explanation and their spaces ("to4.5auth", "privatepixel.lock"), one of them + carrying the private-lock reference we had asked about twice elsewhere in + the same PR; two of our reviews checked application and blobs and missed it. + *Check:* per patch, compare the header line counts of the two families (`awk + '/^(diff|--- )/{exit}'`), and grep the new headers for `[a-z]4\.[0-9]`, + words over 18 letters, `private` and `coordinator`. Extends L-69 and L-183. + *From:* #471, round 44, 2026-11-08. +- **L-559. A record written as "still X until the owner's next step" is + checked against the owner's other threads since the push.** #488 said Lef's + slot B "is still marked … until his next `flash`"; six hours later the same + author reported a dozen flashes on #252 and #369, with retry counts that + show B unmarked. *Check:* `gh api "repos//issues/comments?since="` filtered to the author, before calling a present-tense state record + ready. Extends L-266 and L-435. *From:* #488, round 44, 2026-11-08. +- **L-560. A follow-up PR that "documents the sources" is checked against each + open question in the thread, not only the values.** #489 moved the existing + "read-only `dd` from recovery" sentence into NOTES, which reads like an + answer to the 11-03 question (RAM boot or flashed? anything mounted + read-write?) but answers neither part. *Check:* list the maintainer's last + questions on the parent PR and find each one's answer in the diff; a + sentence that was already on main isn't an answer. Extends L-183. *From:* + #489 with #231, round 44, 2026-11-08. +- **L-561. A feature whose DT node is in no PR doesn't get a matrix cell that + names only the driver PR.** #494's cell gave kernel #213 "in review" as the + missing piece, but the lens node sat in a notes code block waiting on #164, + so with both merged no buildable kernel had autofocus. *Check:* for every + "in review" a cell cites, list the DT nodes the feature needs and `git grep` + them on the base and the open heads; a node in neither is named in the cell. + Extends L-149 and L-28. *From:* #494, round 44, 2026-11-08. ## Corrections (where a review was wrong) From e7380219d0b7af36cb216a92bba5a73fc444ceec Mon Sep 17 00:00:00 2001 From: kloot Date: Sun, 8 Nov 2026 17:24:33 +0100 Subject: [PATCH 04/66] omamobile.config: swap on zram, and the 9a's zram notes (#515) Build the zram driver as a module, with zstd (Omarchy's algorithm) as the default and lz4 available. Omarchy's settings configure swap on zram on every aarch64 machine (zram-generator, 90-omarchy.conf and the vm.* tuning in 99-omarchy-sysctl.conf), and stock Android runs one on the Pixel 9a (half the RAM), but our kernel has no driver, so a phone has no swap at all. On the 9a (7.4 GB) a cargo build next to Brave and the shell left 177 MB, stalled the session for minutes and ended at the OOM killer, which took the terminal's app scope with it. device/tegu/NOTES.md records the test: with half the RAM as zram, 5 GB more allocated ran without an OOM kill and with SSH answering; with Omarchy's RAM-sized zram, 6 GB more allocated hung the phone until a restart. Stock Android's own setting on the 9a, and how to set it up by hand until the image ships zram-generator, are there too. Nothing changes at boot until something configures a zram device: the modules load only on demand. Co-Authored-By: Claude Opus 5.5 --- device/tegu/NOTES.md | 50 +++++++++++++++++++++++++++++++++ kernel/configs/omamobile.config | 13 +++++++++ 2 files changed, 63 insertions(+) diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index 2d9ae83cd..a762361a1 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -13,6 +13,56 @@ hash/build ID; this dirty release is not a published kernel package. `[V]` marks verified observations; `[I]` marks an inference still to test. Raw captures, recordings, backups and vendor files remain off repository. +## 2026-11-08: swap on zram + +Kernel `7.3.0-rc6-omamobile-push1-ge8d722982099`, a local build, with the +zram options of `kernel/configs/omamobile.config` (set in the device's +`kernel.config` for the test). They build only modules, so `zram.ko` and +`zsmalloc.ko` went onto the running release with `bin/omamobile +modules-push`, without a new boot image. Omarchy 4.0.6 on the phone. + +- [V] **Before:** no swap (`CONFIG_ZRAM` not set; Omarchy 4.0.6 ships no + zram-generator on aarch64). A `cargo build` of squeekboard on the phone, + next to Brave and the shell, left 177 MB available: memory PSI `full` + about 50 %, load 13, the session stuttering and SSH timing out in the + banner exchange. The OOM killer ended `rustc` (1.2 GB anonymous), and + systemd stopped the app scope it ran in, the terminal with it. +- [V] **Setup**, as a newer Omarchy does it on aarch64 (Omarchy v4.5.0): + `zram-generator` 1.2.1 from Arch, Omarchy's `90-omarchy.conf` (zstd, + `swap-priority = 100`) and the `vm.*` lines of its + `99-omarchy-sysctl.conf` (`swappiness=150`, `vfs_cache_pressure=50`, + `page-cluster=0`, the watermark and dirty settings). zram-generator + loads the module itself. +- [V] **`zram-size = ram / 2` (3.6 GB), 5 GB more allocated** on top of + about 4 GB in use: no OOM kill, PSI `full` peaked at 32 % and fell below + 10 %, and SSH answered throughout. zram held 3.2 GB in 1.7 GB; the test + data compresses about 2:1, ordinary app memory closer to 3:1. +- [V] **`zram-size = ram` (Omarchy's default, 7.3 GB), 6 GB more + allocated:** the phone stopped answering, ping included, and came back + after a restart about six minutes later. The journal has no oops or + panic and no OOM kill for this run; its last lines are the CP's PCIe + link going down and brcmfmac failing to allocate RX buffers. [I] RAM ran + out before zram filled, and reclaim spun instead of killing. Not a + like-for-like comparison (5 GB against 6 GB), so this says only that a + RAM-sized zram is not a safe default here yet. +- [V] **Stock Android on the 9a** (BP3A.250905.014 vendor image): + `vendor.zram.size=50p` selects `fstab.zram.50p` (`zramsize=50%`, plus a + 1 GB `zram_backingdev_size` writeback file for idle pages), started at + `sys.boot_completed` by `init.zumapro.board.rc` with `page-cluster 0`; + no swap partition. +- [V] **After the hang:** `tools/nv-backup -d tegu --check`: every NV + partition the same. `omamobile-tegu-modem-boot` refused to start (its + latch for a boot that didn't shut down cleanly), as designed; the modem + came up ONLINE once the logs were read and the latch removed. +- **By hand, until the image ships it:** build with the options, install + `zram-generator`, put `[zram0]` with `zram-size = ram / 2`, + `compression-algorithm = zstd` and `swap-priority = 100` in + `/etc/systemd/zram-generator.conf`, then `systemctl daemon-reload` and + `systemctl start systemd-zram-setup@zram0.service`. `zramctl` and + `swapon --show` show it. Resize only while it is empty: stopping the unit + removes `/dev/zram0`, and `cat /sys/class/zram-control/hot_add` brings + it back. + ## 2026-11-03: the radio backup check with tools/nv-backup - [V] **NV partitions unchanged (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`):** diff --git a/kernel/configs/omamobile.config b/kernel/configs/omamobile.config index f6adc6055..5e9dfd58e 100644 --- a/kernel/configs/omamobile.config +++ b/kernel/configs/omamobile.config @@ -422,3 +422,16 @@ CONFIG_NETFILTER_XT_TARGET_TPROXY=m # Traffic accounting through BPF classifiers (netd's bandwidth controller). CONFIG_NET_CLS_BPF=m CONFIG_NET_ACT_BPF=m + +# Swap on zram. Omarchy's settings set it up on every aarch64 machine +# (zram-generator, default/systemd/zram-generator.conf.d/90-omarchy.conf and +# the vm.* tuning in etc/sysctl.d/99-omarchy-sysctl.conf), and stock Android +# runs one too (half the RAM on the Pixel 9a), but without the driver a phone +# has no swap at all: a Rust build on the 9a (7.4 GB) left 177 MB, stalled +# the session and ended at the OOM killer (device/tegu/NOTES.md, 2026-11-08). +# Modules, loaded by systemd-zram-setup@zram0 when a config asks for a device; +# ZRAM selects ZSMALLOC. zstd is Omarchy's algorithm, lz4 the faster choice. +CONFIG_ZRAM=m +CONFIG_ZRAM_BACKEND_LZ4=y +CONFIG_ZRAM_BACKEND_ZSTD=y +CONFIG_ZRAM_DEF_COMP_ZSTD=y From e65f4dd0befd3af526013c9e19fcdca7523e3183 Mon Sep 17 00:00:00 2001 From: "Lefteris @SomniusX" Date: Sun, 8 Nov 2026 18:25:43 +0200 Subject: [PATCH 05/66] omamobile-remote 0.1.1: the follow-ups from #463 (#513) The follow-ups from the review of #463. `unlock` reads the lock state again right before it types the PIN, so an unlock in the meantime (a fingerprint, the person holding the phone) no longer sends the PIN and a Return to the focused app; the new test fails without that re-check. `help` prints the whole header, the tests run against an empty /proc of their own instead of the host's, the install line in the docs names 0.1.1, and a typo is fixed. Package test: 57 ok. --- docs/REMOTE-TESTING.md | 4 ++-- packages/omamobile-remote/bin/omamobile-remote | 8 ++++++-- packages/omamobile-remote/test/all | 7 +++++++ packages/omamobile-remote/test/fake/wtype | 1 + packages/omamobile-remote/version | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/REMOTE-TESTING.md b/docs/REMOTE-TESTING.md index 5b3a32454..81abd02af 100644 --- a/docs/REMOTE-TESTING.md +++ b/docs/REMOTE-TESTING.md @@ -5,7 +5,7 @@ Most of bringing up a phone is trying things on it: does the speaker play, does ![An agent or script on a computer drives the phone over ssh](screenshots/remote/remote-overview.png) -It is opt-in. `omamobile-remote` and the patched `wlrctl` are in `packages/`, no image installs them, and installing them enables nothing: no service, no udev rule, and nothing listens.. See [Security](#security). +It is opt-in. `omamobile-remote` and the patched `wlrctl` are in `packages/`, no image installs them, and installing them enables nothing: no service, no udev rule, and nothing listens. See [Security](#security). `omamobile-mirror` is the other way in: a VNC window on your computer, with your own mouse and keyboard driving the phone, for demos and for typing. This is for scripts and agents: nothing to watch, no viewer, no open port, and every action and screenshot is a command with an exit code. @@ -14,7 +14,7 @@ It is opt-in. `omamobile-remote` and the patched `wlrctl` are in `packages/`, no On the phone, from the repository built by `tools/build-packages`: ``` -pacman -U wlrctl-0.2.2-1-aarch64.pkg.tar.* omamobile-remote-0.1.0-1-any.pkg.tar.* +pacman -U wlrctl-0.2.2-1-aarch64.pkg.tar.* omamobile-remote-0.1.1-1-any.pkg.tar.* ``` From your computer, an ssh key to the phone's user (USB networking is the easy way: `ssh user@172.16.42.1` on the images that have it). Every command below is run as that user: diff --git a/packages/omamobile-remote/bin/omamobile-remote b/packages/omamobile-remote/bin/omamobile-remote index 869169334..a65904acd 100755 --- a/packages/omamobile-remote/bin/omamobile-remote +++ b/packages/omamobile-remote/bin/omamobile-remote @@ -135,8 +135,8 @@ layer_box() { # x y w h of the on-screen keyboard layer, or nothing cmd=${1:-help} shift || true case $cmd in - help|-h|--help) sed -n '3,28p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; - version) echo "omamobile-remote 0.1.0"; exit 0 ;; + help|-h|--help) sed -n '3,30p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + version) echo "omamobile-remote 0.1.1"; exit 0 ;; esac find_session @@ -236,6 +236,10 @@ case $cmd in [[ -n $pin ]] || die "no PIN: set OMAMOBILE_PIN or pipe it in; it is never taken as an argument" wake; pause 0.5 wtype -k Return; pause 1.5 + # the phone may have been unlocked in the meantime (a fingerprint, or + # whoever holds it): then the PIN and the Return would go to an app + st=$(lock_state) || exit 2 + if [[ $st != true ]]; then unset pin pin_env; echo "unlocked by something else before the PIN was typed; nothing typed"; exit 0; fi printf '%s' "$pin" | wtype -; pause 0.8 wtype -k Return; pause 2 unset pin pin_env diff --git a/packages/omamobile-remote/test/all b/packages/omamobile-remote/test/all index 98f66a4c9..7ce022219 100755 --- a/packages/omamobile-remote/test/all +++ b/packages/omamobile-remote/test/all @@ -13,6 +13,9 @@ check() { local what=$1; shift; if "$@"; then pass "$what"; else fail "$what"; f tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT +# an empty /proc for the scripts, so a real process with the fake pgrep's pid on a build machine is never read +mkdir -p "$tmp/noproc" +export OMAMOBILE_REMOTE_PROC=$tmp/noproc # --- the scripts parse for f in bin/* install test/all test/fake/*; do @@ -109,6 +112,10 @@ check "unlock with a wrong PIN fails" bash -c 'export OMAMOBILE_PIN=0000; ! omam echo true > "$FAKE_STATE/locked" OMAMOBILE_PIN=$FAKE_PIN $R unlock >/dev/null check "unlock with the right PIN unlocks" bash -c '[[ $(cat "$FAKE_STATE/locked") == false ]]' +echo true > "$FAKE_STATE/locked"; touch "$FAKE_STATE/unlock-on-return"; : > "$FAKE_LOG" +out=$(OMAMOBILE_PIN=$FAKE_PIN $R unlock); rc=$? +rm -f "$FAKE_STATE/unlock-on-return" +check "unlock stops without typing when the phone got unlocked after the first Return" bash -c "[[ $rc == 0 ]] && grep -q 'before the PIN' <<<'$out' && ! grep -q 'wtype - ' '$FAKE_LOG'" check "locked exits 1 when unlocked" bash -c '! omamobile-remote locked' check "the PIN is in no log, no journal line and no argument" bash -c '! grep -q "$FAKE_PIN" "$FAKE_LOG" "$FAKE_JOURNAL"' check "run does not pass the PIN on to what it starts" bash -c 'OMAMOBILE_PIN=$FAKE_PIN omamobile-remote run sh -c "echo [\${OMAMOBILE_PIN-unset}]" | grep -q "^\[unset\]$"' diff --git a/packages/omamobile-remote/test/fake/wtype b/packages/omamobile-remote/test/fake/wtype index adf26af67..bb9d0136b 100755 --- a/packages/omamobile-remote/test/fake/wtype +++ b/packages/omamobile-remote/test/fake/wtype @@ -4,5 +4,6 @@ if [[ ${1:-} == - ]]; then typed=$(cat); printf '%s' "$typed" > "$FAKE_STATE/typed"; echo "wtype - (stdin ${#typed} chars)" >> "$FAKE_LOG" else echo "wtype $*" >> "$FAKE_LOG" + if [[ $* == "-k Return" && -f $FAKE_STATE/unlock-on-return ]]; then echo false > "$FAKE_STATE/locked"; fi if [[ $* == "-k Return" && -f $FAKE_STATE/typed && $(cat "$FAKE_STATE/typed") == "$FAKE_PIN" ]]; then echo false > "$FAKE_STATE/locked"; fi fi diff --git a/packages/omamobile-remote/version b/packages/omamobile-remote/version index 6e8bf73aa..17e51c385 100644 --- a/packages/omamobile-remote/version +++ b/packages/omamobile-remote/version @@ -1 +1 @@ -0.1.0 +0.1.1 From e11b15eee0a0ca8845a6586d03fabdcd26228ed2 Mon Sep 17 00:00:00 2001 From: Darek <149845949+aninmucek@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:37:32 +0000 Subject: [PATCH 06/66] omamobile-device-akita 0.1.1: the Trusty partitions for tools/nv-backup, and #456's notes (#509) From the review of #456: - device.conf (and the package's copy): NV_BACKUP_EXTRA adds trusty_persist and trusty_userdata next to devinfo, as husky's package does since #449, so tools/nv-backup --check shows when Android has written Trusty's storage. - NOTES.md: trusty_userdata in the list of per-phone partitions, and the provenance row for the new value. - BRINGUP-M2.md: don't use Suspend in M2.7 until husky's U6; linux-omarchy-mobile#206 spelled out; tools/phone-smoke's report from the M2.6 root (test 18). - ufs-probe.dtso: "If the board file's bootargs change". Co-Authored-By: Claude Opus 5.5 --- device/akita/BRINGUP-M2.md | 11 +++++++---- device/akita/NOTES.md | 6 +++--- device/akita/device.conf | 2 +- device/akita/overlays/ufs-probe.dtso | 5 +++-- packages/omamobile-device-akita/device.conf | 2 +- packages/omamobile-device-akita/version | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/device/akita/BRINGUP-M2.md b/device/akita/BRINGUP-M2.md index 555d430f7..4063d509e 100644 --- a/device/akita/BRINGUP-M2.md +++ b/device/akita/BRINGUP-M2.md @@ -1,7 +1,7 @@ # akita M2: storage (UFS behind the guard, then the Arch root) -**Status (2026-11-07):** M2.1-M2.6 are done; M2.7 waits for the signed package. M1 is complete and merged ([BRINGUP-M1](BRINGUP-M1.md)): +**Status (2026-11-08):** M2.1-M2.6 are done and merged (#456); M2.7 waits for the signed package. M1 is complete and merged ([BRINGUP-M1](BRINGUP-M1.md)): - derekross/linux-omarchy-mobile#192 was rebase-merged on 2026-11-05, so its three commits are on `omamobile` under new ids, with the same patches: `cb2cd5e4b` (binding), `c7eb44543` (first light) and `0e2739a92` (framebuffer). - #414 was squash-merged as `905aa91`. @@ -64,7 +64,7 @@ As in [BRINGUP-M1](BRINGUP-M1.md): `R/` is the private stock capture, `L/` our k 2. **The first UFS boot is read-only and stays in the initramfs.** A bring-up overlay, `device/akita/overlays/ufs-probe.dtso`, sets the board's `bootargs` plus `omamobile.ufs-probe omamobile.initramfs`. That gives the probe listing and no hand-over to Arch, so nothing runs on `userdata`. `DTB_OVERLAYS="ufs-probe"` goes in `device.conf` for that build only, and comes out again afterwards. 3. **Nothing writes before the guard.** UFS is built in, so the disks appear before PID 1. In M2.3 they attached at 0.26 s, and `/init` started at 0.28 s. The init's first job is the guard, which flagged every partition by 0.61 s and removed `/dev/sda`. In between, the kernel only reads the partition tables, and nothing is mounted. `UFS_RW` is unchanged since stage 0. 4. **The fresh backup comes from our kernel.** - - `NV_PARTS="efs efs_backup modem_userdata persist modem_a modem_b"` and `NV_BACKUP_EXTRA="devinfo"` go in the descriptor, cheetah's values. Then `tools/nv-backup -d akita` copies the radio and calibration partitions read-only over SSH, and its `--check` can later show that nothing on Linux changed them. + - `NV_PARTS="efs efs_backup modem_userdata persist modem_a modem_b"` (cheetah's) and `NV_BACKUP_EXTRA="devinfo trusty_persist trusty_userdata"` (husky's since #449) go in the descriptor. M2.4 ran with `devinfo` alone; Trusty's two partitions joined after #456's review. Then `tools/nv-backup -d akita` copies the radio and calibration partitions read-only over SSH. Its `--check` can later show that nothing on Linux changed them, and report when Android has written the extras. - The rest of the stage-0 set is copied the same way, with each partition hashed on the phone and on the laptop. 5. **The device package comes first, in its own PR.** `omamobile-device-akita` starts with husky's generic first set: - the storage rule; @@ -189,7 +189,9 @@ The install needs the human's go, since it erases `userdata` again. - the guard's flags hold; - `reboot-to bootloader` works; - `tools/phone-smoke`'s report goes to the pull request, naming what doesn't apply yet (no GPU or touch driver). -- **Watch for:** the clock. With no RTC driver and no network time, the clock starts early, and gpg can skip a new release key as "created in the future" (husky's U4 finding). Set it from the laptop over ssh before `pacman-key --populate`. +- **Watch for:** + - **The clock.** With no RTC driver and no network time, the clock starts early, and gpg can skip a new release key as "created in the future" (husky's U4 finding). Set it from the laptop over ssh before `pacman-key --populate`. + - **Suspend.** Don't use it in M2.7. The package's drop-in makes Suspend mean s2idle, and that has never run on Tensor G3. It waits for the Pixel 8 Pro's U6, so the session test doesn't turn into a suspend test. - **Risk:** low for the hardware. The trap is the fallback to stock after three boots (above). ## Risks @@ -272,7 +274,7 @@ The UFS change went out as linux-omarchy-mobile#206, signed off by the owner, an ### 2026-11-06: Arch on `userdata`, test image (M2.6, gate d) -- **Kernel:** `7.3.0-rc6-omamobile-push1-g31d8b229d0d0`: #206's head before it merged (`31d8b229d`), built clean with no overlay. Its DTS is blob `bfa8b6f54e0e`, as merged in `75b9c0b73`. +- **Kernel:** `7.3.0-rc6-omamobile-push1-g31d8b229d0d0`: linux-omarchy-mobile#206's head before it merged (`31d8b229d`), built clean with no overlay. Its DTS is blob `bfa8b6f54e0e`, as merged in `75b9c0b73`. - **The test root:** built by `device/akita/build-u3-root` from the Arch Linux ARM base (sha256 `42a4eeaa…`), `omamobile-device-akita` 0.1.0 and this kernel's modules. Its MANIFEST names repository commit `93de3d963c6d`. - **The install:** `tools/install-phone --device akita --rootfs … --bootloader-slots-match akita-17.0-15681527 --reinstall`, run by the owner after a dry run. @@ -283,6 +285,7 @@ The UFS change went out as linux-omarchy-mobile#206, signed off by the owner, an | 15 | The guard under Arch | 62 partitions, exactly `UFS_RW` writable; `sdb`-`sdd` `ro`; no `/dev/sda`. Only `sda34` is mounted (ext4, 107.9 G). The kernel log has no UFS or ext4 error | The guard's flags hold after `switch_root` | | 16 | `bin/omamobile fastboot` from Arch, 282 s into the first boot | `reboot-to bootloader` reached fastboot in 25 s. `getvar`: slot B `slot-successful:no` with 2 tries, slot A unchanged | The reboot mode works from Arch too. `reboot-to` syncs before it resets | | 17 | `fastboot --set-active=b` (B back to 3 tries), then `fastboot reboot` | SSH at 28 s, with systemd `running` 9 s into boot. `systemd-analyze`: 2.0 s kernel and initramfs plus 2.2 s userspace. As before: no failed units, 27 running, the guard's flags, `usb0`, the same four journal lines. ext4 mounted cleanly with no journal replay, and the root wasn't grown again | **Gate (d) passed:** a second boot comes up the same | +| 18 | `tools/phone-smoke` from the laptop, 42 h into that boot (2026-11-08; the report's own date is the phone's clock, July) | Required rows: boot, storage guard (62 partitions, only `UFS_RW` writable), root (ext4 on `userdata`), kernel health (no oops or BUG, 0 WARN), systemd units, USB gadget, all ok; session not ok. Evidence: the display ok (1080x2400 on simpledrm); GPU, lock and touch not ok; buttons, radios, battery, sound, sensors and cameras skip. Its "new dmesg errors" are the two `exynos-clkout` lines, which husky's log has too (H/), but which the tool's known list (the 7 Pro's) doesn't name | As expected for the test root: everything below the session works, and the session rows wait for M2.7's image | Findings: diff --git a/device/akita/NOTES.md b/device/akita/NOTES.md index 614fdbee4..80f355d1f 100644 --- a/device/akita/NOTES.md +++ b/device/akita/NOTES.md @@ -20,10 +20,10 @@ UFS with the storage guard (gate c) and Arch on `userdata` (gate d). The steps a - **The kernel's default sleep is `deep`** [V]: `/sys/power/mem_sleep` reads `s2idle [deep]` under Arch. Linux has no zuma SoC sleep sequence, so `omamobile-device-akita` makes Suspend use `s2idle`, as the Pixel 7 Pro's package does. - **`NV_PARTS` names the radio's partitions only** (the Pixel 7 Pro's list, all present on akita). Other per-phone partitions it doesn't name: - `mfg_data`: factory data, which the Pixel 7 Pro's fingerprint stack reads a copy of ([cheetah's FINGERPRINT-PLAN](../cheetah/FINGERPRINT-PLAN.md)); - - `trusty_persist`: Trusty's persistent storage ([tegu's FINGERPRINT-PLAN](../tegu/FINGERPRINT-PLAN.md)); + - `trusty_persist` and `trusty_userdata`: Trusty's persistent storage ([tegu's FINGERPRINT-PLAN](../tegu/FINGERPRINT-PLAN.md)); - `pinfo`, `fips` and `blenv`, whose contents haven't been read [I]. - None is on `UFS_RW`, so the guard keeps them read-only, and all are in M2.4's full backup. Since stage 0's clean backup, `mfg_data`, `pinfo`, `fips` and `blenv` are unchanged, and `trusty_persist` changed (stock ran) [V]. + None is on `UFS_RW`, so the guard keeps them read-only, and all are in M2.4's full backup. Since stage 0's clean backup, `mfg_data`, `pinfo`, `fips`, `blenv` and `trusty_userdata` are unchanged, and `trusty_persist` changed (stock ran) [V]. The two Trusty partitions are now in `NV_BACKUP_EXTRA`, as on the Pixel 8 Pro, so `tools/nv-backup --check` shows when Android has written Trusty's storage. - **A second retail 8a passed M2.3, M2.4 and M2.6** on the same branch, with the same link, partition map and guard results ([#456](https://github.com/derekross/omarchy-mobile/pull/456)). ## 2026-11-03: first light (M1.3) and the console (M1.4) @@ -126,7 +126,7 @@ The descriptor carries no comments; this table is its provenance. | `VENDOR_PAGESIZE` | 0x800 | [V] | F/ `vendor_boot` and `vendor_kernel_boot` headers | | `OS_VERSION`, `OS_PATCH_LEVEL` | 17.0.0, 2026-10 | [V] | F/ `init_boot` header; the build on both slots (R/) | | `BOOT_IMAGES`, `UFS_RW` | the five boot images; their `_b` names and `userdata` | [V] | R/ `/dev/block/by-name`; F/ | -| `NV_PARTS`, `NV_BACKUP_EXTRA` | `efs efs_backup modem_userdata persist modem_a modem_b`; `devinfo` | [V] | R/ `/dev/block/by-name` has all seven, none on `UFS_RW`. They are cheetah's values: the partitions of AGENTS.md §1's checksum check, plus `devinfo`, whose slot flags change with every flash. They let `tools/nv-backup` back them up read-only from our own kernel ([BRINGUP-M2](BRINGUP-M2.md), M2.4) | +| `NV_PARTS`, `NV_BACKUP_EXTRA` | `efs efs_backup modem_userdata persist modem_a modem_b`; `devinfo trusty_persist trusty_userdata` | [V] | R/ `/dev/block/by-name` has all nine, none on `UFS_RW`. `NV_PARTS` is cheetah's: the partitions of AGENTS.md §1's checksum check. `NV_BACKUP_EXTRA` is husky's (#449): `devinfo`, whose slot flags change with every flash, and Trusty's two partitions, which Android writes (`trusty_persist` changed while stock ran, M2.4). Together they let `tools/nv-backup` back them up read-only from our own kernel ([BRINGUP-M2](BRINGUP-M2.md), M2.4), and `--check` report the extras' changes | | `INITRAMFS_INIT` | the shared init | [V] | as husky | | `PANEL_SIZE` | 1080x2400 | [V] | R/ `dumpsys display`; G/ `zuma-akita-display.dtsi` | | `SIMPLEFB_TRIG_CON` | `0x19470030 0x3061` | [V] | DECON0 `TRIG_CON` read 0x3070 at handover on a booted 8a (2026-11-03, above); 0x3061 unmasks the trigger as on husky (H/), and with it the console reaches the panel (M1.4, above) | diff --git a/device/akita/device.conf b/device/akita/device.conf index 66aa7c5db..d672f94f9 100644 --- a/device/akita/device.conf +++ b/device/akita/device.conf @@ -20,7 +20,7 @@ OS_PATCH_LEVEL=2026-10 BOOT_IMAGES="boot init_boot vendor_boot vendor_kernel_boot dtbo" UFS_RW="boot_b init_boot_b vendor_boot_b vendor_kernel_boot_b dtbo_b userdata" NV_PARTS="efs efs_backup modem_userdata persist modem_a modem_b" -NV_BACKUP_EXTRA="devinfo" +NV_BACKUP_EXTRA="devinfo trusty_persist trusty_userdata" INITRAMFS_INIT=/initramfs/init SIMPLEFB_TRIG_CON="0x19470030 0x3061" PANEL_SIZE=1080x2400 diff --git a/device/akita/overlays/ufs-probe.dtso b/device/akita/overlays/ufs-probe.dtso index ef6a9614a..2b34d9817 100644 --- a/device/akita/overlays/ufs-probe.dtso +++ b/device/akita/overlays/ufs-probe.dtso @@ -9,8 +9,9 @@ * * An overlay replaces bootargs whole, so these are a copy: zuma-akita.dts's * bootargs as of linux-omarchy-mobile#206 (omamobile 75b9c0b73), unchanged - * since the first-light board file (#192). If the board file's change, - * copy them again before reusing this, or the overlay silently reverts them. + * since the first-light board file (#192). If the board file's bootargs + * change, copy them again before reusing this, or the overlay silently + * reverts them. */ /dts-v1/; /plugin/; diff --git a/packages/omamobile-device-akita/device.conf b/packages/omamobile-device-akita/device.conf index 66aa7c5db..d672f94f9 100644 --- a/packages/omamobile-device-akita/device.conf +++ b/packages/omamobile-device-akita/device.conf @@ -20,7 +20,7 @@ OS_PATCH_LEVEL=2026-10 BOOT_IMAGES="boot init_boot vendor_boot vendor_kernel_boot dtbo" UFS_RW="boot_b init_boot_b vendor_boot_b vendor_kernel_boot_b dtbo_b userdata" NV_PARTS="efs efs_backup modem_userdata persist modem_a modem_b" -NV_BACKUP_EXTRA="devinfo" +NV_BACKUP_EXTRA="devinfo trusty_persist trusty_userdata" INITRAMFS_INIT=/initramfs/init SIMPLEFB_TRIG_CON="0x19470030 0x3061" PANEL_SIZE=1080x2400 diff --git a/packages/omamobile-device-akita/version b/packages/omamobile-device-akita/version index 6e8bf73aa..17e51c385 100644 --- a/packages/omamobile-device-akita/version +++ b/packages/omamobile-device-akita/version @@ -1 +1 @@ -0.1.0 +0.1.1 From 25611e96f63a2f3ea09efedefdeac2c696a41124 Mon Sep 17 00:00:00 2001 From: GrendelRTG Date: Sun, 8 Nov 2026 11:37:35 -0500 Subject: [PATCH 07/66] bin/omamobile: pack header-v0 boot images for android-v0 (#507) The OnePlus 6 (enchilada) ABL boots an Android boot image header v0: a gzip kernel with the DTB appended, no dtbo and no vendor_boot. Until now nothing in the tree could make one, so every path refused BOOT_METHOD=android-v0 and the port's first-light image was built by hand. load_device now accepts android-v0 with its own required keys and the six header fields (PAGESIZE, BASE and the offsets), checked as numbers; BOOT_IMAGES must be boot alone and boot_b must be on UFS_RW. images packs boot.img with the pinned mkbootimg.py: gzip -9n of Image with the (overlaid) DTB appended, the shared initramfs as the ramdisk, CMDLINE and the descriptor's offsets. mkdtboimg is only required for android-v4. The port stays RAM-only: fastboot, flash and push refuse android-v0 and point at `fastboot boot`, and the installer still refuses the method, until the slot-B install and its CONTRIBUTING.md 3.1 entry are agreed. Also in device/enchilada/NOTES.md and docs/DEVICES.md, from review on #445 and #432: link the maintainer's decision on restoring stock; say the firewall failure booted from boot_b after --set-active=b; and drop the guess that each rescue boot spends one of slot A's tries (after one more rescue boot A was still at 5 and B at 7). Tested: tests/boot-method (enchilada images reach the kernel check; fastboot, flash, push and both installer modes refuse; bad header fields refused; no phone access) and tests/images-layout, which gains an android-v0 layout test (one boot.img, header v0, page size and load addresses, kernel = gzip Image + DTB, ramdisk = initramfs, deterministic) while the gs201/gs101 baseline still matches 1e7a998 byte for byte. Against the 7.1.0-rc1-sdm845 build used for first light on 2026-11-04, images gives a boot.img byte-identical to the one that was booted then with `fastboot boot` (sha256 78d7bd1a...0d98c). Nothing was sent to the phone for this change. Co-Authored-By: Claude Opus 5.5 --- bin/omamobile | 55 ++++++++++++++++++++++++++++++++++-- device/enchilada/NOTES.md | 25 ++++++++-------- device/enchilada/device.conf | 11 ++++---- docs/DEVICES.md | 4 +-- docs/RELEASES.md | 3 +- tests/boot-method | 32 +++++++++++++++++---- tests/images-layout | 48 ++++++++++++++++++++++++++++++- 7 files changed, 145 insertions(+), 33 deletions(-) diff --git a/bin/omamobile b/bin/omamobile index b43e609ad..7dfcc4561 100755 --- a/bin/omamobile +++ b/bin/omamobile @@ -123,8 +123,8 @@ load_device() { fi done < "$file" case $DEV_BOOT_METHOD in - android-v4|qcom-abl) ;; - *) die "$file: unsupported BOOT_METHOD=$DEV_BOOT_METHOD; this command supports android-v4 and qcom-abl" ;; + android-v4|android-v0|qcom-abl) ;; + *) die "$file: unsupported BOOT_METHOD=$DEV_BOOT_METHOD; this command supports android-v4, android-v0 and qcom-abl" ;; esac [[ $DEV_CODENAME == "$DEVICE" ]] || die "$file: CODENAME=$DEV_CODENAME, expected $DEVICE" # Safety: the guard's allowlist may name slot B's boot images and userdata @@ -143,7 +143,25 @@ load_device() { done [[ $seen_rw == *" userdata "* ]] || die "$file: UFS_RW must include userdata" - if [[ $DEV_BOOT_METHOD == qcom-abl ]]; then + if [[ $DEV_BOOT_METHOD == android-v0 ]]; then + # One header-v0 boot.img: a gzip kernel with the board DTB appended, the + # shared initramfs and CMDLINE, at the load offsets the descriptor gives + # (enchilada). No dtbo, no vendor_boot, no device package needed yet: + # images makes it for `fastboot boot`; flash, push, fastboot and the + # installer refuse it until a slot-B install has a CONTRIBUTING.md §3.1 + # entry. + for key in CODENAME SOC DTB BOOT_IMAGES UFS_RW INITRAMFS_INIT PANEL_SIZE; do + p="DEV_$key" + [[ -n ${!p:-} ]] || die "$file: $key is missing" + done + for key in PAGESIZE BASE KERNEL_OFFSET RAMDISK_OFFSET SECOND_OFFSET TAGS_OFFSET; do + p="DEV_$key" + [[ ${!p:-} =~ ^(0x[0-9a-f]+|[0-9]+)$ ]] || die "$file: $key is missing or not a number" + done + [[ $DEV_PAGESIZE =~ ^(2048|4096|8192|16384)$ ]] || die "$file: PAGESIZE must be 2048, 4096, 8192 or 16384" + [[ $DEV_BOOT_IMAGES == boot ]] || die "$file: android-v0 BOOT_IMAGES may hold only boot" + slot_b_allowed boot || die "$file: boot_b is not in UFS_RW" + elif [[ $DEV_BOOT_METHOD == qcom-abl ]]; then for key in CODENAME SOC PACKAGE DTB BOOT_IMAGES UFS_RW INITRAMFS_INIT PANEL_SIZE; do p="DEV_$key" [[ -n ${!p:-} ]] || die "$file: $key is missing" @@ -781,6 +799,8 @@ cmd_images() { if [[ $DEV_BOOT_METHOD != qcom-abl ]]; then [[ -f $tools/mkbootimg.py ]] || die "no mkbootimg.py in $tools: run tools/fetch-toolchain, or set SRC_DIR to an Android checkout (or MKBOOTIMG_DIR)" + fi + if [[ $DEV_BOOT_METHOD == android-v4 ]]; then [[ -f $MKDTBOIMG ]] || die "no mkdtboimg.py at $MKDTBOIMG: run tools/fetch-toolchain, or set SRC_DIR to an Android checkout (or MKDTBOIMG)" fi @@ -803,6 +823,26 @@ cmd_images() { dtb="$img/$DEV_CODENAME-overlaid.dtb" fi + if [[ $DEV_BOOT_METHOD == android-v0 ]]; then + # This ABL gunzips the kernel and takes the DTB appended to it; the + # ramdisk is the shared initramfs. gzip -n keeps no name or time, so + # the bytes depend only on the inputs. + say "Boot image (header v0, DTB appended to the gzip kernel): $DEV_DTB" + gzip -9 -n -c "$boot/Image" > "$img/Image.gz" + cat "$img/Image.gz" "$dtb" > "$img/Image.gz-dtb" + python3 "$tools/mkbootimg.py" --header_version 0 \ + --kernel "$img/Image.gz-dtb" --ramdisk "$KERNEL_OUT/initramfs.cpio.lz4" \ + --cmdline "${DEV_CMDLINE:-}" --pagesize "$DEV_PAGESIZE" --base "$DEV_BASE" \ + --kernel_offset "$DEV_KERNEL_OFFSET" --ramdisk_offset "$DEV_RAMDISK_OFFSET" \ + --second_offset "$DEV_SECOND_OFFSET" --tags_offset "$DEV_TAGS_OFFSET" \ + --output "$img/boot.img" || die "mkbootimg failed" + rm -f "$img/Image.gz" + printf '%s\n' "$DEV_CODENAME" > "$img/DEVICE" + ls -lh "$img"/*.img + sha256sum "$img/boot.img" + return 0 + fi + say "Kernel: Image.lz4" lz4 -l -9 -f -q "$boot/Image" "$img/Image.lz4" @@ -1058,6 +1098,10 @@ cmd_fastboot() { # Qualcomm ABL panic path is uncharacterized on dodge (sysrq-c fallthrough # when reboot-to bootloader is ignored). Refuse before any phone I/O; use # the buttons instead (see device/$DEVICE/BRINGUP-M1.md). + # android-v0 (enchilada): no slot-B install yet, so a crash here would + # land on whatever the phone's other slot holds; use the buttons. + [[ $DEV_BOOT_METHOD != android-v0 ]] || + die "fastboot refuses BOOT_METHOD=android-v0 (RAM-only: reach fastboot by the buttons, see device/$DEVICE/NOTES.md)" [[ $DEV_BOOT_METHOD != qcom-abl ]] || die "fastboot refuses BOOT_METHOD=qcom-abl (panic path uncharacterized on this ABL; use the buttons — see device/$DEVICE/BRINGUP-M1.md)" in_fastboot && { say "Already in fastboot"; return 0; } @@ -1093,6 +1137,9 @@ cmd_flash() { # successful and refill retries; the bit-54 mark has no §3.1 entry yet. # Refuse here; day-2 updates use push once that path is viable, and the # installer PR can reopen flash with the rest. + # android-v0: RAM-only until a slot-B install has its §3.1 entry + [[ $DEV_BOOT_METHOD != android-v0 ]] || + die "flash refuses BOOT_METHOD=android-v0 (RAM-only: fastboot boot \$KERNEL_OUT/images/boot.img)" [[ $DEV_BOOT_METHOD != qcom-abl ]] || die "flash refuses BOOT_METHOD=qcom-abl (no in-tree day-2 update path yet; see device/$DEVICE/BRINGUP-M1.md)" images_for_device "$img" @@ -1130,6 +1177,8 @@ cmd_push() { # Same class of refusal as flash: boot_b is on sde here, and there is no # in-tree day-2 rewrite path for qcom-abl yet. Refuse before any phone I/O # (modules-push would otherwise rewrite the running root's modules). + [[ $DEV_BOOT_METHOD != android-v0 ]] || + die "push refuses BOOT_METHOD=android-v0 (RAM-only: fastboot boot \$KERNEL_OUT/images/boot.img)" [[ $DEV_BOOT_METHOD != qcom-abl ]] || die "push refuses BOOT_METHOD=qcom-abl (no in-tree day-2 update path yet; see device/$DEVICE/BRINGUP-M1.md)" images_for_device "$img" diff --git a/device/enchilada/NOTES.md b/device/enchilada/NOTES.md index 5e9723616..96e8deb34 100644 --- a/device/enchilada/NOTES.md +++ b/device/enchilada/NOTES.md @@ -29,8 +29,8 @@ tried yet; it is next. **Slot A does not hold stock Android.** This is a §3.1 event, recorded here as the maintainer asked on #432. Putting stock back on slot A is -outside the project: this tree only writes slot B and `userdata`, and -never `vbmeta`. If it is done, it is the owner's own step, with +outside the project ([the maintainer's decision on #432](https://github.com/derekross/omarchy-mobile/issues/432#issuecomment-6708103355)): +this tree only writes slot B and `userdata`, and never `vbmeta`. If it is done, it is the owner's own step, with OnePlus's own images, and it is recorded on #432 (slot flags before and after, what was flashed and from which image, then a fresh read-only radio backup). The owner has decided not to restore it, so @@ -66,30 +66,27 @@ three steps of 2026-11-05: that reply was posted at 16:13 (21:13 UTC), and `flash boot_b` (netfilter kernel), `--set-active=a` and the package install into `userdata` ran from 16:15 to about 16:20, before I had read it. Since then the only commands sent to the phone have been the read-only -backup, one `fastboot boot` (2026-11-05 16:35) and `getvar` (below). No +backup, one `fastboot boot` (2026-11-05 16:35), `getvar` and one rescue +boot to read the slot flags again (below). No slot flag is written again until this phone has a per-device entry in CONTRIBUTING.md. -**Slot flags** (`fastboot getvar all`, read-only): +**Slot flags** (read-only; `fastboot getvar all`, except the last row): | Read | `current-slot` | A: successful / unbootable / retry-count | B: successful / unbootable / retry-count | | --- | --- | --- | --- | | 2026-11-04, before any write of this port | a | no / no / 6 | yes / no / 7 | -| 2026-11-07, now | a | no / no / 5 | no / no / 7 | +| 2026-11-07 | a | no / no / 5 | no / no / 7 | +| 2026-11-07, after one more rescue boot, read in the rescue from `sde`'s GPT attributes (`sfdisk --dump`) | a | no / no / 5 | no / no / 7 | Between the two reads, B lost its successful mark (left by the third-party build; `--set-active=b` clears it and nothing of this port marks a slot) and A's retry count went from 6 to 5. Neither slot is marked unbootable. -Slot A is not marked successful, so each boot of the rescue may spend one -of its tries. If ABL works as on other Qualcomm phones, `--set-active=a` -on 2026-11-05 reset A's count to 7, and the rescue boots since (including -the reboot after a `fastboot boot` panics with no USB host) took it to 5. -At 0 ABL would switch to slot B and run B's tries down too, and since -nothing here may mark a slot, the phone would then stop in fastboot and -need a `--set-active` to come back. This is not confirmed yet: one more -`getvar` after the next rescue boot will tell. Until then, rescue boots -are kept few. +Slot A is not marked successful, but a rescue boot does not spend one of +its tries here: after one more rescue boot A was still at 5 and B at 7 +([#432](https://github.com/derekross/omarchy-mobile/issues/432#issuecomment-6716747930)). What took A from 6 to 5 between the first two reads is not +known. Neither slot is near 0. **The slot-A rescue.** It is not the shared init and has no initramfs (an empty ramdisk): the kernel mounts `system_a` from the `root=` that ABL diff --git a/device/enchilada/device.conf b/device/enchilada/device.conf index 40d415f20..a9e0e4d0c 100644 --- a/device/enchilada/device.conf +++ b/device/enchilada/device.conf @@ -4,12 +4,11 @@ # # RAM-only bring-up: this ABL boots an Android boot image header v0 holding # a gzip kernel with the DTB appended (no dtbo, no vendor_boot), booted with -# `fastboot boot`, so nothing is written. No packer in this tree makes that -# image yet, so images, flash, push and the installer all refuse -# BOOT_METHOD=android-v0 before touching a phone (tests/boot-method). The -# header-v0 packer is a separate change; flash, push and the installer keep -# refusing it until the slot-B install and its CONTRIBUTING.md §3.1 entry -# are agreed. +# `fastboot boot`, so nothing is written. `omamobile images` packs that +# boot.img from the header fields below (tests/images-layout); fastboot, +# flash, push and the installer refuse BOOT_METHOD=android-v0 before +# touching a phone (tests/boot-method), and keep refusing it until the +# slot-B install and its CONTRIBUTING.md §3.1 entry are agreed. # # Storage: userdata is on sda, but boot_* sit on LUN sde, so the shared # init's sda-only guard keeps boot_b read-only (the same split as dodge). diff --git a/docs/DEVICES.md b/docs/DEVICES.md index d8fe9294f..0fdb1739c 100644 --- a/docs/DEVICES.md +++ b/docs/DEVICES.md @@ -30,7 +30,7 @@ The status of each device, as verified on real hardware. Rows in the matrix have | Pixel 8a ([notes](../device/akita/NOTES.md)) | akita | zuma (Tensor G3) | WIP ([#1](https://github.com/derekross/omarchy-mobile/issues/1): slot B into the initramfs with USB and SSH, no Arch root yet; `reboot-to bootloader` reaches fastboot; the first-light board file is merged, [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192); [BRINGUP-M1](../device/akita/BRINGUP-M1.md), [notes](../device/akita/NOTES.md#2026-11-03-first-light-m13-and-the-console-m14)) | WIP (UFS at HS-G4 behind the read-only guard, from the initramfs only, nothing run on `userdata`; merged, [kernel #206](https://github.com/derekross/linux-omarchy-mobile/pull/206); the device package and storage plan are in review, [#456](https://github.com/derekross/omarchy-mobile/pull/456)) | WIP (simple-framebuffer: the boot console over Omarchy's splash; merged with [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192); [notes](../device/akita/NOTES.md#2026-11-03-first-light-m13-and-the-console-m14)) | no | no | no | testing (USB and SSH from the initramfs; merged with [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192)) | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | | Pixel 7 ([notes](../device/panther/NOTES.md)) | panther | gs201 (Tensor G2) | WIP (slot B, not marked successful; Arch and Hyprland boot; `boot` and `init_boot` carry AVB footers, which a phone whose `vbmeta_b` is stock's needs to start slot B (device-panther 0.1.6, [#396](https://github.com/derekross/omarchy-mobile/pull/396), [notes](../device/panther/NOTES.md#2026-11-02-avb-footers-on-boot-and-init_boot)); `reboot-to bootloader` reaches fastboot with `reboot=warm`, merged, [kernel #198](https://github.com/derekross/linux-omarchy-mobile/pull/198); [BRINGUP-M1](../device/panther/BRINGUP-M1.md); board file merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | testing (UFS behind the read-only guard; Arch on `userdata`; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | WIP (simple-framebuffer: console and the Hyprland desktop; brightness and display off/on over DCS through the S6E3FC3 panel driver and device-panther 0.1.4, merged, [kernel #177](https://github.com/derekross/linux-omarchy-mobile/pull/177); [DISPLAY-PLAN](../device/panther/DISPLAY-PLAN.md)) | testing (Panthor on the Mali-G710; Hyprland renders on it; merged through [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), with the always-on rule in device-panther 0.1.1, [#145](https://github.com/derekross/omarchy-mobile/pull/145); [notes](../device/panther/NOTES.md#2026-10-28-the-gpu-and-the-haptics-power-off-and-usb-after-a-replug)) | WIP (FocalTech FT3658: touches drive Hyprland and unlock the PIN screen on a test kernel; the driver, [kernel #109](https://github.com/derekross/linux-omarchy-mobile/pull/109), and the touch node, [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), are merged; stock's interrupt pull-up and CS delay, [kernel #166](https://github.com/derekross/linux-omarchy-mobile/pull/166), the driver's review fixes, [kernel #133](https://github.com/derekross/linux-omarchy-mobile/pull/133), and the kernel option with the touch notes, [#149](https://github.com/derekross/omarchy-mobile/pull/149), are merged) | testing (gpio-keys: power, volume; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | testing (USB and SSH; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108); a replug comes back through `omamobile-usb-rescue` in device-panther 0.1.3, on the MAX77759's I2C bus, merged, [kernel #167](https://github.com/derekross/linux-omarchy-mobile/pull/167); [notes](../device/panther/NOTES.md#2026-10-29-usb-comes-back-after-a-replug-u1)) | no | testing (BCM4389 on the APM UART through hci_bcm with the phone's own patch, merged, [kernel #196](https://github.com/derekross/linux-omarchy-mobile/pull/196): a BLE mouse drives the shell, and headphones play over A2DP with their AVRCP buttons, on its author's Pixel 7; the Bluetooth address and the rest of the package side aren't merged yet; headset calls, suspend and power not tested) | WIP (MAX77759 fuel gauge with stock's battery model on a test kernel: percentage, capacity and temperature in upower and the bar; merged, [kernel #171](https://github.com/derekross/linux-omarchy-mobile/pull/171) and the driver fix [#170](https://github.com/derekross/linux-omarchy-mobile/pull/170); a second unit's Lishen pack isn't matched by that model yet, [notes](../device/panther/NOTES.md#2026-11-03-a-second-unit-angelrenefm); [BATTERY-PLAN](../device/panther/BATTERY-PLAN.md)) | no | testing (CS40L26 with the phone's own firmware, `tools/extract-vendor-firmware -d panther`; merged through [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), with the feedbackd rule in device-panther 0.1.1, [#145](https://github.com/derekross/omarchy-mobile/pull/145); [notes](../device/panther/NOTES.md#2026-10-28-the-gpu-and-the-haptics-power-off-and-usb-after-a-replug)) | testing (LM3644 rear flash, 36 steps, from the node merged in [kernel #197](https://github.com/derekross/linux-omarchy-mobile/pull/197) and the bring-up overlay `torch.dtso`, [#426](https://github.com/derekross/omarchy-mobile/pull/426): lit on a second Pixel 7; the quick-settings tile not checked) | no | no | no | no | no | no | no (the package's camera start and DMA heap rule are merged, device-panther 0.1.9, [#443](https://github.com/derekross/omarchy-mobile/pull/443), inert until the camera device tree is proposed) | no (s2idle by default since [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134) and device-panther 0.1.1; not run yet) | WIP (the sensor's node, disabled, is merged, [kernel #207](https://github.com/derekross/linux-omarchy-mobile/pull/207); with a bring-up overlay and the package side, which is in review ([#458](https://github.com/derekross/omarchy-mobile/pull/458)), a finger enrolled and unlocked its author's Pixel 7, also after a reboot) | | OnePlus 13 ([notes](../device/dodge/NOTES.md)) | dodge | sm8750 (Snapdragon 8 Elite) | testing (kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [BRINGUP](../device/dodge/BRINGUP-M1.md), [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing ([notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (msm/dpu; warm-boot drop fixed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (Adreno 830 / gpu2; Vulkan untested; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing ([notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing ([notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (CDC NCM + SSH; gadget stuck after replug until reboot; kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (WCN7860 / ath12k; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (pairing; A2DP untested; kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (gauge; charging path not claimed; kernel [mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | no | no | no | no | - | testing (speakers, earpiece, mics; headset plug untested; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (accel, prox, compass; autorotate; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | testing (LTE data; calls/SMS untested; opt-in flag; [modem](../device/dodge/modem/README.md), [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | no | no | WIP (s2idle not default; [notes](../device/dodge/NOTES.md#2026-10-28-matrix-evidence)) | no | -| OnePlus 6 ([notes](../device/enchilada/NOTES.md)) | enchilada | SDM845 (Snapdragon 845) | WIP (RAM-only `fastboot boot` of a header-v0 image; kernel: Linux 7.1-rc1 from the sdm845-mainline tree, not linux-omarchy-mobile; the firewall and GPU results booted the Arch root on `userdata`; stock is not on slot A, a §3.1 event: [notes](../device/enchilada/NOTES.md#slots-and-what-is-on-them-contributingmd-31); [#432](https://github.com/derekross/omarchy-mobile/issues/432)) | WIP (UFS behind the read-only guard; `boot_b` is on LUN `sde` and stays read-only; [notes](../device/enchilada/NOTES.md#2026-11-04-ram-only-first-light)) | WIP (msm DRM framebuffer console; [notes](../device/enchilada/NOTES.md#2026-11-04-ram-only-first-light)) | no (needs the phone's own zap shader; [notes](../device/enchilada/NOTES.md#2026-11-05-adreno-630-needs-this-phones-zap-shader)) | no | no | testing (NCM + ACM + SSH; [notes](../device/enchilada/NOTES.md#2026-11-04-ram-only-first-light)) | no (modem/rmtfs plan first) | no | no | no | no | no | no | - | no | no | no | no | no | no | no | +| OnePlus 6 ([notes](../device/enchilada/NOTES.md)) | enchilada | SDM845 (Snapdragon 845) | WIP (RAM-only `fastboot boot` of a header-v0 image; kernel: Linux 7.1-rc1 from the sdm845-mainline tree, not linux-omarchy-mobile; the firewall failure booted from `boot_b` after `--set-active=b`, the firewall fix and GPU results were `fastboot boot`s, all three with the Arch root on `userdata`; stock is not on slot A, a §3.1 event: [notes](../device/enchilada/NOTES.md#slots-and-what-is-on-them-contributingmd-31); [#432](https://github.com/derekross/omarchy-mobile/issues/432)) | WIP (UFS behind the read-only guard; `boot_b` is on LUN `sde` and stays read-only; [notes](../device/enchilada/NOTES.md#2026-11-04-ram-only-first-light)) | WIP (msm DRM framebuffer console; [notes](../device/enchilada/NOTES.md#2026-11-04-ram-only-first-light)) | no (needs the phone's own zap shader; [notes](../device/enchilada/NOTES.md#2026-11-05-adreno-630-needs-this-phones-zap-shader)) | no | no | testing (NCM + ACM + SSH; [notes](../device/enchilada/NOTES.md#2026-11-04-ram-only-first-light)) | no (modem/rmtfs plan first) | no | no | no | no | no | no | - | no | no | no | no | no | no | no | | *Template* | *codename* | *SoC* | | | | | | | | | | | | | | | | | | | | | | | ## cheetah (Pixel 7 Pro) in detail @@ -80,5 +80,5 @@ Devices we'd like to support, with the closest starting point. Open an issue to | Pixel 4 XL | coral | SM8150 (Snapdragon 855) | **WIP, community port**, in the matrix above: bring-up notes merged ([#52](https://github.com/derekross/omarchy-mobile/pull/52): [BRINGUP-M1](../device/coral/BRINGUP-M1.md), [NOTES](../device/coral/NOTES.md)), with companion kernel/userspace sources ([omarchy-mobile-coral v0.2.3](https://github.com/HemangKumawat/omarchy-mobile-coral/tree/v0.2.3)); slot-B installer and `CONTRIBUTING.md` §3.1 entry still to land | | POCO F3 | alioth | SM8250 (Snapdragon 870) | the first non-Pixel port: a guarded installer and root image in review ([#25](https://github.com/derekross/omarchy-mobile/pull/25)) | | OnePlus 13 | dodge | SM8750 (Snapdragon 8 Elite) | **WIP, community port**, in the matrix above: device files, notes and the qcom-abl boot images merged ([#111](https://github.com/derekross/omarchy-mobile/pull/111)); its kernel stays in the contributor's fork ([mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed: the SoC series is out of this tree's scope); the guarded installer follows in a later pull request | -| OnePlus 6 | enchilada | SDM845 (Snapdragon 845) | **WIP, community port: [#432](https://github.com/derekross/omarchy-mobile/issues/432)**, in the matrix above: descriptor and notes; RAM-only (`fastboot boot`) until the slot-B install and its CONTRIBUTING.md §3.1 entry are agreed; the header-v0 packer and a LUN-aware `UFS_RW` follow in their own pull requests | +| OnePlus 6 | enchilada | SDM845 (Snapdragon 845) | **WIP, community port: [#432](https://github.com/derekross/omarchy-mobile/issues/432)**, in the matrix above: descriptor and notes; RAM-only (`fastboot boot`) until the slot-B install and its CONTRIBUTING.md §3.1 entry are agreed; `omamobile images` packs its header-v0 boot image, and a LUN-aware `UFS_RW` follows in its own pull request | | PinePhone Pro | pinephone-pro | Rockchip RK3399S | No port in this tree yet; mainline's `rk3399-pinephone-pro.dts` is already in our kernel. Prior art: [Omarchy on the PinePhone Pro](https://github.com/FlorencioJP/omarchy-mobile-pinephone-pro) | diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 27941295c..ac96ac586 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -76,7 +76,8 @@ Bring-up tools (`*-stage`, `display-hz`, `usbc-deadman`) stay per plan: they pok | `OS_VERSION`, `OS_PATCH_LEVEL` | `17.0.0`, `2026-07` | The `init_boot` header values (the `boot` header's, on a device without `init_boot`) | | `AVB_FOOTERS` | (zuma, the Pixel 7a and the Pixel 7 Pro: `boot:0x4000000 init_boot:0x800000`) | Optional. For a phone whose `vbmeta_b` chains these partitions, as stock's does: libavb takes a chained partition with no AVB footer as invalid metadata, which an unlocked bootloader doesn't let through (zuma; the Pixel 7a; the Pixel 7 Pro, device/cheetah/NOTES.md 2026-10-28). A `vbmeta_b` that lists them as hash descriptors, or has verification disabled, never reads the footers. `image:partition_size`, each a `BOOT_IMAGES` entry, once; the size is the slot's partition size in bytes (stock's footer, `avbtool info_image`, or `fastboot getvar partition-size:_b`), a multiple of 4096. `images` adds a hash footer to each, padding it to that size, signed with AOSP's test key (an unlocked bootloader accepts any key); needs `external/avb` under `SRC_DIR` (or `AVBTOOL`, `AVB_KEY`) and `openssl` | | `AVB_ROLLBACK_INDEX`, `AVB_SECURITY_PATCH` | `1791158400`, `2026-10-05` | Required with `AVB_FOOTERS`, refused without it: stock's rollback index and `com.android.build..security_patch` from its footers. Never set the index above stock's: an index the bootloader stores locks stock's own images out of slot A. The `os_version` property is `OS_VERSION`'s major | -| `BOOT_METHOD` | `android-v4` (default when omitted) | Generic images, flash, push and installer accept only `android-v4`; other methods are refused before phone access. `ram-only` marks a probe with no persistent install support | +| `BOOT_METHOD` | `android-v4` (default when omitted) | Generic images, flash, push and installer accept only `android-v4`; other methods are refused before phone access. `ram-only` marks a probe with no persistent install support. `android-v0` (enchilada) is a header-v0 phone: `images` packs one `boot.img` for `fastboot boot`, and fastboot, flash, push and the installer refuse it | +| `PAGESIZE`, `BASE`, `KERNEL_OFFSET`, `RAMDISK_OFFSET`, `SECOND_OFFSET`, `TAGS_OFFSET` | (enchilada: `4096`, `0x00000000`, `0x00008000`, `0x01000000`, `0x00f00000`, `0x00000100`) | `android-v0` only, all required: the header-v0 page size and load offsets, numbers in decimal or lower-case hex. `images` packs the gzip `Image` with the `DTB` appended as the kernel, the initramfs as the ramdisk and `CMDLINE` as the command line. `BOOT_IMAGES` is `boot` alone and `boot_b` must be on `UFS_RW` | | `BOOT_IMAGES` | `boot init_boot vendor_boot vendor_kernel_boot dtbo` | The images written to slot B (the `_b` suffix is added by the tools and is not configurable). `boot`, `vendor_boot` and `dtbo` are always there. Without `init_boot`, `boot` carries the empty generic ramdisk and the OS version; without `vendor_kernel_boot`, `vendor_boot` carries the DTB and the initramfs (the Pixel 6: `boot vendor_boot dtbo`) | | `UFS_RW` | `boot_b … dtbo_b userdata` | The storage guard's allowlist, packed into the initramfs as `/etc/omamobile-ufs-rw`. Only slot B's boot images (`boot_b`, `init_boot_b`, `vendor_boot_b`, `vendor_kernel_boot_b`, `dtbo_b`) and `userdata` are accepted, `userdata` and every `BOOT_IMAGES` entry must be on it, and each name only once. The init fails closed: a missing, empty or malformed file, or any other name in it, leaves every partition read-only | | `INITRAMFS_INIT` | `/initramfs/init` | The init script. A leading `/` is relative to the repo root, so devices share one script. Any other value is relative to the descriptor | diff --git a/tests/boot-method b/tests/boot-method index f83b84aa6..b82730452 100755 --- a/tests/boot-method +++ b/tests/boot-method @@ -19,7 +19,7 @@ done export PATH="$t/bin:$PATH" CALLS="$t/calls" unset KERNEL_OUT KERNEL_DIR KERNEL_BASE WORK || true fail() { echo "not ok - $*" >&2; cat "$t/log" >&2; exit 1; } -for method in ram-only uboot-ext4 android-v0 unknown ''; do +for method in ram-only uboot-ext4 unknown ''; do printf 'CODENAME=probe\nBOOT_METHOD="%s"\nBOOT_IMAGES=""\nUFS_RW=""\n' "$method" > "$t/repo/device/probe/device.conf" cp "$t/repo/device/probe/device.conf" "$t/bundle/device.conf" for cmd in images flash push; do @@ -42,20 +42,40 @@ if "$t/repo/tools/install-phone" --device flame > "$t/log" 2>&1; then fail "flam grep -q 'unsupported BOOT_METHOD=ram-only;' "$t/log" || fail "flame fails for the wrong reason" echo 'ok - the shipped flame descriptor has no persistent installer path' -# The shipped enchilada descriptor: android-v0 has no packer here, so every -# path that would make or write an image refuses it before phone access. +# The shipped enchilada descriptor: android-v0 images get past the +# descriptor checks (no kernel build here, so they stop at "build the +# kernel first"); fastboot, flash and push refuse it as RAM-only, and the +# installer still refuses the method. None of it reaches a phone. mkdir -p "$t/repo/device/enchilada" cp device/enchilada/device.conf "$t/repo/device/enchilada/" -for cmd in images flash push; do +if DEVICE=enchilada KERNEL_OUT="$t/no-kernel" "$t/repo/bin/omamobile" images > "$t/log" 2>&1; then fail "enchilada images succeeds without a kernel"; fi +grep -q 'build the kernel first' "$t/log" || fail "enchilada images fails for the wrong reason" +for cmd in fastboot flash push; do if DEVICE=enchilada "$t/repo/bin/omamobile" "$cmd" > "$t/log" 2>&1; then fail "enchilada $cmd succeeds"; fi - grep -q 'unsupported BOOT_METHOD=android-v0;' "$t/log" || fail "enchilada $cmd fails for the wrong reason" + grep -q "$cmd refuses BOOT_METHOD=android-v0" "$t/log" || fail "enchilada $cmd fails for the wrong reason" done for dry in '' --dry-run; do if "$t/repo/tools/install-phone" --device enchilada $dry --work "$t/work" > "$t/log" 2>&1; then fail "enchilada installs"; fi grep -q 'unsupported BOOT_METHOD=android-v0;' "$t/log" || fail "enchilada installer fails for the wrong reason" done [[ ! -e $t/calls && ! -e $t/work ]] || fail "the enchilada descriptor accessed a phone or prepared an image" -echo 'ok - the shipped enchilada descriptor is refused by images/flash/push and both installer modes' +echo 'ok - enchilada images reach the kernel check; fastboot/flash/push and both installer modes refuse android-v0' + +# Header fields must be present and numeric; BOOT_IMAGES is boot only and +# boot_b must be writable. +mkdir -p "$t/repo/device/v0probe" +v0bad() { # sed expression, expected message + sed -e "s/^CODENAME=.*/CODENAME=v0probe/" -e "$1" device/enchilada/device.conf > "$t/repo/device/v0probe/device.conf" + if DEVICE=v0probe KERNEL_OUT="$t/no-kernel" "$t/repo/bin/omamobile" images > "$t/log" 2>&1; then fail "v0 descriptor accepted: $1"; fi + grep -q "$2" "$t/log" || fail "v0 descriptor '$1' fails for the wrong reason" +} +v0bad '/^PAGESIZE=/d' 'PAGESIZE is missing or not a number' +v0bad 's/^TAGS_OFFSET=.*/TAGS_OFFSET=0x10g/' 'TAGS_OFFSET is missing or not a number' +v0bad 's/^PAGESIZE=.*/PAGESIZE=4097/' 'PAGESIZE must be' +v0bad 's/^BOOT_IMAGES=.*/BOOT_IMAGES="boot dtbo"/' 'BOOT_IMAGES may hold only boot' +v0bad 's/^UFS_RW=.*/UFS_RW=userdata/' 'boot_b is not in UFS_RW' +[[ ! -e $t/calls ]] || fail "a v0 descriptor check accessed a phone" +echo 'ok - android-v0 header fields, BOOT_IMAGES and UFS_RW are checked' # qcom-abl is accepted by images only when device/$DEVICE/chainload/ exists # (installer still refuses until a later PR). flash and push both refuse diff --git a/tests/images-layout b/tests/images-layout index 1955f54ab..9a70d97c4 100755 --- a/tests/images-layout +++ b/tests/images-layout @@ -15,7 +15,9 @@ # gives boot and init_boot hash footers at their partition sizes (when # external/avb is under $SRC_DIR); without the zuma keys the gs201 and gs101 # images match the tool at $IMAGES_BASELINE (default 1e7a998, the last tool -# before them) byte for byte. Only the image tests skip, when AOSP's mkbootimg +# before them) byte for byte; an android-v0 (header v0) descriptor yields +# one boot.img: the gzip kernel with its DTB appended, the initramfs, the +# descriptor's load offsets and CMDLINE. Only the image tests skip, when AOSP's mkbootimg # isn't under $SRC_DIR, or no dtc is found: $DTC, then dtc on PATH, then a # kernel build's scripts/dtc/dtc ($KERNEL_OUT, or ~/android/mainline/out*). set -euo pipefail @@ -328,6 +330,50 @@ cmp -s "$K/images/dtb.img" "$dts/zuma-eight.dtb" || fail "zuma layout: dtb.img i unpack vendor_kernel_boot cmp -s "$t/u/vendor_kernel_boot/dtb" "$dts/zuma-eight.dtb" || fail "zuma layout: vendor_kernel_boot carries the DTB" pass "zuma-style descriptor (SOC_COMPATIBLE): the DTB once, in vendor_kernel_boot" + +# android-v0 (enchilada-style): one header-v0 boot.img, a gzip kernel with +# the DTB appended, the initramfs as its ramdisk, at the descriptor's load +# offsets; nothing else is made, and the bytes repeat run to run +mkdir -p "$R/device/vzero" "$K/arch/arm64/boot/dts/qcom" +cat > "$R/device/vzero/device.conf" <<'EOF2' +CODENAME=vzero +NAME="Test vzero" +SOC=sdm845 +COMPATIBLE="oneplus,vzero" +BOOT_METHOD=android-v0 +DTB=qcom/sdm845-vzero.dtb +INITRAMFS_INIT=initramfs/init +PANEL_SIZE=1080x2280 +PAGESIZE=4096 +BASE=0x00000000 +KERNEL_OFFSET=0x00008000 +RAMDISK_OFFSET=0x01000000 +SECOND_OFFSET=0x00f00000 +TAGS_OFFSET=0x00000100 +BOOT_IMAGES=boot +UFS_RW="boot_b userdata" +CMDLINE="console=tty0 panic=10 omamobile.initramfs" +EOF2 +printf '/dts-v1/;\n/ {\n\tcompatible = "oneplus,vzero", "qcom,sdm845";\n\t#address-cells = <2>;\n\t#size-cells = <2>;\n\tchosen { };\n};\n' \ + | "$dtc" -q -I dts -O dtb -o "$K/arch/arm64/boot/dts/qcom/sdm845-vzero.dtb" - +om vzero images || { cat "$t/log"; fail "images builds the android-v0 layout"; } +[[ $(built) == "boot.img " ]] || fail "android-v0 layout: boot.img only (got $(built))" +unpack boot +# (mkbootimg leaves the second-stage address 0 when there is no second +# stage, so SECOND_OFFSET does not show in the header) +[[ $(field boot 'boot image header version') == 0 ]] || fail "android-v0 layout: header version 0" +[[ $(field boot 'page size') == 4096 ]] || fail "android-v0 layout: page size 4096 (got $(field boot 'page size'))" +[[ $(field boot 'kernel load address') == 0x00008000 && $(field boot 'ramdisk load address') == 0x01000000 && + $(field boot 'kernel tags load address') == 0x00000100 ]] \ + || { cat "$t/u/boot.txt"; fail "android-v0 layout: load addresses from BASE and the offsets"; } +[[ $(field boot 'command line args') == "console=tty0 panic=10 omamobile.initramfs" ]] || fail "android-v0 layout: CMDLINE" +cmp -s "$t/u/boot/kernel" <(gzip -9 -n -c "$K/arch/arm64/boot/Image"; cat "$K/arch/arm64/boot/dts/qcom/sdm845-vzero.dtb") \ + || fail "android-v0 layout: the kernel is the gzip Image with the DTB appended" +cmp -s "$t/u/boot/ramdisk" "$K/initramfs.cpio.lz4" || fail "android-v0 layout: the ramdisk is the initramfs" +[[ $(cat "$K/images/DEVICE") == vzero ]] || fail "images records the device" +vzero_sum=$(sha256sum < "$K/images/boot.img") +om vzero images && [[ $(sha256sum < "$K/images/boot.img") == "$vzero_sum" ]] || fail "android-v0 images are deterministic" +pass "android-v0 descriptor: one header-v0 boot.img (gzip kernel + DTB, initramfs, offsets, CMDLINE), deterministic" cp "$R/device/eight/device.conf" "$t/eight.conf" sed -i 's/b1-foplp:0x9865:1:1:0/b1-foplp:0x9865:1:2:0/' "$R/device/eight/device.conf" if om eight images; then fail "images refuses a DTB whose /soc_compatible differs from SOC_COMPATIBLE"; fi From 26402f324500bd956f8e70d9d7ea3fac71396769 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 8 Nov 2026 10:37:38 -0600 Subject: [PATCH 08/66] MODEM-PLAN, RADIOS-CAMERA-PLAN: find partitions by PARTNAME in M0 (#519) The Arch root on the phone has no /dev/disk/by-partlabel, so the M0 commands that read the radio partitions through it fail there: M0.1's checksum loop (both plans), M0.5's blockdev --getro check and 1.6's name-to-device listing. #490 fixed the same lookup in FINGERPRINT-PLAN, and the maintainer asked for these two plans to get the same treatment. Each command now finds its partition the way FB1 and F19.0 do, by PARTNAME in /sys/class/block/*/uevent, and 1.6 lists those PARTNAME lines in place of the by-partlabel symlinks. 1.6's "take a fresh backup" note now points at tools/nv-backup, which finds the partitions the same way. No step does anything else differently: the same partitions are read, nothing is mounted or written. MODEM-PLAN's M0 result note (2026-10-12) records what was run that day and is left as it was. Checked: the changed shell snippets parse (bash -n, sh -n), the lookup picks sda5 for efs over efs_backup on a fake sysfs, tools/pr-check origin/main and tests/all. Docs only; no phone was used. Co-Authored-By: Claude Opus 5.5 --- device/cheetah/MODEM-PLAN.md | 6 ++++-- device/cheetah/RADIOS-CAMERA-PLAN.md | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/device/cheetah/MODEM-PLAN.md b/device/cheetah/MODEM-PLAN.md index 0b9f05962..2bd62cd81 100644 --- a/device/cheetah/MODEM-PLAN.md +++ b/device/cheetah/MODEM-PLAN.md @@ -342,7 +342,8 @@ Same checks as below: full build exits 0 (`logs/kernel-modem7.log`), ```sh # M0.1 partitions unchanged against the 2026-10-11 backup (reads ~430 MB) tools/phone-ssh 'for p in efs efs_backup modem_userdata persist modem_a modem_b; do - printf "%s %s.img\n" "$(sha256sum < /dev/disk/by-partlabel/$p | cut -d" " -f1)" "$p"; done' \ + d=$(grep -lx "PARTNAME=$p" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) + printf "%s %s.img\n" "$(sha256sum < /dev/$d | cut -d" " -f1)" "$p"; done' \ > logs/m0-partitions.sha256 grep -E ' (efs|efs_backup|modem_userdata|persist|modem_a|modem_b)\.img$' \ ~/android/reference/cheetah-partition-backup-20261011/SHA256SUMS | sort -k2 | diff - <(sort -k2 logs/m0-partitions.sha256) @@ -378,7 +379,8 @@ tools/phone-ssh 'cat > /etc/udev/rules.d/60-omamobile-modem-nv-ro.rules' <<'EOF' SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="efs|efs_backup|modem_userdata|modem_a|modem_b", RUN+="/usr/bin/blockdev --setro $devnode" EOF tools/phone-ssh 'udevadm control --reload; udevadm trigger -s block -c change; - for p in efs efs_backup modem_userdata modem_a modem_b; do echo $p $(blockdev --getro /dev/disk/by-partlabel/$p); done' + for p in efs efs_backup modem_userdata modem_a modem_b; do + d=$(grep -lx "PARTNAME=$p" /sys/class/block/*/uevent | head -1 | cut -d/ -f5); echo $p $(blockdev --getro /dev/$d); done' # pass: all 1. (persist stays writable for the fingerprint work's own plan; nothing here writes it.) ``` diff --git a/device/cheetah/RADIOS-CAMERA-PLAN.md b/device/cheetah/RADIOS-CAMERA-PLAN.md index 8a02e595c..c27f4b6c1 100644 --- a/device/cheetah/RADIOS-CAMERA-PLAN.md +++ b/device/cheetah/RADIOS-CAMERA-PLAN.md @@ -273,16 +273,18 @@ From the omamobile repo, phone in Arch over USB. # M0.1 the modem's NV and firmware partitions are untouched: checksums match the backup. # Reads only. ~430 MB from UFS, a minute or two. tools/phone-ssh 'for p in efs efs_backup modem_userdata persist modem_a modem_b; do - printf "%s %s.img\n" "$(sha256sum < /dev/disk/by-partlabel/$p | cut -d" " -f1)" "$p"; done' \ + d=$(grep -lx "PARTNAME=$p" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) + printf "%s %s.img\n" "$(sha256sum < /dev/$d | cut -d" " -f1)" "$p"; done' \ > logs/m0-partitions.sha256 grep -E ' (efs|efs_backup|modem_userdata|persist|modem_a|modem_b)\.img$' \ ~/android/reference/cheetah-partition-backup-20261011/SHA256SUMS | sort -k2 | diff - <(sort -k2 logs/m0-partitions.sha256) # pass: no diff for efs, efs_backup, modem_a, modem_b. persist and modem_userdata # may differ if stock Android ran after 2026-10-11; then take a fresh backup -# before M2 (same dd as the original backup, to the laptop). +# before M2 into a new directory on the laptop (tools/nv-backup DIR). # also: nothing mounts them -tools/phone-ssh 'grep -E "sda(1|5|6|7|19|29) " /proc/mounts; ls -l /dev/disk/by-partlabel/ | grep -E " (efs|efs_backup|modem_userdata|persist|modem_a|modem_b) "' -# pass: no mount lines. +tools/phone-ssh 'grep -E "sda(1|5|6|7|19|29) " /proc/mounts + grep -xE "PARTNAME=(efs|efs_backup|modem_userdata|persist|modem_a|modem_b)" /sys/class/block/*/uevent' +# pass: no mount lines. The PARTNAME lines give each partition's sdaN. # M0.2 memory map: the CP regions must not be System RAM in use. tools/phone-ssh 'grep -iE "e8000000|ea400000|f6200000|reserved" /proc/iomem | head -20' From 749b8c8b126dd15a09cd9c3eddef12996de0e2ff Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 8 Nov 2026 10:37:42 -0600 Subject: [PATCH 09/66] FINGERPRINT-PLAN: F3 stops after storageproxyd and rolls back only its copies (#520) Follow-up to Derek's review of #490. F3's rollback pointed at F19.3's, which removes all of /var/lib/omamobile-fp. Once storageproxyd has run, that directory also holds Trusty's TD, so the rollback could delete it. F3's quote already said to run it only where storageproxyd never ran; it now has that as a real Stop line (F19.1's), and its rollback removes only what F3 writes on the phone: mfg_data.img and persist-ss/. F19.3's rollback is unchanged (the maintainer's to fix). #490 dropped F3's laptop copy of mfg_data, which tools/nv-backup doesn't take. F3 takes it again with a read-only dd from the partition found by PARTNAME (this root has no by-partlabel), refused unless the block device reads ro=1, and checks its hash against F19.3's phone copy, so a phone without the 10-13 copy keeps one. FB1 still compared against the 10-12 backup, and FB1 and F19.0 each carried their own checksum loop. Both now run `tools/nv-backup --check "$B"` against the newest backup (B, now in section 6's variables): it finds the partitions by PARTNAME, refuses a writable or mounted one and reports SAME or DIFFERENT for each. Docs only; nothing ran on a phone. Co-Authored-By: Claude Opus 5.5 --- device/cheetah/FINGERPRINT-PLAN.md | 52 ++++++++++++++++++------------ 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/device/cheetah/FINGERPRINT-PLAN.md b/device/cheetah/FINGERPRINT-PLAN.md index 3a2e3209d..5cfd328fe 100644 --- a/device/cheetah/FINGERPRINT-PLAN.md +++ b/device/cheetah/FINGERPRINT-PLAN.md @@ -232,6 +232,8 @@ export KERNEL_DIR=~/android/mainline/wt-int KERNEL_OUT=$O # OVL = the overlays the phone boots with today; it must include aoc-core-test # (Trusty) and gnss-pmic-test (pmic-2), e.g. OVL="gnss-pmic-test gnss-test aoc-core-test audio-amps-test aoc-sound-test" +# B = the newest off-repo backup tools/nv-backup made +B=~/android/reference/cheetah-nv-backup-20261102 ``` ### FB: backups (read-only, before anything else; risk none) @@ -239,15 +241,13 @@ OVL="gnss-pmic-test gnss-test aoc-core-test audio-amps-test aoc-sound-test" FB1, the M0.1 check against the latest off-repo backup: ```sh -tools/phone-ssh 'for p in efs efs_backup modem_userdata persist modem_a modem_b; do - d=$(grep -lx "PARTNAME=$p" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) - printf "%s %s.img\n" "$(sha256sum < /dev/$d | cut -d" " -f1)" "$p"; done' > logs/fb-partitions.sha256 -sort -k2 ~/android/reference/cheetah-partition-backup-20261012-radio/SHA256SUMS | grep -E ' (efs|efs_backup|modem_userdata|persist|modem_a|modem_b)\.img$' | - diff - <(sort -k2 logs/fb-partitions.sha256) +tools/nv-backup --check "$B" ``` -Pass: no diff (or a diff explained by a stock boot since, then a fresh -read-only backup first). **Stop** if there is no backup. +Pass: `nv-backup` exits 0, every NV partition `SAME`. A difference +explained by a stock boot since: a fresh read-only backup into a new +directory first, then FB1 against it. **Stop** if there is no backup, if +`nv-backup` refuses, or on any other difference. FB2, LDO15S as it is now, on the kernel the phone runs (pmic-2 bound by `gnss-pmic-test`; register `0x3a` is `L15S_CTRL`): @@ -360,21 +360,34 @@ root has no `/dev/disk/by-partlabel`. F3 passed on 2026-10-13 from an > where storageproxyd has never run (F19.1); once it has, Trusty is using > that copy. +**Stop** before anything else if storageproxyd already ran on this install +(F19.1's checks): Trusty is using `/var/lib/omamobile-fp` then. + ```sh tools/phone-ssh 'modprobe sg; for d in /sys/class/scsi_generic/sg*; do echo "$d $(basename $(readlink -f $d/device))"; done' # the copies on the phone: F19.3's commands +# the laptop copy of mfg_data (read-only dd, found by PARTNAME) +F=~/android/reference/cheetah-mfg_data-"$(date +%F)".img +tools/phone-ssh 'set -e; M=$(grep -lx "PARTNAME=mfg_data" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) + test "$(cat /sys/class/block/$M/ro)" = 1; dd if=/dev/$M bs=1M status=none' > "$F" +chmod 600 "$F"; sha256sum "$F" | cut -c1-16 # the laptop backup of persist and the radio partitions (into a new directory) tools/nv-backup ~/android/reference/cheetah-nv-backup-"$(date +%Y%m%d)" tools/phone-ssh 'modprobe -r sg' ``` Expect one sg node at `0:0:0:49476` (the RPMB well-known LUN), F19.3's -output, then `nv-backup`'s verified copies. `mfg_data` isn't one of -`nv-backup`'s partitions: F19.3 compares the phone's copy with the laptop's -2026-10-13 one. Pass: F19.3's Pass and `nv-backup` exits 0. **Stop** on -F19.3's stops, if `nv-backup` refuses, or if the storage guard complains. -Rollback: `modprobe -r sg`, then F19.3's (nothing is written to `persist` -or `mfg_data`). +output, the laptop copy's hash, then `nv-backup`'s verified copies. +`mfg_data` isn't one of `nv-backup`'s partitions, so it gets its own copy. +F19.3 compares the phone's copy with the laptop's 2026-10-13 one; a phone +without that copy compares with this one. Pass: F19.3's Pass, the laptop +copy's hash equal to F19.3's `mfg_data.img` hash, and `nv-backup` exits 0. +**Stop** on F19.3's stops, if the laptop copy is empty or its hash differs, +if `nv-backup` refuses, or if the storage guard complains. Rollback: +`modprobe -r sg`, then remove only what F3 wrote on the phone, never the +whole directory (it holds Trusty's TD once storageproxyd has run): +`rm -rf /var/lib/omamobile-fp/persist-ss /var/lib/omamobile-fp/mfg_data.img`. +Nothing is written to `persist` or `mfg_data`. ### F4: secure storage (IRREVERSIBLE: the first RPMB write from Linux) @@ -968,20 +981,17 @@ the last TD. Three facts decide the runbook: `persist:/ss/0` hashed to `e0e1990d…` in the 10-12, 10-30 and 11-02 persist backups and in both fingerprint backup tars. -Variables: `B=~/android/reference/cheetah-nv-backup-20261102`. +Variables: section 6's (`B`, the newest backup). **F19.0 Backups match (read-only; risk none).** ```sh -tools/phone-ssh 'for p in efs efs_backup modem_userdata persist modem_a modem_b; do - d=$(grep -lx "PARTNAME=$p" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) - printf "%s %s.img\n" "$(sha256sum < /dev/$d | cut -d" " -f1)" "$p"; done' > logs/f19-partitions.sha256 -grep -E ' (efs|efs_backup|modem_userdata|persist|modem_a|modem_b)\.img$' "$B/SHA256SUMS" | sort -k2 | - diff - <(sort -k2 logs/f19-partitions.sha256) && echo SAME +tools/nv-backup --check "$B" ``` -Pass: `SAME`. **Stop** on any difference: take a fresh read-only backup and -find out why first. +Pass: `nv-backup` exits 0, every NV partition `SAME`. **Stop** if it +refuses or on any difference: take a fresh read-only backup and find out +why first. **F19.1 Nothing has run yet (read-only; risk none).** `uname -r`, the package versions, `systemctl is-enabled omamobile-fp` (disabled), From 88c691de7e62b95ae6787f5c45e64baef8232b45 Mon Sep 17 00:00:00 2001 From: Marsel Nenaj <201385099+marselnenaj@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:06:45 +0100 Subject: [PATCH 10/66] omamobile-settings: trim the foundation API and derive its version Remove the unused surface palette hint and its window ownership plumbing until a public consumer needs it. Clarify the own-worktree MIT provenance, and share the package version with production and session-fixture builds. Check the public version entrypoint without constructing hardware controllers. Co-Authored-By: Codex --- packages/omamobile-settings/README.md | 9 +++++---- packages/omamobile-settings/app/backend.cpp | 10 ---------- packages/omamobile-settings/app/backend.h | 5 ----- packages/omamobile-settings/app/main.cpp | 11 +++++++---- .../omamobile-settings/omamobile-settings.pro | 1 + .../omamobile-settings/test/single-instance.py | 18 ++++++------------ .../omamobile-settings/tests/core_tests.cpp | 6 ++---- .../omamobile-settings/tests/session_app.pro | 1 + packages/omamobile-settings/version.pri | 4 ++++ 9 files changed, 26 insertions(+), 39 deletions(-) create mode 100644 packages/omamobile-settings/version.pri diff --git a/packages/omamobile-settings/README.md b/packages/omamobile-settings/README.md index 384b911e5..e66e00a09 100644 --- a/packages/omamobile-settings/README.md +++ b/packages/omamobile-settings/README.md @@ -17,17 +17,18 @@ extracted-source directory. The build and test directories can be selected using `OMAMOBILE_SETTINGS_BUILD_DIR` and `OMAMOBILE_SETTINGS_TEST_BUILD_DIR`. `omamobile-settings --check` validates the catalog without opening a window. +`--version` prints the version from the package build. `--preview` displays neutral fictional device information; `--page about` opens the implemented detail page directly. The application reads the current theme's colors.toml and observes atomic theme replacements. Rounded corners follow Hyprland's read-only decoration:rounding option. It does not change compositor settings. A session D-Bus service handles -repeat launches and exposes a focused-window-only opaque surface palette hint. -That hint contains colors and availability, not device information. +repeat launches. -Copyright 2026 Marsel Nenaj, MIT; see LICENSE. Extracted from the existing native -Settings implementation, with Codex assistance. Omarchy's theme and desktop APIs +Copyright 2026 Marsel Nenaj, MIT; see LICENSE. Extracted from my own native +Settings worktree, with Codex assistance; the application code is my MIT-licensed +work. Omarchy's theme and desktop APIs remain the work of their upstream authors, including David Heinemeier Hansson; this package does not claim authorship of those interfaces. diff --git a/packages/omamobile-settings/app/backend.cpp b/packages/omamobile-settings/app/backend.cpp index 55a81c8ff..970213a93 100644 --- a/packages/omamobile-settings/app/backend.cpp +++ b/packages/omamobile-settings/app/backend.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -143,12 +142,3 @@ QString Backend::icon(const QString &name) const { svg.replace("#9ece6a", m_accent.name().toUtf8()); return "data:image/svg+xml;base64," + QString::fromLatin1(svg.toBase64()); } -QString Backend::SurfacePalette() const { - if (!m_background.isValid() || m_background.alpha() != 255 || !m_window - || !m_window->isVisible() || QGuiApplication::focusWindow() != m_window) - return "{\"version\":1,\"known\":false}"; - const auto color = m_background.name(QColor::HexRgb); - return QString::fromUtf8(QJsonDocument(QJsonObject{ - {"version", 1}, {"known", true}, {"top", color}, {"bottom", color} - }).toJson(QJsonDocument::Compact)); -} diff --git a/packages/omamobile-settings/app/backend.h b/packages/omamobile-settings/app/backend.h index e81c150f9..bf045c51b 100644 --- a/packages/omamobile-settings/app/backend.h +++ b/packages/omamobile-settings/app/backend.h @@ -6,8 +6,6 @@ #include #include #include -#include -#include #include class Backend : public QObject { @@ -41,8 +39,6 @@ class Backend : public QObject { Q_INVOKABLE QString icon(const QString &name) const; Q_INVOKABLE QStringList catalogProblems() const; Q_SCRIPTABLE bool Open(const QString &page); - Q_SCRIPTABLE QString SurfacePalette() const; - void setSurfaceWindow(QWindow *window) { m_window = window; } signals: void rowsChanged(); void pageChanged(); @@ -57,7 +53,6 @@ class Backend : public QObject { QString m_page = "root", m_query, m_themeFile; QStringList m_history; QFileSystemWatcher m_watcher; - QPointer m_window; QProcess m_roundingQuery; quint64 m_roundingGeneration = 0; int m_radius = 0; diff --git a/packages/omamobile-settings/app/main.cpp b/packages/omamobile-settings/app/main.cpp index 40b6ef142..4ede61fb1 100644 --- a/packages/omamobile-settings/app/main.cpp +++ b/packages/omamobile-settings/app/main.cpp @@ -20,16 +20,20 @@ int main(int argc, char **argv) { QString page = "root"; for (int i = 1; i < argc; ++i) { const auto argument = QString::fromLocal8Bit(argv[i]); - if (argument == "--preview") preview = true; + if (argument == "--version") { + std::puts("omamobile-settings " OMAMOBILE_SETTINGS_VERSION); + return 0; + } + else if (argument == "--preview") preview = true; else if (argument == "--check") check = preview = true; else if (argument == "--page" && i + 1 < argc) page = QString::fromLocal8Bit(argv[++i]); - else { std::fprintf(stderr, "Usage: omamobile-settings [--page PAGE] [--preview] [--check]\n"); return 2; } + else { std::fprintf(stderr, "Usage: omamobile-settings [--page PAGE] [--preview] [--check] [--version]\n"); return 2; } } if (check) qputenv("QT_QPA_PLATFORM", "offscreen"); QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); QGuiApplication app(argc, argv); app.setApplicationName("omamobile-settings"); - app.setApplicationVersion("0.1.0"); + app.setApplicationVersion(QStringLiteral(OMAMOBILE_SETTINGS_VERSION)); app.setDesktopFileName("org.omamobile.Settings"); QQuickStyle::setStyle("Material"); Backend backend; @@ -63,6 +67,5 @@ int main(int argc, char **argv) { engine.rootContext()->setContextProperty("deviceInfo", &deviceInfo); engine.load(QUrl("qrc:/Main.qml")); if (engine.rootObjects().isEmpty()) return 1; - backend.setSurfaceWindow(qobject_cast(engine.rootObjects().first())); return app.exec(); } diff --git a/packages/omamobile-settings/omamobile-settings.pro b/packages/omamobile-settings/omamobile-settings.pro index 6ad4c5b0e..9b30af5dc 100644 --- a/packages/omamobile-settings/omamobile-settings.pro +++ b/packages/omamobile-settings/omamobile-settings.pro @@ -7,3 +7,4 @@ INCLUDEPATH += $$PWD/app HEADERS += app/backend.h app/deviceinfocontroller.h SOURCES += app/main.cpp app/backend.cpp app/deviceinfocontroller.cpp RESOURCES += app/resources.qrc +include(version.pri) diff --git a/packages/omamobile-settings/test/single-instance.py b/packages/omamobile-settings/test/single-instance.py index 0183ead00..1f6bc68e2 100644 --- a/packages/omamobile-settings/test/single-instance.py +++ b/packages/omamobile-settings/test/single-instance.py @@ -1,13 +1,17 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: MIT """Exercise the application entrypoint with a neutral constructor fixture.""" -import json import re +from pathlib import Path import subprocess import sys import time binary = sys.argv[1] +expected_version = (Path(__file__).resolve().parents[1] / 'version').read_text().strip() +version = subprocess.run([binary, '--version'], capture_output=True, text=True, timeout=5) +assert version.returncode == 0 +assert version.stdout.strip().endswith(' ' + expected_version), version.stdout application = subprocess.Popen( [binary, '--page', 'about'], stdout=subprocess.DEVNULL, @@ -37,23 +41,13 @@ def call(method, *arguments): unknown = call('Open', 'string:nonexistent') assert unknown.returncode == 0 assert re.search(r'\bboolean\s+false\b', unknown.stdout) - palette = call('SurfacePalette') - assert palette.returncode == 0 - value = palette.stdout.strip() - start, end = value.find('{'), value.rfind('}') - assert start >= 0 and end > start - decoded = json.loads(value[start:end + 1]) - assert decoded['version'] == 1 and isinstance(decoded['known'], bool) - if decoded['known']: - assert re.fullmatch(r'#[0-9a-fA-F]{6}', decoded['top']) - assert decoded['bottom'] == decoded['top'] second = subprocess.run( [binary, '--page', 'about'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=5, ) assert second.returncode == 0 assert application.poll() is None - print('PASS private-bus entrypoint Open, route rejection, palette schema and repeat launch') + print('PASS private-bus entrypoint Open, route rejection and repeat launch') finally: if application.poll() is None: application.terminate() diff --git a/packages/omamobile-settings/tests/core_tests.cpp b/packages/omamobile-settings/tests/core_tests.cpp index 576fe42d1..ff15811f5 100644 --- a/packages/omamobile-settings/tests/core_tests.cpp +++ b/packages/omamobile-settings/tests/core_tests.cpp @@ -83,7 +83,7 @@ private slots: for (const auto &key : {"serial", "imei", "hostname", "username", "address"}) QVERIFY(!info.info().contains(key)); } - void actualWindowAndReadOnlyPalette() { + void actualWindowAndReadOnlyAbout() { Backend backend; DeviceInfoController info(true); QQmlApplicationEngine engine; @@ -101,9 +101,7 @@ private slots: QCOMPARE(search->property("text").toString(), QString()); QVERIFY(backend.navigate("about")); QTRY_COMPARE(info.info()["model"].toString(), QString("Mobile device")); - const auto palette = QJsonDocument::fromJson(backend.SurfacePalette().toUtf8()).object(); - QCOMPARE(palette["version"].toInt(), 1); - QCOMPARE(palette["known"].toBool(), false); + } }; QTEST_MAIN(CoreTests) diff --git a/packages/omamobile-settings/tests/session_app.pro b/packages/omamobile-settings/tests/session_app.pro index 122f5991c..64b50dec5 100644 --- a/packages/omamobile-settings/tests/session_app.pro +++ b/packages/omamobile-settings/tests/session_app.pro @@ -8,3 +8,4 @@ DEFINES += OMAMOBILE_SETTINGS_TEST_DEVICE_INFO HEADERS += ../app/backend.h ../app/deviceinfocontroller.h SOURCES += ../app/main.cpp ../app/backend.cpp ../app/deviceinfocontroller.cpp RESOURCES += ../app/resources.qrc +include(../version.pri) diff --git a/packages/omamobile-settings/version.pri b/packages/omamobile-settings/version.pri new file mode 100644 index 000000000..170868e40 --- /dev/null +++ b/packages/omamobile-settings/version.pri @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +SETTINGS_VERSION = $$cat($$PWD/version, lines) +isEmpty(SETTINGS_VERSION): error(Missing Settings package version) +DEFINES += OMAMOBILE_SETTINGS_VERSION=\\\"$$SETTINGS_VERSION\\\" From 37087a74e64713827b9b872ec947cf23d9894875 Mon Sep 17 00:00:00 2001 From: Marsel Nenaj <201385099+marselnenaj@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:39:34 +0100 Subject: [PATCH 11/66] omamobile-settings: follow native Omarchy theme tokens Replace the fixed Material skin with shared native Qt controls and semantic tokens from Omarchy colors.toml and shell.toml. Follow the system monospace font, theme typography and control states live while keeping the existing read-only navigation and About scope. Observe atomic theme replacement, preserve known colors on malformed input and keep control height responsive to font metrics. The foundation retains the package-derived version and does not add pages, helpers or service actions. Co-Authored-By: Codex --- packages/omamobile-settings/app/AboutPage.qml | 27 ++-- packages/omamobile-settings/app/Main.qml | 38 ++--- .../omamobile-settings/app/SettingsButton.qml | 31 ++++ .../app/SettingsItemDelegate.qml | 25 ++++ .../omamobile-settings/app/SettingsLabel.qml | 10 ++ .../app/SettingsScrollBar.qml | 14 ++ .../omamobile-settings/app/SettingsStyle.qml | 34 +++++ .../app/SettingsTextField.qml | 37 +++++ packages/omamobile-settings/app/backend.cpp | 25 ++-- packages/omamobile-settings/app/backend.h | 10 +- packages/omamobile-settings/app/main.cpp | 2 +- packages/omamobile-settings/app/qmldir | 1 + packages/omamobile-settings/app/resources.qrc | 9 +- packages/omamobile-settings/app/themetokens.h | 133 ++++++++++++++++++ .../omamobile-settings/omamobile-settings.pro | 2 + .../omamobile-settings/tests/core_tests.cpp | 19 +++ 16 files changed, 369 insertions(+), 48 deletions(-) create mode 100644 packages/omamobile-settings/app/SettingsButton.qml create mode 100644 packages/omamobile-settings/app/SettingsItemDelegate.qml create mode 100644 packages/omamobile-settings/app/SettingsLabel.qml create mode 100644 packages/omamobile-settings/app/SettingsScrollBar.qml create mode 100644 packages/omamobile-settings/app/SettingsStyle.qml create mode 100644 packages/omamobile-settings/app/SettingsTextField.qml create mode 100644 packages/omamobile-settings/app/qmldir create mode 100644 packages/omamobile-settings/app/themetokens.h diff --git a/packages/omamobile-settings/app/AboutPage.qml b/packages/omamobile-settings/app/AboutPage.qml index 495a8d924..29e5880d6 100644 --- a/packages/omamobile-settings/app/AboutPage.qml +++ b/packages/omamobile-settings/app/AboutPage.qml @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2026 Marsel Nenaj import QtQuick +import "." import QtQuick.Controls import QtQuick.Layouts ScrollView { @@ -10,7 +11,7 @@ ScrollView { contentWidth: availableWidth clip: true function value(key) { return controller.info[key] || qsTr("Unavailable") } - ScrollBar.vertical: ScrollBar { + ScrollBar.vertical: SettingsScrollBar { width: 3; padding: 0; interactive: false active: page.contentItem.moving; opacity: active ? 0.65 : 0 contentItem: Rectangle { implicitWidth: 3; radius: 1.5; color: page.colors.muted } @@ -19,40 +20,40 @@ ScrollView { ColumnLayout { width: page.availableWidth spacing: 20 - Label { + SettingsLabel { Layout.fillWidth: true text: page.value("model") textFormat: Text.PlainText; wrapMode: Text.Wrap - font.pixelSize: 28; font.weight: Font.DemiBold + font.pixelSize: SettingsStyle.fontPx(28); font.weight: Font.DemiBold color: page.colors.foreground } - Label { + SettingsLabel { Layout.fillWidth: true text: page.value("system") textFormat: Text.PlainText; wrapMode: Text.Wrap - font.pixelSize: 15; color: page.colors.muted + font.pixelSize: SettingsStyle.fontPx(15); color: page.colors.muted } Rectangle { Layout.fillWidth: true implicitHeight: storage.implicitHeight + 32 radius: Math.min(page.colors.radius, width / 2, height / 2) - color: Qt.rgba(page.colors.foreground.r, page.colors.foreground.g, page.colors.foreground.b, 0.045) + color: SettingsStyle.surface ColumnLayout { id: storage anchors.fill: parent; anchors.margins: 16 spacing: 10 - Label { text: qsTr("Storage"); color: page.colors.foreground; font.pixelSize: 17; font.weight: Font.DemiBold } - Label { + SettingsLabel { text: qsTr("Storage"); color: page.colors.foreground; font.pixelSize: SettingsStyle.fontPx(17); font.weight: Font.DemiBold } + SettingsLabel { Layout.fillWidth: true text: page.controller.info.storageKnown ? qsTr("%1 available of %2").arg(page.value("storageFree")).arg(page.value("storageTotal")) : qsTr("Unavailable") - wrapMode: Text.Wrap; color: page.colors.muted; font.pixelSize: 14 + wrapMode: Text.Wrap; color: page.colors.muted; font.pixelSize: SettingsStyle.fontPx(14) } Rectangle { Layout.fillWidth: true; height: 6; radius: 3 visible: !!page.controller.info.storageKnown - color: Qt.rgba(page.colors.foreground.r, page.colors.foreground.g, page.colors.foreground.b, 0.10) + color: SettingsStyle.separator Rectangle { width: parent.width * Math.max(0, Math.min(1, page.controller.info.storageFraction || 0)) height: parent.height; radius: 3; color: page.colors.accent @@ -74,12 +75,12 @@ ScrollView { required property var modelData Layout.fillWidth: true spacing: 5 - Label { text: modelData.label; color: page.colors.muted; font.pixelSize: 13 } - Label { + SettingsLabel { text: modelData.label; color: page.colors.muted; font.pixelSize: SettingsStyle.fontPx(13) } + SettingsLabel { Layout.fillWidth: true text: page.value(modelData.key) textFormat: Text.PlainText; wrapMode: Text.Wrap - color: page.colors.foreground; font.pixelSize: 16 + color: page.colors.foreground; font.pixelSize: SettingsStyle.fontPx(16) } } } diff --git a/packages/omamobile-settings/app/Main.qml b/packages/omamobile-settings/app/Main.qml index 493253064..a21321374 100644 --- a/packages/omamobile-settings/app/Main.qml +++ b/packages/omamobile-settings/app/Main.qml @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2026 Marsel Nenaj import QtQuick +import "." import QtQuick.Controls -import QtQuick.Controls.Material import QtQuick.Layouts import QtQuick.Window ApplicationWindow { @@ -11,11 +11,13 @@ ApplicationWindow { height: Math.min(880, Screen.height) visible: true title: backend.title + font.family: SettingsStyle.fontFamily + palette.window: SettingsStyle.background + palette.windowText: SettingsStyle.foreground + palette.text: SettingsStyle.foreground + palette.buttonText: SettingsStyle.foreground + palette.highlight: SettingsStyle.accent color: backend.background - Material.theme: (backend.background.r * .2126 + backend.background.g * .7152 + backend.background.b * .0722) > .5 ? Material.Light : Material.Dark - Material.accent: backend.accent - Material.background: backend.background - Material.foreground: backend.foreground function goBack() { search.focus = false Qt.inputMethod.hide() @@ -34,20 +36,20 @@ ApplicationWindow { ColumnLayout { anchors.fill: parent; anchors.margins: 20 spacing: 18 - Button { + SettingsButton { visible: backend.page !== "root" || backend.searching Layout.preferredHeight: 52 - leftPadding: 0; rightPadding: 12 + leftPadding: 0; rightPadding: 12; topPadding: 0; bottomPadding: 0 onClicked: window.goBack() contentItem: Row { spacing: 4 - Label { text: "‹"; font.pixelSize: 30; color: backend.foreground } - Label { text: qsTr("Back"); font.pixelSize: 17; color: backend.foreground; anchors.verticalCenter: parent.verticalCenter } + SettingsLabel { text: "‹"; font.pixelSize: SettingsStyle.fontPx(30); color: backend.foreground } + SettingsLabel { text: qsTr("Back"); font.pixelSize: SettingsStyle.fontPx(17); color: backend.foreground; anchors.verticalCenter: parent.verticalCenter } } - background: Rectangle { color: parent.down ? Qt.rgba(backend.foreground.r, backend.foreground.g, backend.foreground.b, 0.06) : "transparent"; radius: Math.min(backend.radius, width / 2, height / 2) } + background: Rectangle { color: parent.down ? SettingsStyle.fill("normal") : "transparent"; radius: Math.min(backend.radius, width / 2, height / 2) } } - Label { text: backend.title; Layout.fillWidth: true; color: backend.foreground; font.pixelSize: 30; font.weight: Font.DemiBold; wrapMode: Text.Wrap } - TextField { + SettingsLabel { text: backend.title; Layout.fillWidth: true; color: backend.foreground; font.pixelSize: SettingsStyle.fontPx(30); font.weight: Font.DemiBold; wrapMode: Text.Wrap } + SettingsTextField { id: search objectName: "settingsSearch" Layout.fillWidth: true; Layout.preferredHeight: 52 @@ -55,7 +57,7 @@ ApplicationWindow { placeholderText: qsTr("Search settings") color: backend.foreground; placeholderTextColor: backend.muted onTextEdited: backend.search(text) - background: Rectangle { radius: Math.min(backend.radius, width / 2, height / 2); color: Qt.rgba(backend.foreground.r, backend.foreground.g, backend.foreground.b, 0.06) } + background: Rectangle { radius: Math.min(backend.radius, width / 2, height / 2); color: SettingsStyle.fill("normal") } } AboutPage { visible: window.showingAbout; Layout.fillWidth: true; Layout.fillHeight: true; controller: deviceInfo; colors: backend } ListView { @@ -63,7 +65,7 @@ ApplicationWindow { visible: !window.showingAbout Layout.fillWidth: true; Layout.fillHeight: true clip: true; model: backend.rows - delegate: ItemDelegate { + delegate: SettingsItemDelegate { required property var modelData width: list.width; implicitHeight: Math.max(80, copy.implicitHeight + 28) onClicked: { search.focus = false; Qt.inputMethod.hide(); backend.activate(modelData.id) } @@ -73,12 +75,12 @@ ApplicationWindow { ColumnLayout { id: copy Layout.fillWidth: true; spacing: 5 - Label { text: modelData.title; color: backend.foreground; font.pixelSize: 17; wrapMode: Text.Wrap; Layout.fillWidth: true } - Label { text: modelData.detail; color: backend.muted; font.pixelSize: 13; wrapMode: Text.Wrap; Layout.fillWidth: true } + SettingsLabel { text: modelData.title; color: backend.foreground; font.pixelSize: SettingsStyle.fontPx(17); wrapMode: Text.Wrap; Layout.fillWidth: true } + SettingsLabel { text: modelData.detail; color: backend.muted; font.pixelSize: SettingsStyle.fontPx(13); wrapMode: Text.Wrap; Layout.fillWidth: true } } - Label { text: "›"; color: backend.muted; font.pixelSize: 24; Accessible.ignored: true } + SettingsLabel { text: "›"; color: backend.muted; font.pixelSize: SettingsStyle.fontPx(24); Accessible.ignored: true } } - background: Rectangle { radius: Math.min(backend.radius, width / 2, height / 2); color: parent.down ? Qt.rgba(backend.accent.r, backend.accent.g, backend.accent.b, 0.10) : Qt.rgba(backend.foreground.r, backend.foreground.g, backend.foreground.b, 0.045) } + background: Rectangle { radius: Math.min(backend.radius, width / 2, height / 2); color: parent.down ? SettingsStyle.fill("pressed") : SettingsStyle.fill("normal") } } } } diff --git a/packages/omamobile-settings/app/SettingsButton.qml b/packages/omamobile-settings/app/SettingsButton.qml new file mode 100644 index 000000000..e83d1de64 --- /dev/null +++ b/packages/omamobile-settings/app/SettingsButton.qml @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtQuick.Layouts +import QtQuick.Templates as T +import "." +T.Button { + id: control + property real cornerRadius: SettingsStyle.cornerRadius + readonly property string visualState: down ? "pressed" : highlighted ? "selected" : activeFocus ? "focus" : hovered ? "hover-cursor" : "normal" + implicitWidth: Math.max(80, implicitContentWidth + leftPadding + rightPadding) + readonly property real contentMinimumHeight: Math.max(48, implicitContentHeight + topPadding + bottomPadding) + implicitHeight: contentMinimumHeight + Layout.minimumHeight: contentMinimumHeight + padding: 12 + hoverEnabled: true + font.family: SettingsStyle.fontFamily + font.pixelSize: SettingsStyle.fontPx(15) + contentItem: Text { + text: control.text; font: control.font + color: control.enabled ? SettingsStyle.foreground : SettingsStyle.disabledForeground + horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter + wrapMode: Text.Wrap; elide: Text.ElideNone; textFormat: Text.PlainText + } + background: Rectangle { + radius: Math.min(Math.max(0, control.cornerRadius), width / 2, height / 2) + color: control.flat && control.visualState === "normal" ? "transparent" : SettingsStyle.fill(control.visualState) + border.color: SettingsStyle.border(control.visualState) + border.width: control.flat && !control.activeFocus ? 0 : SettingsStyle.borderWidth(control.visualState) + opacity: control.enabled ? 1 : .5 + } +} diff --git a/packages/omamobile-settings/app/SettingsItemDelegate.qml b/packages/omamobile-settings/app/SettingsItemDelegate.qml new file mode 100644 index 000000000..e90c1b77e --- /dev/null +++ b/packages/omamobile-settings/app/SettingsItemDelegate.qml @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtQuick.Layouts +import QtQuick.Templates as T +import "." +T.ItemDelegate { + id: control + readonly property real contentMinimumHeight: Math.max(48, implicitContentHeight + topPadding + bottomPadding) + implicitWidth: 160; implicitHeight: contentMinimumHeight + Layout.minimumHeight: contentMinimumHeight + padding: 12; hoverEnabled: true + font.family: SettingsStyle.fontFamily; font.pixelSize: SettingsStyle.fontPx(15) + contentItem: Text { + text: control.text; font: control.font + color: control.enabled ? SettingsStyle.foreground : SettingsStyle.disabledForeground + verticalAlignment: Text.AlignVCenter; wrapMode: Text.Wrap; elide: Text.ElideNone; textFormat: Text.PlainText + } + background: Rectangle { + radius: SettingsStyle.radius(width, height) + readonly property string stateName: control.down ? "pressed" : control.highlighted ? "selected" : control.activeFocus ? "focus" : control.hovered ? "hover-cursor" : "normal" + color: SettingsStyle.fill(stateName) + border.color: SettingsStyle.border(stateName) + border.width: SettingsStyle.borderWidth(stateName) + } +} diff --git a/packages/omamobile-settings/app/SettingsLabel.qml b/packages/omamobile-settings/app/SettingsLabel.qml new file mode 100644 index 000000000..89e411b47 --- /dev/null +++ b/packages/omamobile-settings/app/SettingsLabel.qml @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtQuick.Templates as T +import "." +T.Label { + font.family: SettingsStyle.fontFamily + font.pixelSize: SettingsStyle.fontPx(15) + color: SettingsStyle.foreground + textFormat: Text.PlainText +} diff --git a/packages/omamobile-settings/app/SettingsScrollBar.qml b/packages/omamobile-settings/app/SettingsScrollBar.qml new file mode 100644 index 000000000..66bf67a0f --- /dev/null +++ b/packages/omamobile-settings/app/SettingsScrollBar.qml @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtQuick.Templates as T +import "." +T.ScrollBar { + id: control + implicitWidth: 3; implicitHeight: 3 + padding: 0 + contentItem: Rectangle { + implicitWidth: 3; implicitHeight: 3 + color: SettingsStyle.muted + radius: SettingsStyle.radius(width, height) + } +} diff --git a/packages/omamobile-settings/app/SettingsStyle.qml b/packages/omamobile-settings/app/SettingsStyle.qml new file mode 100644 index 000000000..e6d0da4c3 --- /dev/null +++ b/packages/omamobile-settings/app/SettingsStyle.qml @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma Singleton +import QtQuick +QtObject { + readonly property var tokens: typeof backend === "undefined" ? ({}) : backend.themeTokens + function token(name, fallback) { return tokens[name] === undefined ? fallback : tokens[name] } + readonly property color background: token("background", "#101315") + readonly property color foreground: token("foreground", "#cacccc") + readonly property color accent: token("accent", foreground) + readonly property color muted: token("muted", "#8c9090") + readonly property color error: token("error", "#a55555") + readonly property color warning: token("warning", accent) + readonly property color success: token("success", accent) + readonly property color surface: token("surface", Qt.rgba(foreground.r, foreground.g, foreground.b, .045)) + readonly property color raisedSurface: token("raisedSurface", background) + readonly property color separator: token("separator", Qt.rgba(foreground.r, foreground.g, foreground.b, .10)) + readonly property color scrim: token("scrim", Qt.rgba(background.r, background.g, background.b, .5)) + readonly property color disabledForeground: token("disabledForeground", muted) + readonly property color selection: token("selection", Qt.rgba(accent.r, accent.g, accent.b, .35)) + readonly property string fontFamily: token("fontFamily", "monospace") + readonly property real cornerRadius: typeof backend === "undefined" ? 0 : backend.radius + function radius(width, height) { return Math.min(Math.max(0, cornerRadius), width / 2, height / 2) } + function fontPx(reference) { + const roles = ({10:"caption", 12:"body-small", 14:"body-small", 15:"body", 16:"subtitle", 18:"title", 22:"heading", 24:"display", 34:"display-large"}) + const pinned = token("font." + roles[reference], 0) + return Math.max(1, Math.round(pinned > 0 ? pinned : reference * token("fontScale", 1))) + } + function fill(state) { + const alpha = ({normal:.04, "hover-cursor":.08, focus:.08, selected:.18, pressed:.22}) + return token(state + "Fill", Qt.rgba(foreground.r, foreground.g, foreground.b, alpha[state] || .04)) + } + function border(state) { return token(state + "Border", Qt.rgba(foreground.r, foreground.g, foreground.b, .4)) } + function borderWidth(state) { return token(state + "BorderWidth", state === "selected" ? 0 : 1) } +} diff --git a/packages/omamobile-settings/app/SettingsTextField.qml b/packages/omamobile-settings/app/SettingsTextField.qml new file mode 100644 index 000000000..38816c2f4 --- /dev/null +++ b/packages/omamobile-settings/app/SettingsTextField.qml @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtQuick.Layouts +import QtQuick.Templates as T +import "." +T.TextField { + id: control + readonly property real contentMinimumHeight: Math.max(48, contentHeight + topPadding + bottomPadding, placeholder.implicitHeight + topPadding + bottomPadding) + implicitWidth: 160; implicitHeight: contentMinimumHeight + Layout.minimumHeight: contentMinimumHeight + leftPadding: 16; rightPadding: 16; topPadding: 10; bottomPadding: 10 + font.family: SettingsStyle.fontFamily; font.pixelSize: SettingsStyle.fontPx(15) + color: enabled ? SettingsStyle.foreground : SettingsStyle.disabledForeground + placeholderTextColor: SettingsStyle.muted + selectionColor: SettingsStyle.selection + selectedTextColor: SettingsStyle.foreground + verticalAlignment: TextInput.AlignVCenter + Text { + id: placeholder + objectName: "nativePlaceholder" + x: control.leftPadding; y: control.topPadding + width: control.width - control.leftPadding - control.rightPadding + height: control.height - control.topPadding - control.bottomPadding + text: control.placeholderText; font: control.font + color: control.placeholderTextColor + verticalAlignment: Text.AlignVCenter; elide: Text.ElideRight + textFormat: Text.PlainText + visible: control.length === 0 && control.preeditText.length === 0 + } + background: Rectangle { + radius: SettingsStyle.radius(width, height) + color: SettingsStyle.fill("normal") + border.color: SettingsStyle.border(control.activeFocus ? "focus" : "normal") + border.width: SettingsStyle.borderWidth(control.activeFocus ? "focus" : "normal") + opacity: control.enabled ? 1 : .5 + } +} diff --git a/packages/omamobile-settings/app/backend.cpp b/packages/omamobile-settings/app/backend.cpp index 970213a93..2750ace03 100644 --- a/packages/omamobile-settings/app/backend.cpp +++ b/packages/omamobile-settings/app/backend.cpp @@ -107,21 +107,20 @@ QStringList Backend::catalogProblems() const { } void Backend::reloadTheme() { QFile file(m_themeFile); - if (file.open(QIODevice::ReadOnly) && file.size() <= 65536) { - const auto content = QString::fromUtf8(file.readAll()); - auto color = [&content](const QString &key, QColor previous) { - const auto match = QRegularExpression("(?:^|\\n)\\s*" + key + "\\s*=\\s*[\"'](#[0-9a-fA-F]{6})[\"']").match(content); - return match.hasMatch() ? QColor(match.captured(1)) : previous; - }; - m_background = color("background", m_background); - m_foreground = color("foreground", m_foreground); - m_accent = color("accent", m_accent); - m_muted = QColor::fromRgbF(m_foreground.redF() * .78 + m_background.redF() * .22, - m_foreground.greenF() * .78 + m_background.greenF() * .22, - m_foreground.blueF() * .78 + m_background.blueF() * .22); + if (file.open(QIODevice::ReadOnly)) { + QFile shell(QFileInfo(m_themeFile).absolutePath() + "/shell.toml"); + QByteArray shellBytes; + if (shell.open(QIODevice::ReadOnly)) shellBytes = shell.read(262145); + QString family = qEnvironmentVariable("OMARCHY_MENU_FONT").trimmed(); + if (family.isEmpty()) family = "monospace"; + m_themeTokens = SettingsTheme::tokens(file.read(262145), shellBytes, family, m_themeTokens); + m_background = m_themeTokens["background"].value(); + m_foreground = m_themeTokens["foreground"].value(); + m_accent = m_themeTokens["accent"].value(); + m_muted = m_themeTokens["muted"].value(); } const auto existing = m_watcher.files() + m_watcher.directories(); - for (const auto &path : {m_themeFile, QFileInfo(m_themeFile).absolutePath(), + for (const auto &path : {m_themeFile, QFileInfo(m_themeFile).absolutePath()+"/shell.toml", QFileInfo(m_themeFile).absolutePath(), QDir::homePath() + "/.local/state/omarchy/current"}) if (QFileInfo::exists(path) && !existing.contains(path)) m_watcher.addPath(path); if (m_roundingQuery.state() == QProcess::NotRunning) { diff --git a/packages/omamobile-settings/app/backend.h b/packages/omamobile-settings/app/backend.h index bf045c51b..8577bc4c3 100644 --- a/packages/omamobile-settings/app/backend.h +++ b/packages/omamobile-settings/app/backend.h @@ -7,6 +7,7 @@ #include #include #include +#include "themetokens.h" class Backend : public QObject { Q_OBJECT @@ -15,6 +16,7 @@ class Backend : public QObject { Q_PROPERTY(QString page READ page NOTIFY rowsChanged) Q_PROPERTY(QString title READ title NOTIFY rowsChanged) Q_PROPERTY(bool searching READ searching NOTIFY rowsChanged) + Q_PROPERTY(QVariantMap themeTokens READ themeTokens NOTIFY themeChanged) Q_PROPERTY(QColor background READ background NOTIFY themeChanged) Q_PROPERTY(QColor foreground READ foreground NOTIFY themeChanged) Q_PROPERTY(QColor accent READ accent NOTIFY themeChanged) @@ -27,6 +29,7 @@ class Backend : public QObject { QString page() const { return m_page; } QString title() const; bool searching() const { return !m_query.isEmpty(); } + QVariantMap themeTokens() const { return m_themeTokens; } QColor background() const { return m_background; } QColor foreground() const { return m_foreground; } QColor accent() const { return m_accent; } @@ -56,6 +59,9 @@ class Backend : public QObject { QProcess m_roundingQuery; quint64 m_roundingGeneration = 0; int m_radius = 0; - QColor m_background = QColor("#1a1b26"), m_foreground = QColor("#c0caf5"), - m_accent = QColor("#9ece6a"), m_muted = QColor("#8b93b8"); + QVariantMap m_themeTokens = SettingsTheme::tokens({}, {}); + QColor m_background = m_themeTokens["background"].value(), + m_foreground = m_themeTokens["foreground"].value(), + m_accent = m_themeTokens["accent"].value(), + m_muted = m_themeTokens["muted"].value(); }; diff --git a/packages/omamobile-settings/app/main.cpp b/packages/omamobile-settings/app/main.cpp index 4ede61fb1..5848e68ca 100644 --- a/packages/omamobile-settings/app/main.cpp +++ b/packages/omamobile-settings/app/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char **argv) { app.setApplicationName("omamobile-settings"); app.setApplicationVersion(QStringLiteral(OMAMOBILE_SETTINGS_VERSION)); app.setDesktopFileName("org.omamobile.Settings"); - QQuickStyle::setStyle("Material"); + QQuickStyle::setStyle("Basic"); Backend backend; #ifdef OMAMOBILE_SETTINGS_TEST_DEVICE_INFO // Only the separately built test entrypoint fixes read-only model data. diff --git a/packages/omamobile-settings/app/qmldir b/packages/omamobile-settings/app/qmldir new file mode 100644 index 000000000..c309b23a6 --- /dev/null +++ b/packages/omamobile-settings/app/qmldir @@ -0,0 +1 @@ +singleton SettingsStyle 1.0 SettingsStyle.qml diff --git a/packages/omamobile-settings/app/resources.qrc b/packages/omamobile-settings/app/resources.qrc index d240fb3e6..7d3fb01f4 100644 --- a/packages/omamobile-settings/app/resources.qrc +++ b/packages/omamobile-settings/app/resources.qrc @@ -5,5 +5,12 @@ AboutPage.qml catalog.json icons/system.svg - + SettingsStyle.qml + SettingsButton.qml + SettingsTextField.qml + SettingsLabel.qml + SettingsItemDelegate.qml + SettingsScrollBar.qml + qmldir + diff --git a/packages/omamobile-settings/app/themetokens.h b/packages/omamobile-settings/app/themetokens.h new file mode 100644 index 000000000..c64aa982b --- /dev/null +++ b/packages/omamobile-settings/app/themetokens.h @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2026 Marsel Nenaj +#pragma once +#include +#include +#include +#include +#include +#include +#include + +// Pure Qt adapter for Omarchy colors.toml and shell.toml scalar theme tokens. +// Navigation, touch targets and physical safe areas are not theme inputs. +namespace SettingsTheme { +inline QVariantMap scalars(const QByteArray &bytes) { + QVariantMap values; + if (bytes.size() > 262144 || bytes.contains('\0')) return values; + QString section; + for (QString line : QString::fromUtf8(bytes).split('\n')) { + // A TOML comment begins outside a quoted scalar, never inside a color. + QChar quote; + bool escaped = false; + for (int i = 0; i < line.size(); ++i) { + const auto ch = line[i]; + if (escaped) { escaped = false; continue; } + if (!quote.isNull() && quote == '"' && ch == '\\') { escaped = true; continue; } + if (ch == quote) quote = QChar(); + else if (quote.isNull() && (ch == '"' || ch == '\'')) quote = ch; + else if (quote.isNull() && ch == '#') { line.truncate(i); break; } + } + line = line.trimmed(); + if (line.isEmpty()) continue; + const auto group = QRegularExpression("^\\[([A-Za-z0-9_-]+)\\]$").match(line); + if (group.hasMatch()) { section = group.captured(1); continue; } + const auto assignment = QRegularExpression("^([A-Za-z0-9_-]+)\\s*=\\s*(.+)$").match(line); + if (!assignment.hasMatch()) continue; + const auto key = (section.isEmpty() ? QString() : section + '.') + assignment.captured(1); + const auto raw = assignment.captured(2).trimmed(); + QVariant value; + if (raw.startsWith('"')) { + const auto parsed = QJsonDocument::fromJson(('[' + raw + ']').toUtf8()); + if (parsed.isArray() && parsed.array().size() == 1 && parsed.array()[0].isString()) + value = parsed.array()[0].toString(); + } else if (raw.size() >= 2 && raw.startsWith('\'') && raw.endsWith('\'')) { + value = raw.mid(1, raw.size() - 2); + } else if (raw == "true" || raw == "false") value = raw == "true"; + else if (QRegularExpression("^[+-]?(?:[0-9]+(?:\\.[0-9]+)?|\\.[0-9]+)$").match(raw).hasMatch()) { + bool ok = false; + const auto number = raw.toDouble(&ok); + if (ok && std::isfinite(number)) value = number; + } + if (value.isValid()) values.insert(key, value); + } + return values; +} +inline double number(const QVariantMap &values, const QString &key, double fallback, + double minimum, double maximum) { + const auto value = values.value(key); + if (value.metaType().id() != QMetaType::Double) return fallback; + const auto result = value.toDouble(); + return std::isfinite(result) && result >= minimum && result <= maximum ? result : fallback; +} +inline QColor color(const QVariantMap &values, QString key, const QColor &fallback) { + QStringList seen; + for (int i = 0; i < 12; ++i) { + if (seen.contains(key)) return fallback; + seen.append(key); + const auto value = values.value(key); + if (value.metaType().id() != QMetaType::QString) return fallback; + const auto text = value.toString().trimmed(); + if (QRegularExpression("^#[0-9a-fA-F]{6}$").match(text).hasMatch()) return QColor(text); + // References use the same role/section.key vocabulary as shell.toml. + key = text == "text" ? QStringLiteral("foreground") : text; + } + return fallback; +} +inline QColor alpha(QColor color, double opacity) { color.setAlphaF(opacity); return color; } +inline QColor mix(const QColor &a, const QColor &b, double amount) { + return QColor::fromRgbF(a.redF() * amount + b.redF() * (1 - amount), + a.greenF() * amount + b.greenF() * (1 - amount), + a.blueF() * amount + b.blueF() * (1 - amount)); +} +inline QColor knownColor(const QVariantMap &previous, const QString &key, const QColor &fallback) { + const auto value=previous.value(key); + return value.metaType().id()==QMetaType::QColor && value.value().isValid() + ? value.value() : fallback; +} +inline QVariantMap tokens(const QByteArray &colors, const QByteArray &shell, + const QString &systemFamily = QStringLiteral("monospace"), + const QVariantMap &previous = {}) { + auto values = scalars(colors); + const auto overrides = scalars(shell); + for (auto it = overrides.begin(); it != overrides.end(); ++it) values[it.key()] = it.value(); + const QColor background = alpha(color(values, "menu.background", color(values, "background", knownColor(previous,"background",QColor("#101315")))), + number(values, "menu.background-alpha", 1, 0, 1)); + const QColor foreground = color(values, "menu.text", color(values, "foreground", knownColor(previous,"foreground",QColor("#cacccc")))); + const QColor accent = color(values, "accent", knownColor(previous,"accent",foreground)); + const QColor muted = mix(foreground, background, .64); + QVariantMap out{{"background", background}, {"foreground", foreground}, {"accent", accent}, + {"muted", color(values, "muted", color(values, "color8", muted))}, + {"error", color(values, "red", QColor("#a55555"))}, + {"warning", color(values, "yellow", accent)}, + {"success", color(values, "green", accent)}, + {"surface", color(values, "lighter_background", mix(foreground, background, .045))}, + {"raisedSurface", color(values, "popups.background", background)}, + {"separator", alpha(foreground, .10)}, + {"scrim", alpha(color(values, "menu.scrim", background), number(values, "menu.scrim-alpha", .5, 0, 1))}, + {"disabledForeground", mix(foreground, background, .38)}}; + // Omarchy resolves the system monospace fontconfig alias and optional + // OMARCHY_MENU_FONT override; [font] supplies size roles, not a new family. + out["fontFamily"] = systemFamily; + out["fontScale"] = number(values, "font.base-size", 12, 1, 96) / 12.0; + // Optional explicit type-role pins use Omarchy's existing [font] names. + for (const QString &role : {QStringLiteral("caption"), QStringLiteral("body-small"), QStringLiteral("body"), + QStringLiteral("subtitle"), QStringLiteral("title"), QStringLiteral("heading"), + QStringLiteral("display"), QStringLiteral("display-large")}) + out["font." + role] = number(values, "font." + role, 0, 1, 192); + const QStringList states{"normal", "hover-cursor", "focus", "selected", "pressed"}; + const QList fills{.04, .08, .08, .18, .22}; + for (int i = 0; i < states.size(); ++i) { + const auto state = states[i]; + const auto prefix = "controls." + state; + const auto fill = color(values, prefix + "-color", foreground); + out[state + "Fill"] = alpha(fill, number(values, prefix + "-fill-alpha", fills[i], 0, 1)); + out[state + "Border"] = alpha(color(values, prefix + "-border", foreground), + number(values, prefix + "-border-alpha", i == 0 ? .4 : .25, 0, 1)); + out[state + "BorderWidth"] = number(values, prefix + "-border-width", i == 3 ? 0 : 1, 0, 4); + } + out["selection"] = alpha(color(values, "controls.selection-color", accent), + number(values, "controls.selection-fill-alpha", .35, 0, 1)); + return out; +} +} diff --git a/packages/omamobile-settings/omamobile-settings.pro b/packages/omamobile-settings/omamobile-settings.pro index 9b30af5dc..b4e55810f 100644 --- a/packages/omamobile-settings/omamobile-settings.pro +++ b/packages/omamobile-settings/omamobile-settings.pro @@ -8,3 +8,5 @@ HEADERS += app/backend.h app/deviceinfocontroller.h SOURCES += app/main.cpp app/backend.cpp app/deviceinfocontroller.cpp RESOURCES += app/resources.qrc include(version.pri) + +HEADERS += app/themetokens.h diff --git a/packages/omamobile-settings/tests/core_tests.cpp b/packages/omamobile-settings/tests/core_tests.cpp index ff15811f5..f3f982a90 100644 --- a/packages/omamobile-settings/tests/core_tests.cpp +++ b/packages/omamobile-settings/tests/core_tests.cpp @@ -69,6 +69,25 @@ private slots: QTest::qWait(100); QCOMPARE(backend.background(), QColor("#ddeeff")); } + void officialFontAndControlTokensObserveAtomicChanges() { + const auto directory=QDir::homePath()+"/.local/state/omarchy/current/theme"; + QVERIFY(QDir().mkpath(directory)); + const auto save=[](const QString &path,const QByteArray &bytes) { + QSaveFile file(path); + return file.open(QIODevice::WriteOnly) && file.write(bytes)==bytes.size() && file.commit(); + }; + QVERIFY(save(directory+"/colors.toml","background='#112233'\nforeground='#eeeeee'\naccent='#66aa88'\nmuted='#778899'\n")); + QVERIFY(save(directory+"/shell.toml","[font]\nbase-size=12\n[controls]\nnormal-fill-alpha=0.04\n")); + Backend backend; + QCOMPARE(backend.themeTokens()["fontScale"].toDouble(),1.0); + QCOMPARE(backend.muted(),QColor("#778899")); + const auto page=backend.page(); + QVERIFY(save(directory+"/shell.toml","[font]\nbase-size=18\nbody=19\n[controls]\nnormal-color='accent'\nnormal-fill-alpha=0.2\nfocus-border-width=2\n")); + QTRY_COMPARE(backend.themeTokens()["fontScale"].toDouble(),1.5); + QCOMPARE(backend.themeTokens()["font.body"].toInt(),19); + QCOMPARE(backend.themeTokens()["focusBorderWidth"].toInt(),2); + QCOMPARE(backend.page(),page); + } void neutralPreviewAndUnknownValues() { DeviceInfoController info(true); QSignalSpy changed(&info, &DeviceInfoController::changed); From 8237df519bc689ff9bdba26f19777db1829a1e49 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 8 Nov 2026 11:48:05 -0600 Subject: [PATCH 12/66] extract-vendor-firmware: build each run in a new generation (#491) The extractor wrote straight into OUTDIR. The plans run it into the default out/vendor-firmware and tar that tree onto the phone, so a rerun for another image or device kept the earlier run's firmware and sensor registry files, and the firmware went into vendor-firmware.sha256 as if it were this run's. On ext4, debugfs exits 0 when a copy fails: for a missing file it writes nothing, so an older copy of the same name passed the size check, and for a short write (a full disk, a file size limit) it leaves a truncated file that passed too. A run that failed half way left a mix of old and new files. Each run now extracts into an empty staging directory inside OUTDIR (the -c camera APEX into a new file beside it), runs the checks there, checks that the checksum list names exactly the mapped files, and only then moves the previous outputs aside and the new ones into place: renames within OUTDIR, then the -c file. A failed run leaves the previous outputs and the -c file as they were; if a rename fails while publishing, what was already replaced is put back. The script replaces only what it writes: usr/lib/firmware/updates, usr/share/omamobile/sensors, vendor-firmware.sha256 and the -c file; the rest of OUTDIR stays. An ext4 copy fails on any debugfs message but its banner and the exact notes that it can't give a file the image's owner (as a user); the messages are read in the shell, so a nearly full disk can't hide them. A -c that names a directory, or a path inside the outputs the run replaces, is refused before anything is extracted, and so is an -o that resolves to / (/, //, /usr/.., a link to /), before the scratch directory is made. tools/phone-provision already extracts into a new directory per run; it calls the tool the same way as before. tests/extract-vendor-firmware (run by tests/all) runs the tool on made-up files with stand-in debugfs and fsck.erofs that print real debugfs's messages, and, where the host has mkfs.ext4 and debugfs, on a real ext4 image of the same files with a root-owned registry: a reused directory keeps no earlier firmware or registry file, a husky run drops a cheetah registry, and a missing file or registry, a short write (also under a file size limit), a failed sanity check, a missing camera APEX or a failed rename leaves the previous outputs byte for byte. Against the tool before this change, only 2 of its checks pass. No factory image was read and nothing ran on a phone. Found in an audit of the tools. Co-Authored-By: Claude Opus 5.5 --- tests/all | 7 +- tests/extract-vendor-firmware | 362 ++++++++++++++++++++++++++++++++++ tools/extract-vendor-firmware | 115 +++++++++-- 3 files changed, 467 insertions(+), 17 deletions(-) create mode 100755 tests/extract-vendor-firmware diff --git a/tests/all b/tests/all index 7417b0fe9..0f79edbb2 100755 --- a/tests/all +++ b/tests/all @@ -21,8 +21,9 @@ # tools/phone-smoke's dmesg error classification, the OWL conformance # report's differences on the host, bin/lineage-ref sync's branch handling # against stand-ins for docker and repo, tools/repo-publish --from-main's -# copy of the prebuilt binaries into a fixture's publish tree, and -# tools/repo-publish's staging. +# copy of the prebuilt binaries into a fixture's publish tree, +# tools/repo-publish's staging, and tools/extract-vendor-firmware's output +# generations (made-up files, no factory image). set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." for f in tools/install-phone tools/phone-provision tools/nv-backup tools/build-rootfs tools/build-packages tools/make-bundle \ @@ -39,7 +40,7 @@ sh -n device/flame/initramfs/build bash -n tools/build-flame-probe echo "ok - scripts parse" python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware; do echo "# $t" "$t" done diff --git a/tests/extract-vendor-firmware b/tests/extract-vendor-firmware new file mode 100755 index 000000000..a4b13271f --- /dev/null +++ b/tests/extract-vendor-firmware @@ -0,0 +1,362 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Tests for tools/extract-vendor-firmware with made-up vendor files (no +# factory image, no Google firmware): a small file with the ext4 or EROFS +# magic stands in for vendor.img, and stand-in debugfs and fsck.erofs read +# a fixture tree instead (with real debugfs's stderr: a missing file or a +# failed write is an error message and exit 0). Checked: a run into a +# reused output directory keeps no firmware or sensor registry file from +# an earlier run (another device's, or one the new image doesn't have), +# and leaves the rest of the directory alone; a husky run drops an earlier +# registry; a successful run's checksum list names exactly the mapped +# files; a failed run (a missing file or registry, debugfs reporting a +# short write, also under a file size limit, a failed sanity check, a +# missing camera APEX) leaves the previous outputs and the -c file byte +# for byte, so an older file can't pass for a missing one; a -c that is a +# directory or inside the outputs is refused; an -o that resolves to / is +# refused before anything is written; and a move that fails while +# publishing puts the previous outputs back. With mkfs.ext4 +# and debugfs on the host, the same on a real ext4 image whose registry +# belongs to root, and a copy that a file size limit cuts short. EVF=path +# runs another copy of the tool (a negative control), so every check runs +# and the failures are counted rather than stopping at the first. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +EVF=$(realpath -- "${EVF:-tools/extract-vendor-firmware}") +failed=0 +fail() { printf 'not ok - %s\n' "$1" >&2; failed=$((failed + 1)); } +pass() { printf 'ok - %s\n' "$1"; } +# pass_since N MESSAGE: pass if nothing failed since the count was N +pass_since() { if ((failed == $1)); then pass "$2"; fi; } +t=$(mktemp -d) +trap 'rm -rf "$t"' EXIT +export PATH=$PATH:/usr/sbin:/sbin + +# --- Stand-ins ----------------------------------------------------------------- +mkdir -p "$t/bin" +cat > "$t/bin/debugfs" <<'EOF' +#!/bin/bash +# debugfs -R "dump /SRC OUT" IMG, or "rdump /DIR OUTDIR", from $FAKE_VENDOR, +# with real debugfs's stderr: its banner, rdump's ownership note (run as a +# user), and errors with exit 0; a dump of the path in .fail-dump, or the +# rdump when .fail-rdump exists, writes part and reports a write error +set -u +echo "debugfs 1.47.2 (stand-in)" >&2 +read -r cmd src out <<<"$2" +if [[ -f $FAKE_VENDOR/.fail-dump && $src == "/$(cat "$FAKE_VENDOR/.fail-dump")" ]] || + [[ $cmd == rdump && -f $FAKE_VENDOR/.fail-rdump ]]; then + if [[ $cmd == dump ]]; then + echo partial > "$out" + echo "dump_file: File too large while writing file \"$src\"" >&2 + else # after many real notes, an error whose file name holds their words + mkdir -p "$out/${src##*/}" && echo partial > "$out/${src##*/}/part.json" + for n in $(seq 800); do + echo "dump_file: Operation not permitted while changing ownership of $out/${src##*/}/e$n.json" + done >&2 + echo "rdump: Too many open files while opening $out/${src##*/}/x while changing ownership of y.json" >&2 + fi + exit 0 +fi +case $cmd in + dump) [[ -f $FAKE_VENDOR$src ]] && cp "$FAKE_VENDOR$src" "$out" ;; + rdump) [[ -d $FAKE_VENDOR$src ]] && cp -r "$FAKE_VENDOR$src" "$out/" && + echo "dump_file: Operation not permitted while changing ownership of $out/${src##*/}/x" >&2 && + echo "rdump: Operation not permitted while changing ownership of $out/${src##*/}" >&2 ;; +esac || echo "$cmd: File not found by ext2_lookup while looking up $src" >&2 +exit 0 +EOF +cat > "$t/bin/fsck.erofs" <<'EOF' +#!/bin/bash +# fsck.erofs --extract=DIR --no-preserve IMG, from $FAKE_VENDOR +set -eu +dir=${1#--extract=} +mkdir -p "$dir" && cp -r "$FAKE_VENDOR/." "$dir/" +EOF +chmod +x "$t/bin/debugfs" "$t/bin/fsck.erofs" + +# vendor.img stand-ins: only the magic the tool checks +head -c 4096 /dev/zero > "$t/ext4.img" +printf '\x53\xef' | dd of="$t/ext4.img" bs=1 seek=1080 conv=notrunc status=none +head -c 4096 /dev/zero > "$t/erofs.img" +printf '\xe2\xe1\xf5\xe0' | dd of="$t/erofs.img" bs=1 seek=1024 conv=notrunc status=none + +# --- Made-up vendor trees -------------------------------------------------------- +halo() { printf 'WMFW\0\0\0\0\0\0\004 %s' "$*"; } # WMFW, byte 10 = 4 (Halo core) +# make_vendor DIR DEVICE GENERATION: the files the tool maps, its sanity +# checks pass; GENERATION goes into every file +make_vendor() { + local v=$1 dev=$2 g=$3 f + mkdir -p "$v/firmware/brcm" "$v/etc/sensors/registry" "$v/apex" + printf 'ro.product.vendor.device=%s\nro.vendor.build.fingerprint=fictional/%s\n' "$dev" "$g" > "$v/build.prop" + if [[ $dev == husky ]]; then + printf 'fictional 4398d0-roml Version=1.0.3 (%s)\n' "$g" > "$v/firmware/fw_bcmdhd.bin_4398_d0" + printf 'NVRAMRev=%s\n' "$g" > "$v/firmware/bcmdhd.cal_USI_G5SN_9957_V17" + echo "clm $g" > "$v/firmware/bcmdhd_clm.blob_4398_d0" + echo "txcap $g" > "$v/firmware/bcmdhd_txcap.blob_4398_d0" + return + fi + printf 'fictional 4389c1-roml Version=1.0.1 (%s)\n' "$g" > "$v/firmware/fw_bcmdhd.bin" + printf 'NVRAMRev=%s\n' "$g" > "$v/firmware/bcmdhd.cal" + echo "clm $g" > "$v/firmware/bcmdhd_clm.blob" + echo "BCM4389C1 fictional $g" > "$v/firmware/brcm/BCM.hcd" + echo "aoc $g" > "$v/firmware/aoc.bin" + halo "FIRMWARE_CS40L26 BUZZ_EFFECTS2_BUZZ_LEVEL $g" > "$v/firmware/cs40l26.wmfw" + halo "calib $g" > "$v/firmware/cs40l26-calib.wmfw" + for f in cs40l26.bin cs40l26-svc.bin cs40l26-dvl.bin; do echo "WMDR $f $g" > "$v/firmware/$f"; done + halo "FIRMWARE_HALO_CSPL CAL_CHECKSUM $g" > "$v/firmware/cs35l41-dsp1-spk-prot.wmfw" + echo "WMDR top $g" > "$v/firmware/cs35l41-dsp1-spk-prot.bin" + echo "WMDR bottom $g" > "$v/firmware/R-cs35l41-dsp1-spk-prot.bin" + echo '3,1,2' > "$v/firmware/fast_switch3.txt" + echo '3,1,3' > "$v/firmware/fast_switch4.txt" + echo "{\"accel\": \"$g\"}" > "$v/etc/sensors/registry/fictional_accel.json" + echo "apex $g" > "$v/apex/com.google.pixel.camera.hal.apex" +} +make_vendor "$t/v1" cheetah gen1 +make_vendor "$t/v2" cheetah gen2 +make_vendor "$t/husky" husky gen3 + +FW=usr/lib/firmware/updates +REG=usr/share/omamobile/sensors/registry +CHEETAH_FILES="aoc.bin +brcm/BCM.google,gs201-cheetah.hcd +brcm/brcmfmac4389c1-pcie.google,gs201-cheetah.bin +brcm/brcmfmac4389c1-pcie.google,gs201-cheetah.clm_blob +brcm/brcmfmac4389c1-pcie.google,gs201-cheetah.txt +cirrus/cs35l41-cheetah-bottom-media-delta.txt +cirrus/cs35l41-cheetah-top-media-delta.txt +cirrus/cs35l41-dsp1-spk-prot-cheetah-bottom.bin +cirrus/cs35l41-dsp1-spk-prot-cheetah-top.bin +cirrus/cs35l41-dsp1-spk-prot-cheetah.wmfw +cs40l26-calib.wmfw +cs40l26-dvl.bin +cs40l26-svc.bin +cs40l26.bin +cs40l26.wmfw" + +# run VENDOR IMG ARGS...: the tool with the stand-ins first on PATH +run() { + local v=$1 img=$2; shift 2 + FAKE_VENDOR=$v PATH=$t/bin:$PATH "$EVF" -w "$t/work" "$@" "$img" > "$t/log" 2>&1 +} +# Everything in a directory, contents included, hidden staging dirs too +snap() { (cd "$1" && find . -printf '%y %m %p\n' | LC_ALL=C sort && find . -type f -print0 | LC_ALL=C sort -z | xargs -0r sha256sum); } +listed() { cut -c67- "$1/vendor-firmware.sha256" | LC_ALL=C sort; } +# A first generation in a fresh directory, plus files a previous run (or +# another device's) left behind, and a file that isn't the tool's +seed() { + local o=$1 + rm -rf "$o" + run "$t/v1" "$t/ext4.img" -o "$o" || { cat "$t/log"; fail "seed: a first extraction into $o succeeds"; return; } + echo stale > "$o/$FW/brcm/brcmfmac4389c1-pcie.google,gs201-panther.bin" + echo stale > "$o/$FW/old-only.bin" + echo stale > "$o/$REG/stale_sensor.json" + echo mine > "$o/notes.txt" +} +# A failed run over a seeded directory leaves it (and the -c file) exactly +# as it was +refuses() { # NAME EXPECTED-ERROR VENDOR IMG ARGS... + local name=$1 err=$2 o=$t/refused before; shift 2 + seed "$o" + [[ -s $o/vendor-firmware.sha256 ]] || { fail "$name: there is a previous generation to keep"; return; } + before=$(snap "$o") + if run "$@" -o "$o"; then fail "$name: refused"; return; fi + grep -qF -- "$err" "$t/log" || { cat "$t/log"; fail "$name: says '$err'"; return; } + [[ $(snap "$o") == "$before" ]] || { diff <(echo "$before") <(snap "$o") || true; fail "$name: the previous outputs stay as they were"; return; } + pass "$name: refused, the previous outputs untouched" +} + +# --- A fresh run --------------------------------------------------------------- +o=$t/fresh n=$failed +if run "$t/v1" "$t/ext4.img" -o "$o"; then + [[ $(listed "$o") == "$CHEETAH_FILES" ]] || fail "fresh: the checksum list names exactly the mapped files" + (cd "$o/$FW" && sha256sum --quiet -c "$o/vendor-firmware.sha256") || fail "fresh: the checksums match" + top=$(find "$o" -mindepth 1 -maxdepth 1 -printf '%f\n' | LC_ALL=C sort | tr '\n' ' ') + [[ $top == "usr vendor-firmware.sha256 " ]] || fail "fresh: nothing but usr and the checksum list in OUT (got: $top)" + [[ $(cat "$o/$REG/fictional_accel.json") == '{"accel": "gen1"}' ]] || fail "fresh: the registry is copied" + pass_since "$n" "fresh: a first run stages the mapped files, the registry and their checksums" +else + cat "$t/log"; fail "fresh: a first run succeeds" +fi + +# --- A reused output directory ------------------------------------------------- +o=$t/reuse n=$failed +seed "$o" +if run "$t/v2" "$t/ext4.img" -o "$o"; then + [[ ! -e "$o/$FW/brcm/brcmfmac4389c1-pcie.google,gs201-panther.bin" && ! -e "$o/$FW/old-only.bin" ]] || + fail "reuse: no firmware from an earlier run stays" + [[ ! -e "$o/$REG/stale_sensor.json" ]] || fail "reuse: no sensor registry file from an earlier run stays" + [[ $(listed "$o") == "$CHEETAH_FILES" ]] || fail "reuse: the checksum list names only this run's files" + [[ $(cat "$o/$FW/aoc.bin") == "aoc gen2" && $(cat "$o/$REG/fictional_accel.json") == '{"accel": "gen2"}' ]] || + fail "reuse: the files are this run's" + [[ $(cat "$o/notes.txt") == mine ]] || fail "reuse: a file that isn't the tool's stays" + [[ -z $(find "$o" -maxdepth 1 -name '.extract-vendor-firmware.*') ]] || fail "reuse: no staging directory left in OUT" + pass_since "$n" "reuse: a second run replaces the earlier generation and keeps nothing from it" +else + cat "$t/log"; fail "reuse: a second run succeeds" +fi + +o=$t/husky-reuse n=$failed +seed "$o" +if run "$t/husky" "$t/ext4.img" -d husky -o "$o"; then + [[ ! -e $o/usr/share/omamobile/sensors ]] || fail "husky: an earlier device's sensor registry is dropped" + [[ $(listed "$o" | tr '\n' ' ') == "brcm/brcmfmac4398d0-pcie.google,zuma-husky.bin brcm/brcmfmac4398d0-pcie.google,zuma-husky.clm_blob brcm/brcmfmac4398d0-pcie.google,zuma-husky.txcap_blob brcm/brcmfmac4398d0-pcie.google,zuma-husky.txt " ]] || + fail "husky: the checksum list names husky's four files only" + [[ $(find "$o/$FW" -type f | wc -l) == 4 ]] || fail "husky: no cheetah firmware stays" + pass_since "$n" "husky: a run over a cheetah generation leaves only husky's files" +else + cat "$t/log"; fail "husky: a run over a cheetah generation succeeds" +fi + +# --- Failed runs leave the previous generation ---------------------------------- +rm -rf "$t/v2-missing"; cp -r "$t/v2" "$t/v2-missing"; rm "$t/v2-missing/firmware/aoc.bin" +refuses "a missing ext4 file with an older copy in OUT" "/vendor/firmware/aoc.bin is missing" "$t/v2-missing" "$t/ext4.img" +refuses "a missing EROFS file with an older copy in OUT" "/vendor/firmware/aoc.bin is missing" "$t/v2-missing" "$t/erofs.img" + +rm -rf "$t/v2-noreg"; cp -r "$t/v2" "$t/v2-noreg"; rm -r "$t/v2-noreg/etc/sensors/registry" +refuses "a missing sensor registry with an older one in OUT" "/vendor/etc/sensors/registry is missing" "$t/v2-noreg" "$t/ext4.img" + +rm -rf "$t/v2-dumpfail"; cp -r "$t/v2" "$t/v2-dumpfail"; echo firmware/cs40l26.bin > "$t/v2-dumpfail/.fail-dump" +refuses "debugfs reporting a short write (exit 0)" "/vendor/firmware/cs40l26.bin is missing" "$t/v2-dumpfail" "$t/ext4.img" +rm -rf "$t/v2-rdumpfail"; cp -r "$t/v2" "$t/v2-rdumpfail"; touch "$t/v2-rdumpfail/.fail-rdump" +refuses "debugfs reporting a short write in the registry (exit 0)" "/vendor/etc/sensors/registry is missing" "$t/v2-rdumpfail" "$t/ext4.img" +# The same under a file size limit on the run (as on a nearly full disk): +# reading debugfs's messages must not need a file of its own +o=$t/refused-limited n=$failed +seed "$o" +before=$(snap "$o") +if (trap '' XFSZ; ulimit -f 8; run "$t/v2-rdumpfail" "$t/ext4.img" -o "$o"); then + fail "a registry short write under a file size limit: refused" +elif [[ $(snap "$o") != "$before" ]]; then + cat "$t/log"; fail "a registry short write under a file size limit: the previous outputs stay as they were" +fi +pass_since "$n" "a registry short write under a file size limit: refused, the previous outputs untouched" + +rm -rf "$t/v2-same"; cp -r "$t/v2" "$t/v2-same" +cp "$t/v2-same/firmware/cs35l41-dsp1-spk-prot.bin" "$t/v2-same/firmware/R-cs35l41-dsp1-spk-prot.bin" +refuses "a sanity check failing after every copy" "the top and bottom speaker tunings are the same file" "$t/v2-same" "$t/ext4.img" + +# The camera APEX (-c) is replaced only by a successful run +echo "old apex" > "$t/camera.apex" +rm -rf "$t/v2-noapex"; cp -r "$t/v2" "$t/v2-noapex"; rm "$t/v2-noapex/apex/com.google.pixel.camera.hal.apex" +refuses "a missing camera APEX with an older one at -c" "camera.hal.apex is missing" "$t/v2-noapex" "$t/ext4.img" -c "$t/camera.apex" +[[ $(cat "$t/camera.apex") == "old apex" ]] || fail "camera: the -c file stays after a failed run" +[[ -z $(find "$t" -maxdepth 1 -name 'camera.apex.*') ]] || fail "camera: no temporary APEX left beside -c" +o=$t/camera +seed "$o" +if run "$t/v2" "$t/ext4.img" -c "$t/camera.apex" -o "$o" && [[ $(cat "$t/camera.apex") == "apex gen2" ]]; then + pass "camera: a successful run replaces the -c file" +else + cat "$t/log"; fail "camera: a successful run replaces the -c file" +fi + +# -c naming a directory is refused before anything is extracted +o=$t/camera +before=$(snap "$o") +if run "$t/v2" "$t/ext4.img" -c "$t" -o "$o"; then + fail "camera: a -c that is a directory is refused" +elif ! grep -qF -- "-c needs a file name" "$t/log" || [[ $(snap "$o") != "$before" ]]; then + cat "$t/log"; fail "camera: a -c that is a directory is refused, nothing changed" +else + pass "camera: a -c that is a directory is refused, nothing changed" +fi +# -c inside the outputs the run replaces is refused too +if run "$t/v2" "$t/ext4.img" -c "$o/$FW/camera.apex" -o "$o"; then + fail "camera: a -c inside the replaced outputs is refused" +elif ! grep -qF -- "-c must not be inside the outputs" "$t/log" || [[ $(snap "$o") != "$before" ]]; then + cat "$t/log"; fail "camera: a -c inside the replaced outputs is refused, nothing changed" +else + pass "camera: a -c inside the replaced outputs is refused, nothing changed" +fi + +# -o naming / (or a path that resolves to it) is refused before anything is +# written, the scratch directory included. The image is all zeros, neither +# ext4 nor EROFS, so a tool without the refusal stops at the image check +# instead, before it could write under /: this check never writes there. +head -c 4096 /dev/zero > "$t/junk.img" +ln -s / "$t/link-to-root" +for root in / // /usr/.. "$t/link-to-root"; do + name="-o ${root#"$t/"}" + rm -rf "$t/work-root" + if "$EVF" -w "$t/work-root" -o "$root" "$t/junk.img" > "$t/log" 2>&1; then + fail "$name: refused" + elif ! grep -qF -- "-o resolves to /" "$t/log" || [[ -e $t/work-root ]]; then + cat "$t/log"; fail "$name: refused before anything is written" + else + pass "$name: refused before anything is written" + fi +done + +# A move that fails while publishing (the registry's parent not writable) +# puts back what was already replaced: OUT is left as it was +if ((EUID != 0)); then + o=$t/publish-fail n=$failed + seed "$o" + chmod a-w "$o/usr/share/omamobile" + before=$(snap "$o") + if run "$t/v2" "$t/ext4.img" -o "$o"; then + fail "publish failure: the run fails" + else + grep -qF "publishing failed; the previous outputs are back in place" "$t/log" || + { cat "$t/log"; fail "publish failure: says the previous outputs are back"; } + [[ $(snap "$o") == "$before" ]] || { diff <(echo "$before") <(snap "$o") || true; fail "publish failure: OUT is as it was"; } + fi + chmod u+w "$o/usr/share/omamobile" + pass_since "$n" "publish failure: the previous outputs put back, OUT as it was" +else + echo "ok - # skip: running as root, so a read-only directory can't make a move fail" +fi + +# The same on EROFS: a reused directory, and a failure after copying +o=$t/erofs +seed "$o" +if run "$t/v2" "$t/erofs.img" -o "$o" && [[ $(listed "$o") == "$CHEETAH_FILES" && ! -e $o/$REG/stale_sensor.json ]]; then + pass "erofs: a second run keeps nothing from the earlier generation" +else + cat "$t/log"; fail "erofs: a second run keeps nothing from the earlier generation" +fi +refuses "erofs: a sanity check failing after every copy" "the top and bottom speaker tunings are the same file" "$t/v2-same" "$t/erofs.img" + +# --- A real ext4 image (synthetic files), when the host can make one ----------- +# Its registry files belong to root, as on a real image, so a run as a user +# sees rdump's ownership notes; a 9 KiB aoc.bin is cut short by a file size +# limit on debugfs, which reports it and exits 0. +rm -rf "$t/v2-big"; cp -r "$t/v2" "$t/v2-big"; head -c 9216 /dev/zero | tr '\0' 'a' > "$t/v2-big/firmware/aoc.bin" +if realdfs=$(command -v debugfs) && mkfs.ext4 -q -F -d "$t/v2" "$t/real.img" 8M >/dev/null 2>&1 && + mkfs.ext4 -q -F -d "$t/v2-missing" "$t/real-missing.img" 8M >/dev/null 2>&1 && + mkfs.ext4 -q -F -d "$t/v2-big" "$t/real-big.img" 8M >/dev/null 2>&1 && + debugfs -w -R "sif /etc/sensors/registry uid 0" "$t/real.img" >/dev/null 2>&1 && + debugfs -w -R "sif /etc/sensors/registry/fictional_accel.json uid 0" "$t/real.img" >/dev/null 2>&1; then + mkdir -p "$t/limited" + printf '#!/bin/bash\ntrap "" XFSZ\nulimit -f 4\nexec %q "$@"\n' "$realdfs" > "$t/limited/debugfs" + chmod +x "$t/limited/debugfs" + o=$t/real + seed "$o" + if "$EVF" -w "$t/work" -o "$o" "$t/real.img" > "$t/log" 2>&1 && + [[ $(listed "$o") == "$CHEETAH_FILES" && ! -e $o/$REG/stale_sensor.json && $(cat "$o/$FW/aoc.bin") == "aoc gen2" ]]; then + pass "real ext4: a second run keeps nothing from the earlier generation" + else + cat "$t/log"; fail "real ext4: a second run keeps nothing from the earlier generation" + fi + before=$(snap "$o") + if "$EVF" -w "$t/work" -o "$o" "$t/real-missing.img" > "$t/log" 2>&1; then + fail "real ext4: a missing file with an older copy in OUT is refused" + elif ! grep -qF "/vendor/firmware/aoc.bin is missing" "$t/log"; then + cat "$t/log"; fail "real ext4: says the file is missing" + elif [[ $(snap "$o") != "$before" ]]; then + fail "real ext4: a refused run leaves the previous outputs" + else + pass "real ext4: a missing file with an older copy in OUT is refused, the previous outputs untouched" + fi + before=$(snap "$o") + if PATH=$t/limited:$PATH "$EVF" -w "$t/work" -o "$o" "$t/real-big.img" > "$t/log" 2>&1; then + fail "real ext4: a copy cut short by debugfs is refused" + elif ! grep -qF "/vendor/firmware/aoc.bin is missing" "$t/log" || [[ $(snap "$o") != "$before" ]]; then + cat "$t/log"; fail "real ext4: a copy cut short by debugfs is refused, the previous outputs untouched" + else + pass "real ext4: a copy cut short by debugfs is refused, the previous outputs untouched" + fi +else + echo "ok - # skip: no mkfs.ext4 -d and debugfs for the real ext4 checks" +fi + +((failed == 0)) || { echo "$failed check(s) failed" >&2; exit 1; } diff --git a/tools/extract-vendor-firmware b/tools/extract-vendor-firmware index 534c5d5d0..702c77b0f 100755 --- a/tools/extract-vendor-firmware +++ b/tools/extract-vendor-firmware @@ -87,6 +87,15 @@ # # Output is a tree rooted at /, under usr/lib/firmware/updates (searched before # linux-firmware's files, and not owned by any package). Nothing touches the phone. +# Each run builds a whole new generation in a staging directory inside OUTDIR, +# checks every file and the checksum list, and only then replaces the paths +# this script owns there (usr/lib/firmware/updates, usr/share/omamobile/sensors, +# vendor-firmware.sha256 and the -c file). A failed run, a failed replacement +# included, leaves the previous outputs as they were (if putting them back +# fails too, the error names the directory holding them), and a reused OUTDIR +# keeps no file from an earlier run (another device's firmware, an old sensor +# registry); the rest of OUTDIR is left alone. An OUTDIR that is / (or +# resolves to it) is refused before anything is written. # # Needs: unzip, debugfs (e2fsprogs); simg2img if vendor.img is sparse; # lpunpack if the image only has super.img; fsck.erofs (erofs-utils) if vendor is EROFS. @@ -128,7 +137,8 @@ Usage: extract-vendor-firmware [-o OUTDIR] [-w WORKDIR] [-f] SOURCE SOURCE Google factory zip (-*-factory-*.zip), the image--*.zip inside it, or a raw/sparse vendor.img - -o DIR staging root to write into (default: ./out/vendor-firmware) + -o DIR staging root to write into (default: ./out/vendor-firmware); a + successful run replaces this script's earlier outputs there -w DIR scratch directory for the ~1 GB vendor.img (default: a temp dir in \$TMPDIR) -d DEV cheetah (default), panther, raven, tegu or husky -s SKU husky: the hardware SKU (androidboot.hardware.sku), which picks the NVRAM @@ -247,6 +257,15 @@ SRC=$(readlink -f "$1") [[ -f "$SRC" ]] || die "no such file: $1" # Absolute, because the checksum step runs from inside the staging dir OUT=$(realpath -m -- "$OUT") +# Publishing replaces whole directories under OUT, so OUT=/ would replace this +# machine's own; refuse before anything is written (WORK included) +[[ $OUT != / ]] || die "-o resolves to /: publishing would replace this machine's own directories" +[[ -z $CAMERA_APEX || ( -d $(dirname -- "$CAMERA_APEX") && ! -d $CAMERA_APEX ) ]] || + die "-c needs a file name in an existing directory: $CAMERA_APEX" +case $CAMERA_APEX in + "$OUT/$DEST_REL"/*|"$OUT/usr/share/omamobile/sensors"/*|"$OUT/vendor-firmware.sha256") + die "-c must not be inside the outputs this script replaces in $OUT" ;; +esac if [[ -n "$WORK" ]]; then mkdir -p "$WORK" @@ -254,7 +273,25 @@ if [[ -n "$WORK" ]]; then else WORK=$(mktemp -d "${TMPDIR:-/tmp}/xvf.XXXXXX") fi -trap 'rm -rf "$WORK"' EXIT +stage="" cam_new="" publishing="" aside=() published=() +# A failed publish puts the previous outputs back (restore); only if that +# fails too does the staging directory stay, holding them. +restore() { + local p + for p in "${published[@]}"; do rm -rf -- "${OUT:?}/$p" || return 1; done + for p in "${aside[@]}"; do mv -T -- "$stage/old/$p" "$OUT/$p" || return 1; done +} +cleanup() { + [[ -z $cam_new ]] || rm -f -- "$cam_new" + if [[ -n $publishing ]] && ! restore; then + printf 'error: publishing failed; the previous outputs are in %s\n' "$stage/old" >&2 + else + [[ -z $publishing ]] || printf 'error: publishing failed; the previous outputs are back in place\n' >&2 + [[ -z $stage ]] || rm -rf "$stage" + fi + rm -rf "$WORK" +} +trap cleanup EXIT # Read 4 bytes at an offset as a little-endian hex word. magic_at() { od -An -tx4 -j "$2" -N4 "$1" | tr -d ' \n'; } @@ -316,11 +353,27 @@ fi if [[ "$(od -An -tx2 -j 1080 -N2 "$img" | tr -d ' ')" == ef53 ]]; then need debugfs "install e2fsprogs" say "vendor.img is ext4; reading it with debugfs (no mount)" - get_file() { - debugfs -R "dump /$1 $2" "$img" 2>/dev/null - [[ -s "$2" ]] + # debugfs exits 0 when a copy fails (a missing file, a short write on a + # full disk) and says so on stderr: anything there but its banner, or + # rdump's notes that it can't give the files the image's owners (as a + # user), fails the copy. The copy goes to a new path, so no older file + # can stand in for it. + dfs() { + local err line + err=$(debugfs -R "$1" "$img" 2>&1 >/dev/null) || return 1 + while [[ -n $err ]]; do # line by line in the shell: nothing here can fail + line=${err%%$'\n'*} + if [[ $err == *$'\n'* ]]; then err=${err#*$'\n'}; else err=""; fi + case $line in + "" | "debugfs "[0-9]*) ;; + "dump_file: Operation not permitted while changing ownership of "*) ;; + "rdump: Operation not permitted while changing ownership of "*) ;; + *) return 1 ;; + esac + done } - get_dir() { mkdir -p "$2" && debugfs -R "rdump /$1 $2" "$img" 2>/dev/null && [[ -d "$2/$(basename "$1")" ]]; } + get_file() { dfs "dump /$1 $2" && [[ -s "$2" ]]; } + get_dir() { mkdir -p "$2" && dfs "rdump /$1 $2" && [[ -d "$2/$(basename "$1")" ]]; } elif [[ "$(magic_at "$img" 1024)" == e0f5e1e2 ]]; then need fsck.erofs "install erofs-utils" say "vendor.img is EROFS; extracting it with fsck.erofs" @@ -340,11 +393,16 @@ if get_file build.prop "$WORK/build.prop"; then say "Vendor partition: $(sed -n 's/^ro.vendor.build.fingerprint=//p' "$WORK/build.prop" | head -1)" fi -dest="$OUT/$DEST_REL" +# The new generation: everything below is written into $new, which starts +# empty, so no file from an earlier run can stand in for a missing one. +mkdir -p "$OUT" +stage=$(mktemp -d "$OUT/.extract-vendor-firmware.XXXXXX") +new="$stage/new" +dest="$new/$DEST_REL" for entry in "${MAP[@]}"; do from=${entry%%|*} to=${entry#*|} mkdir -p "$dest/$(dirname "$to")" - get_file "$from" "$dest/$to" || die "/vendor/$from is missing from this image" + get_file "$from" "$dest/$to" || die "/vendor/$from is missing from this image or could not be copied" chmod 0644 "$dest/$to" printf ' /vendor/%-28s -> /%s/%s\n' "$from" "$DEST_REL" "$to" done @@ -353,16 +411,19 @@ done # settings), read by omamobile-sensor-proxy; without it only virtual sensors. # husky has no AoC driver yet, so it skips the registry. if [[ $DEVICE != husky ]]; then - reg="$OUT/usr/share/omamobile/sensors" - get_dir etc/sensors/registry "$reg" || die "/vendor/etc/sensors/registry is missing from this image" + reg="$new/usr/share/omamobile/sensors" + get_dir etc/sensors/registry "$reg" || + die "/vendor/etc/sensors/registry is missing from this image or could not be copied" chmod -R u=rwX,go=rX "$reg" printf ' /vendor/%-28s -> /%s\n' "etc/sensors/registry/" "usr/share/omamobile/sensors/registry/" fi +# The camera APEX goes to a new file beside -c, renamed into place below if [[ -n $CAMERA_APEX ]]; then - get_file apex/com.google.pixel.camera.hal.apex "$CAMERA_APEX" || - die "/vendor/apex/com.google.pixel.camera.hal.apex is missing from this image" - say "Camera HAL APEX copied to $CAMERA_APEX" + cam_new=$(mktemp "$CAMERA_APEX.XXXXXX") + get_file apex/com.google.pixel.camera.hal.apex "$cam_new" || + die "/vendor/apex/com.google.pixel.camera.hal.apex is missing from this image or could not be copied" + chmod 0644 "$cam_new" fi # Sanity checks: right chip, text NVRAM, Cirrus file formats. @@ -417,7 +478,12 @@ fi ver=$(grep -ao 'Version=[0-9.]* ([^)]*)' "$brcm/$FW_BASE.$BOARD.bin" | head -1) bt="" [[ -z $BT_CHIP ]] || bt=$(grep -ao "$BT_CHIP [^[]*" "$brcm/BCM.$BOARD.hcd" | head -1) -(cd "$dest" && find . -type f -printf '%P\n' | sort | xargs sha256sum -- > "$OUT/vendor-firmware.sha256") +(cd "$dest" && find . -type f -printf '%P\n' | sort | xargs sha256sum -- > "$new/vendor-firmware.sha256") +# The checksum list names exactly the mapped files +for entry in "${MAP[@]}"; do printf '%s\n' "${entry#*|}"; done | sort > "$stage/expected" +cut -c67- "$new/vendor-firmware.sha256" | cmp -s - "$stage/expected" || + die "the staged firmware is not exactly the mapped files" + say "Wi-Fi firmware: ${ver:-unknown version}" if [[ $DEVICE == husky ]]; then say "NVRAM: /vendor/firmware/$nvram${SKU:+ (SKU $SKU)}" @@ -430,5 +496,26 @@ fi say "AoC firmware: aoc-tegu.bin ($(stat -c %s "$dest/aoc-tegu.bin") bytes)" [[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == raven ]] && say "Speaker protection: cs35l41-dsp1-spk-prot-$DEVICE.wmfw and the top and bottom tunings" +# Publish: move the previous outputs aside, then the new ones into place, all +# renames within OUTDIR, then the -c file. A failed move puts it all back. +publishing=1 +for p in "$DEST_REL" usr/share/omamobile/sensors vendor-firmware.sha256; do + if [[ -e $OUT/$p || -L $OUT/$p ]]; then # -L: a dangling symlink too + mkdir -p "$stage/old/$(dirname "$p")" + mv -T -- "$OUT/$p" "$stage/old/$p" + aside+=("$p") + fi + if [[ -e $new/$p ]]; then + mkdir -p "$OUT/$(dirname "$p")" + mv -T -- "$new/$p" "$OUT/$p" + published+=("$p") + fi +done +if [[ -n $CAMERA_APEX ]]; then + mv -fT -- "$cam_new" "$CAMERA_APEX" + cam_new="" +fi +publishing="" # published: nothing below may undo it +[[ -z $CAMERA_APEX ]] || say "Camera HAL APEX copied to $CAMERA_APEX" say "Staged in $OUT (checksums in $OUT/vendor-firmware.sha256)" echo "This is Google's proprietary firmware from your own factory image. Do not redistribute it." From 2fa55cada49a8922542918923dec34aee25cdc15 Mon Sep 17 00:00:00 2001 From: angelrenefm <17342133+angelrenefm@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:49:24 +0100 Subject: [PATCH 13/66] omamobile-audio 0.5.17, device-panther 0.1.13: the Pixel 7's speakers on the firmware's default calibration without speaker.cal (#496) Turns on omamobile-audio's OMAMOBILE_SPK_DEFAULT_CAL=1 for the Pixel 7, with a drop-in for omamobile-speaker-protection.service: some units have no speaker.cal in persist, and stock's HAL then runs the protection firmware on its tuning's default calibration. A phone that has speaker.cal still uses it, c9 and verify stay refused on the default, the volume ceilings are unchanged (stage media, 737/10), and /etc/omamobile/speaker.conf is read after the drop-in, so a line there still turns it off. Evidence: #427, the contributor's comment of 2026-11-07 15:33 UTC (a start and a playback on 0.5.16, installed with pacman -U, on a Pixel 7 without speaker.cal), and with this drop-in: the service gets the setting, start logs "using the protection firmware's default calibration", stage media at 737/10, a playback, and the watchdog stays active. omamobile-audio: the one debugfs call whose message is matched ("File not found by ext2_lookup") runs under LC_ALL=C, so a phone in another language can't trip it. --- .../omamobile-audio/bin/omamobile-speaker-protection | 6 ++++-- packages/omamobile-audio/version | 2 +- packages/omamobile-device-panther/README.md | 1 + packages/omamobile-device-panther/install | 2 ++ packages/omamobile-device-panther/test/all | 4 ++++ .../50-panther-default-cal.conf | 12 ++++++++++++ packages/omamobile-device-panther/version | 2 +- 7 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 packages/omamobile-device-panther/vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf diff --git a/packages/omamobile-audio/bin/omamobile-speaker-protection b/packages/omamobile-audio/bin/omamobile-speaker-protection index 919fde6fc..377a25e2d 100755 --- a/packages/omamobile-audio/bin/omamobile-speaker-protection +++ b/packages/omamobile-audio/bin/omamobile-speaker-protection @@ -392,8 +392,10 @@ read_calibration() { command -v debugfs >/dev/null || { log "no debugfs (e2fsprogs)"; return 1; } mkdir -p "$RUN" # debugfs opens the device read-only unless given -w; it exits 0 whatever - # went wrong, so its messages are kept to tell a missing file apart - err=$( (umask 077 && debugfs -R "cat $CAL_PATH" "$dev" 2>&1 > "$cal") ) + # went wrong, so its messages are kept to tell a missing file apart, in + # English whatever the phone's language (LC_ALL=C), since that message is + # matched below + err=$( (umask 077 && LC_ALL=C debugfs -R "cat $CAL_PATH" "$dev" 2>&1 > "$cal") ) if (($(stat -c %s "$cal" 2>/dev/null || echo 0) < ${#AMPS[@]} * CAL_WORDS * 4)); then log "persist:$CAL_PATH is missing or short" # only debugfs's own "File not found": an empty file, or an empty read diff --git a/packages/omamobile-audio/version b/packages/omamobile-audio/version index 3afb327e2..d8aef8135 100644 --- a/packages/omamobile-audio/version +++ b/packages/omamobile-audio/version @@ -1 +1 @@ -0.5.16 +0.5.17 diff --git a/packages/omamobile-device-panther/README.md b/packages/omamobile-device-panther/README.md index 04ceb27dd..0f95d6458 100644 --- a/packages/omamobile-device-panther/README.md +++ b/packages/omamobile-device-panther/README.md @@ -5,6 +5,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe | Path | Installs to | What it does | | --- | --- | --- | | `vendor/environment.d/40-omamobile-rotation.conf` | `/usr/lib/environment.d` | `OMAMOBILE_ROTATION_HOLD=1`: Hyprland (packages/hyprland, 0002) holds the last frame across a rotation and turns the new one in as Android does. Off in the shared build until it has run on the other phones | +| `vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf` | `/usr/lib/systemd/system/omamobile-speaker-protection.service.d` | `OMAMOBILE_SPK_DEFAULT_CAL=1`: a Pixel 7 with no `speaker.cal` in persist runs its speakers on the protection firmware's default calibration, as stock does (omamobile-audio 0.5.16; c9 and `verify` stay refused). A phone with `speaker.cal` still uses it; a line in `/etc/omamobile/speaker.conf` overrides it | | `vendor/udev/rules.d/10-omamobile-storage.rules` | `/usr/lib/udev/rules.d` | Hides `sda` and every Android partition except `userdata` from desktop tools. Same rule as the Pixel 7 Pro. The initramfs stops its guard loop before `switch_root`; the kernel's read-only flags are what remain | | `vendor/udev/rules.d/20-omamobile-gpu-always-on.rules` | `/usr/lib/udev/rules.d` | Keeps the Mali-G710 powered while Panthor drives it: powering its domain back up needs a secure call our kernel doesn't make yet. Same rule as the Pixel 7 Pro | | `vendor/udev/rules.d/72-omamobile-feedbackd.rules` | `/usr/lib/udev/rules.d` | Lets feedbackd drive the CS40L26 haptics (`cs40l26_vibra`). Same rule as the Pixel 7 Pro; the driver needs the phone's own `cs40l26.wmfw` (`tools/extract-vendor-firmware -d panther`) | diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index 018c07674..fa535d334 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -36,6 +36,8 @@ install -Dm644 vendor/systemd/network/20-usb-gadget.network \ "$destination/usr/lib/systemd/network/20-usb-gadget.network" install -Dm644 vendor/environment.d/40-omamobile-rotation.conf \ "$destination/usr/lib/environment.d/40-omamobile-rotation.conf" +install -Dm644 vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf \ + "$destination/usr/lib/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf" 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 \ diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index 1ab8f8104..d4b6baeea 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -96,6 +96,7 @@ for f in usr/bin/reboot-to \ usr/lib/udev/rules.d/70-omamobile-dma-heap.rules \ usr/lib/systemd/network/20-usb-gadget.network \ usr/lib/environment.d/40-omamobile-rotation.conf \ + usr/lib/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf \ usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf \ usr/lib/systemd/sleep.conf.d/10-omamobile.conf \ usr/lib/modprobe.d/omamobile-display.conf \ @@ -129,6 +130,9 @@ grep -q 'Address=172.16.42.1/24' "$tmp/root/usr/lib/systemd/network/20-usb-gadge || fail "usb0 keeps the initramfs address" grep -qx 'OMAMOBILE_ROTATION_HOLD=1' "$tmp/root/usr/lib/environment.d/40-omamobile-rotation.conf" \ || fail "the Pixel 7 turns on Hyprland's rotation hold" +dropin="$tmp/root/usr/lib/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf" +grep -qx '\[Service\]' "$dropin" && grep -qx 'Environment=OMAMOBILE_SPK_DEFAULT_CAL=1' "$dropin" \ + || fail "the Pixel 7 starts its speakers on the default calibration when it has no speaker.cal" power="$tmp/root/usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf" grep -qx '\[Login\]' "$power" \ || fail "the power-key drop-in needs a [Login] header" diff --git a/packages/omamobile-device-panther/vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf new file mode 100644 index 000000000..8f1ce6854 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: MIT +# Pixel 7: some units have no speaker.cal in persist (no factory speaker +# calibration), and stock's HAL then runs the protection firmware on its +# tuning's default calibration. OMAMOBILE_SPK_DEFAULT_CAL=1 does the same +# (omamobile-audio 0.5.16; stage c9 and verify stay refused on it). A phone +# that has speaker.cal still uses it. /etc/omamobile/speaker.conf is read +# after this (EnvironmentFile overrides Environment), so a line there turns +# it off again. Evidence: derekross/omarchy-mobile#427 (comment of +# 2026-11-07 16:13 UTC): a start and a playback on 0.5.16 on a Pixel 7 +# without speaker.cal. +[Service] +Environment=OMAMOBILE_SPK_DEFAULT_CAL=1 diff --git a/packages/omamobile-device-panther/version b/packages/omamobile-device-panther/version index 0e24a92ff..7ac4e5e38 100644 --- a/packages/omamobile-device-panther/version +++ b/packages/omamobile-device-panther/version @@ -1 +1 @@ -0.1.12 +0.1.13 From a997209e96c9b5c7e885d46ecb980e97bc0f538d Mon Sep 17 00:00:00 2001 From: kloot Date: Sun, 8 Nov 2026 18:50:32 +0100 Subject: [PATCH 14/66] libcamera 0.7.2-4.23, kernel config: the Pixel 9a's main camera autofocus (#494) The 9a's main camera focuses through an onsemi LC898129, which now has a lens driver (linux-omarchy-mobile#213). Build it as a module next to the 7 Pro's SEM1215SA (CONFIG_VIDEO_LC898129=m), and turn on contrast autofocus in the S5KGN8 tuning file (libcamera 0057), with the coarse and fine steps of the 7 Pro's main camera. device/tegu/NOTES.md records where the register map came from, which registers were written while working it out (only the focus target), and what was measured on the phone: the controller's registers, the 12-bit focus target and its Hall read-back, which end is near, and omacam focusing on a subject at about 25 cm, on libcamera 4.22 with the Af lines added by hand. DEVICES.md adds the autofocus to the 9a's camera cell, in review with the kernel PR, and says the far end isn't checked yet. The board's lens node is in the notes; it waits for the 9a's camera device tree (linux-omarchy-mobile#164) and isn't in a pull request yet, as the camera cell says. Co-authored-by: Claude Opus 5.5 --- device/tegu/NOTES.md | 70 +++++++++++++++++++ docs/DEVICES.md | 2 +- kernel/configs/omamobile.config | 3 + ...ofocus-on-the-Pixel-9a-s-main-camera.patch | 44 ++++++++++++ packages/libcamera/PKGBUILD | 14 ++-- packages/libcamera/README.md | 1 + 6 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 packages/libcamera/0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index a762361a1..b37172659 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -63,6 +63,76 @@ modules-push`, without a new boot image. Omarchy 4.0.6 on the phone. removes `/dev/zram0`, and `cat /sys/class/zram-control/hot_add` brings it back. +## 2026-11-07: the main camera's autofocus (LC898129) + +Kernel `7.3.0-rc6-omamobile-push1-gd00d9fd2272f`, a local build: `omamobile` +with kernel #178, #103 and #164's camera device tree merged, the lc898129 +driver ([kernel #213](https://github.com/derekross/linux-omarchy-mobile/pull/213)) and a lens node for it (below). + +- [V] **The controller:** the main module's focus and OIS controller is an + onsemi LC898129 at `0x24` on the main camera's bus (`hsi2c_5`, i2c-3), + stock's `act-nessie` / `ois-nessie`. 16-bit register addresses, 32-bit + big-endian values. It shares the sensor's supplies and reset and NACKs + unless the sensor is powered (a read while the camera is stopped gives + ENXIO or a timeout). +- [V] **Where the register map comes from:** no public datasheet or driver + for the part. The register numbers and the form of a move came from + disassembling the LC898129 actuator code in Google's camera HAL, + `liblyric_hwl.so` in the `com.google.pixel.camera.hal` APEX on the vendor + partition of factory image BP3A.250905.014: it reads `0xf010` and + `0x0548` and writes `0xf01a` as `0x0002` in the upper half and the + target in the lower. No code was copied. What the registers do, the + usable range and the direction below were measured on the phone. +- [V] **What was written while working it out:** only `0xf01a`, always + `0x0002` in the upper half, with lower halves from 0 to 32000 (those + above 4095 are the tries with the upper bits set). Every other access + was a register read (the two-byte address, then a 4-byte read): + `0x0000`, `0xf010`, `0xf01a`, `0xf01f`, `0xe00d`, `0xf000`, `0xf001`, + `0xf008`, `0xf00a`, `0xf100`, `0x0538` and `0x0548`. Finding the + address took only read probes: `i2cdetect -r` on the bus and a read of + `0x0000` at four other candidate addresses. The module's calibration + EEPROM, which stock puts at the same address, was never written, and + the driver writes only `0xf01a`. +- [V] **Its focus registers:** after power-up it reads `0xf010` = 7 (servo + on) and `0xf01a` = `0x00000fff` (focus target). Writing `0x0002xxxx` to + `0xf01a` moves the lens. The corrected Hall position at `0x0548` (upper + 16 bits, signed) is `0xc005 + 8 * (target & 0xfff)`: linear from -16379 + at 0 to 16381 at 4095, the same up and down. Targets with bits above the + low 12 also changed the framing and sharpness in ways that don't follow + the Hall position, so the driver never sets them. +- [V] **Direction:** sweeping 0-4095 with a can at about 25 cm, sharpness + rose steadily towards 0 and fell towards 4095; the picture before the + first write matched 4095. So 0 is the near end and 4095 the far end + [I: the far end not yet checked on a distant scene]. +- [V] **The driver:** `lc898129` ([kernel #213](https://github.com/derekross/linux-omarchy-mobile/pull/213)) is a V4L2 lens subdev, + `V4L2_CID_FOCUS_ABSOLUTE` 0-4095 with higher values closer (it writes + 4095 minus the value). The `s5kgn1` driver powers it through + `lens-focus` while streaming, as for the 7 Pro's SEM1215SA. The node: + + ```dts + main_lens: lens@24 { + compatible = "onnn,lc898129"; + reg = <0x24>; + vio-supply = <&cam_1v8>; + }; + ``` + + with `lens-focus = <&main_lens>;` in `cam_main`. It isn't in #164; it + can go there or follow it. +- [V] **Autofocus in omacam:** the phone ran libcamera 0.7.2-4.22 with the + `Af` lines added by hand to its S5KGN8 tuning file, the same lines + 0.7.2-4.23's 0057 adds. libcamera's contrast autofocus scans and settles + on the can in a little over a second, and a full-size photo (3000x3992) + is sharp on it. +- [V] **2026-11-08, the driver as reviewed** (supplies `vio`, `vm`, + `vdda`; kernel `7.3.0-rc6-omamobile-push1-ge8d722982099`, `lc898129.c` + blob `50cce3a5f4c0`, the kernel #213 head): while the main camera + streams, `focus_absolute` 0, 1024, 2048, 3072, 4095, 2048, 0 settles at + Hall 16371, 8179, -7, -8197, -16383, -4, 16369, and the lens is + runtime-suspended after the stream. libcamera's autofocus (still + 4.22 with the lines by hand) sweeps 8 coarse steps over the range, + then finely around the peak, and settles there. + ## 2026-11-03: the radio backup check with tools/nv-backup - [V] **NV partitions unchanged (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`):** diff --git a/docs/DEVICES.md b/docs/DEVICES.md index 0fdb1739c..35da976d8 100644 --- a/docs/DEVICES.md +++ b/docs/DEVICES.md @@ -25,7 +25,7 @@ The status of each device, as verified on real hardware. Rows in the matrix have | Pixel 6 | oriole | gs101 (Tensor G1) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); native test image on one phone; slot B marked successful and `vbmeta_b` verification turned off, both without project approval; see notes) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); guarded `userdata` root on test image) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); connected output on test image) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); Panfrost render node present) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); touchscreen detected; input not checked by smoke) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); gpio-keys detected; input not checked by smoke) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); USB network and SSH on test image) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); link up; traffic not checked by smoke) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); controller powered; pairing not checked) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); charge and temperature reported) | WIP ([unpublished kernel/packages](../device/oriole/NOTES.md#2026-10-31-build-provenance-and-recovery-limits); charging reported; control not checked) | no | no | no | no | no | no | no | no | no | no | no | | Pixel 4 | flame | SM8150 (Snapdragon 855) | testing (temporary RAM boot; [notes](../device/flame/BRINGUP-M1.md)) | testing (RAM probe; all UFS read-only) | testing (1080x2280 console; software desktop in separate Arch payload) | testing (separate Arch payload; FD640 contexts, llvmpipe desktop) | testing (separate Arch payload; events and PIN unlock verified) | no | testing (NCM + ACM + SSH; sustained transfers can disconnect) | testing (guarded RAM scan; association untested) | no | no | no | no | no | no | - | no | no | no | no | no | no | - | | Pixel 4 XL ([notes](../device/coral/NOTES.md)) | coral | SM8150 (Snapdragon 855) | WIP (direct ABL v2 boot on the test handset's slot A; slot-B install and §3.1 entry pending; [notes](../device/coral/BRINGUP-M1.md)) | testing (read-only `blockdev` guard + RAM `overlayfs`) | testing (1440x3040@60Hz S6E3HC2 DSC 1.1 KMS, DPMS, brightness) | testing (Adreno 640 / FD640 Mesa Freedreno, Hyprland) | testing (FTS SPI multitouch + read-only flash guard) | testing (power via `qcom-pon` + volume via `gpio-keys`) | testing (CDC ECM + ACM + SSH; stays up with host USB switched off) | testing (`WCN3990` `ath10k_snoc` + `rmtfs -r`, WPA2/DHCP/HTTPS; radio sessions ran before the modem baseline) | WIP (`WCN3990` `hci_qca` `hci0` up + BLE scan; audio/pairing open) | WIP (PM8150B ADC `VBAT_SNS` voltage + FG temp; aftermarket pack on test unit: no reply from `1-0036`) | testing (PM8150B SMB5 charger with `4.20 V` / `500 mA` kernel clamp) | testing (`CS40L25A` I2C click waveform) | testing (PM8150L flash LEDs + quick-settings tile) | no | - | testing (QDSP6 + dual `CS35L36` amps capped at `-26 dB` + `IA8508` SPI mic DSP) | testing (`SLPI` + `fastrpc` + RAM-backed `hexagonrpcd` + QMI SSC: 7 sensors + Soli radar) | WIP (`MPSS` boots with `rmtfs -r` + patched `tqftpserv`, SIM detected; no IPA/voice yet; radio sessions ran before the modem baseline) | no | testing (`CAMSS` + `IMX363`, `IMX481`, `IMX520`, dual `OV7251` NIR; `libcamera` softISP) | no | - | -| Pixel 9a ([notes](../device/tegu/NOTES.md)) | tegu | zumapro (Tensor G4) | works ([#28](https://github.com/derekross/omarchy-mobile/issues/28): native boot from slot B, the Arch root on `userdata`, `omamobile-device-tegu`; slot B was marked successful by hand on 2026-10-28 with the `devinfo` write approved on 2026-10-22, now on hold ([#125](https://github.com/derekross/omarchy-mobile/pull/125)), unmarked by the 10-31 fastboot recovery and marked again on 2026-10-31 during the hold ([record](../device/tegu/NOTES.md#2026-10-31-a-fastboot-flash-of-slot-b-cleared-its-successful-mark-and-b-was-marked-again)), and the package does not mark it; unpublished kernel: the SoC and board device tree is [kernel #81](https://github.com/derekross/linux-omarchy-mobile/pull/81), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (UFS behind the read-only guard; unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (120 Hz through gs-decon; the panel driver [kernel #89](https://github.com/derekross/linux-omarchy-mobile/pull/89), 120 Hz [kernel #88](https://github.com/derekross/linux-omarchy-mobile/pull/88), merged, the display DT, merged with [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96); brightness, DPMS off and on and the 60/120 Hz switch on the boot of [kernel #125](https://github.com/derekross/linux-omarchy-mobile/pull/125), merged, which also checks the panel's ID; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on), [brightness record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) | works (Panthor, the desktop renders, runtime suspend when idle; this boot runs at a fixed 160 MHz; the GPU's levels and its thermal zone are merged with [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96) ([kernel #85](https://github.com/derekross/linux-omarchy-mobile/pull/85) and [kernel #87](https://github.com/derekross/linux-omarchy-mobile/pull/87) landed through it), not yet run from it; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (Synaptics S3908 over SPI, [kernel #81](https://github.com/derekross/linux-omarchy-mobile/pull/81), merged; survives sleep, [kernel #82](https://github.com/derekross/linux-omarchy-mobile/pull/82), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (gpio-keys: power and volume; the power key wakes from sleep; unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (CDC NCM and SSH; reconnects after a replug, `omamobile-tegu-usb-rescue`, also after a replug the gadget didn't see ([#280](https://github.com/derekross/omarchy-mobile/pull/280); [the replug record](../device/tegu/NOTES.md#2026-10-28-what-the-device-tables-claims-rest-on)); [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (BCM4383 on PCIe channel 1 through the shared gs201 host and zuma PHY, [kernel #178](https://github.com/derekross/linux-omarchy-mobile/pull/178) on [kernel #156](https://github.com/derekross/linux-omarchy-mobile/pull/156), in review, and brcmfmac, [kernel #56](https://github.com/derekross/linux-omarchy-mobile/pull/56) in review; started at boot by `omamobile-device-tegu` 0.2.4 ([#238](https://github.com/derekross/omarchy-mobile/pull/238)) with the extractor's firmware; WPA2 with iwd, kept loaded across sleep by the package's sleep hook; [record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) | works (hci_uart on the bootloader's address, BlueZ, A2DP; [kernel #94](https://github.com/derekross/linux-omarchy-mobile/pull/94); unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (MAX77779 gauge with temperature, current and time estimates through UPower; [kernel #66](https://github.com/derekross/linux-omarchy-mobile/pull/66); unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (the MAX77779 charger binds from the device tree, [kernel #161](https://github.com/derekross/linux-omarchy-mobile/pull/161), merged, built by [#227](https://github.com/derekross/omarchy-mobile/pull/227); the charge limit in `omamobile-device-tegu` 0.2.3 holds charging off at the limit through `charge_behaviour` and lets it run again 5 below; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (CS40L26A through feedbackd, with brownout prevention, [kernel #95](https://github.com/derekross/linux-omarchy-mobile/pull/95); its DT [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (LM3644, 25 steps to 75 mA, quick-settings tile; its DT [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | testing (Omarchy's Location switch serves fixes from GPS, Galileo, BeiDou and GLONASS once the modem is up, started by hand: a 30-minute session through the switch on 2026-11-01 (omamobile-gnss 0.2.5's start, the modem link left to cycle) ran clean, 1763 of 1765 GGA sentences fixed, first fix 37 s after a client connected; needs [kernel #150](https://github.com/derekross/linux-omarchy-mobile/pull/150), merged, the PERIC0 clock fix [kernel #172](https://github.com/derekross/linux-omarchy-mobile/pull/172), merged (without it the modem link hung the palmtop within minutes), and [#114](https://github.com/derekross/omarchy-mobile/pull/114), merged, from whose package build a session in a moving car fixed 145 of 153 times; the GNSS link driver is merged, [kernel #185](https://github.com/derekross/linux-omarchy-mobile/pull/185), loaded by hand with the modem off, and a session through it waits on the modem link; [plan](../device/tegu/MODEM-PLAN.md), record with [#202](https://github.com/derekross/omarchy-mobile/pull/202)) | works (audio and sensor DSP through the GSA and Trusty, 93 services, started at boot by `omamobile-device-tegu` 0.2.3 from the device tree, [kernel #162](https://github.com/derekross/linux-omarchy-mobile/pull/162) in review; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (the TAS2572 amplifiers and the microphone through the AoC card and PipeWire, at boot with the AoC: a tone from the speaker, the microphone at -32 dBFS; speakers at a -10 dB ceiling; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (accelerometer, light, proximity, compass and gyroscope through the AoC and the sensor proxy, at boot with the AoC; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | WIP (registered on LTE, mobile data over `rmnet0`, texts both ways and speakerphone calls in and out with `omamobile-modem-sit` ([#356](https://github.com/derekross/omarchy-mobile/pull/356), [#367](https://github.com/derekross/omarchy-mobile/pull/367)), on the owner's kernel and on in-tree drivers from the open kernel PRs ([kernel #187](https://github.com/derekross/linux-omarchy-mobile/pull/187), [kernel #162](https://github.com/derekross/linux-omarchy-mobile/pull/162)); the package doesn't start the modem, the kernel PRs aren't merged, and calls have no echo cancellation or earpiece yet; [plan](../device/tegu/MODEM-PLAN.md), [record](../device/tegu/MODEM-PLAN.md#sim-test-results-2026-11-02-730-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty)) | works (NXP ST54L through nxp-nci, its clock pad from the PMU ([kernel #104](https://github.com/derekross/linux-omarchy-mobile/pull/104) and [kernel #105](https://github.com/derekross/linux-omarchy-mobile/pull/105), merged, with [kernel #131](https://github.com/derekross/linux-omarchy-mobile/pull/131), merged), loaded at boot by `omamobile-device-tegu` 0.2.3 with neard and the link opener: polls with no I2C errors and read a payment card; polling stops before sleep; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (main, ultrawide and front from the device tree, [kernel #164](https://github.com/derekross/linux-omarchy-mobile/pull/164) in review, with [kernel #63](https://github.com/derekross/linux-omarchy-mobile/pull/63) and [kernel #103](https://github.com/derekross/linux-omarchy-mobile/pull/103) in review: their drivers load at boot with nothing by hand, libcamera lists all three, and each streams, main at 19 fps and the others at 30 fps at 1280x960; basic picture quality through libcamera's software ISP; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | testing (s2idle when asked for, or through the shell's auto-sleep with the `omamobile-sleep` toggle on, which ships off; the power key lights the lock screen on the first press ([#268](https://github.com/derekross/omarchy-mobile/pull/268), [#275](https://github.com/derekross/omarchy-mobile/pull/275)), and the RTC wakes it; on 2026-11-01 thirty attended 120 s sleeps ([plan](../device/tegu/SLEEP-PLAN.md) S1) and a day of real use with auto-sleep on ([record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) all woke, but six test sleeps since 10-28 did not (one in 21 on the clock-fix kernel on 11-01, and one in 127 in an overnight series of 120 s sleeps on 11-01 to 11-02), so sleep tests stay attended ([plan](../device/tegu/SLEEP-PLAN.md) S1); the drain is about 300 mA asleep, the same as awake with the screen off, because nothing below the CPUs sleeps yet; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (opt-in) (enrolls, matches, refuses other fingers and unlocks the lock screen through Trusty and `omamobile-fingerprint`, 2026-10-29; the sensor binds from the device tree, [kernel #165](https://github.com/derekross/linux-omarchy-mobile/pull/165) in review, with [kernel #126](https://github.com/derekross/linux-omarchy-mobile/pull/126), merged; opt-in as on the 7 Pro, because the service's first run writes Trusty's secure storage; [plan](../device/tegu/FINGERPRINT-PLAN.md), [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | +| Pixel 9a ([notes](../device/tegu/NOTES.md)) | tegu | zumapro (Tensor G4) | works ([#28](https://github.com/derekross/omarchy-mobile/issues/28): native boot from slot B, the Arch root on `userdata`, `omamobile-device-tegu`; slot B was marked successful by hand on 2026-10-28 with the `devinfo` write approved on 2026-10-22, now on hold ([#125](https://github.com/derekross/omarchy-mobile/pull/125)), unmarked by the 10-31 fastboot recovery and marked again on 2026-10-31 during the hold ([record](../device/tegu/NOTES.md#2026-10-31-a-fastboot-flash-of-slot-b-cleared-its-successful-mark-and-b-was-marked-again)), and the package does not mark it; unpublished kernel: the SoC and board device tree is [kernel #81](https://github.com/derekross/linux-omarchy-mobile/pull/81), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (UFS behind the read-only guard; unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (120 Hz through gs-decon; the panel driver [kernel #89](https://github.com/derekross/linux-omarchy-mobile/pull/89), 120 Hz [kernel #88](https://github.com/derekross/linux-omarchy-mobile/pull/88), merged, the display DT, merged with [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96); brightness, DPMS off and on and the 60/120 Hz switch on the boot of [kernel #125](https://github.com/derekross/linux-omarchy-mobile/pull/125), merged, which also checks the panel's ID; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on), [brightness record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) | works (Panthor, the desktop renders, runtime suspend when idle; this boot runs at a fixed 160 MHz; the GPU's levels and its thermal zone are merged with [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96) ([kernel #85](https://github.com/derekross/linux-omarchy-mobile/pull/85) and [kernel #87](https://github.com/derekross/linux-omarchy-mobile/pull/87) landed through it), not yet run from it; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (Synaptics S3908 over SPI, [kernel #81](https://github.com/derekross/linux-omarchy-mobile/pull/81), merged; survives sleep, [kernel #82](https://github.com/derekross/linux-omarchy-mobile/pull/82), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (gpio-keys: power and volume; the power key wakes from sleep; unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (CDC NCM and SSH; reconnects after a replug, `omamobile-tegu-usb-rescue`, also after a replug the gadget didn't see ([#280](https://github.com/derekross/omarchy-mobile/pull/280); [the replug record](../device/tegu/NOTES.md#2026-10-28-what-the-device-tables-claims-rest-on)); [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (BCM4383 on PCIe channel 1 through the shared gs201 host and zuma PHY, [kernel #178](https://github.com/derekross/linux-omarchy-mobile/pull/178) on [kernel #156](https://github.com/derekross/linux-omarchy-mobile/pull/156), in review, and brcmfmac, [kernel #56](https://github.com/derekross/linux-omarchy-mobile/pull/56) in review; started at boot by `omamobile-device-tegu` 0.2.4 ([#238](https://github.com/derekross/omarchy-mobile/pull/238)) with the extractor's firmware; WPA2 with iwd, kept loaded across sleep by the package's sleep hook; [record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) | works (hci_uart on the bootloader's address, BlueZ, A2DP; [kernel #94](https://github.com/derekross/linux-omarchy-mobile/pull/94); unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (MAX77779 gauge with temperature, current and time estimates through UPower; [kernel #66](https://github.com/derekross/linux-omarchy-mobile/pull/66); unpublished kernel; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (the MAX77779 charger binds from the device tree, [kernel #161](https://github.com/derekross/linux-omarchy-mobile/pull/161), merged, built by [#227](https://github.com/derekross/omarchy-mobile/pull/227); the charge limit in `omamobile-device-tegu` 0.2.3 holds charging off at the limit through `charge_behaviour` and lets it run again 5 below; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (CS40L26A through feedbackd, with brownout prevention, [kernel #95](https://github.com/derekross/linux-omarchy-mobile/pull/95); its DT [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (LM3644, 25 steps to 75 mA, quick-settings tile; its DT [kernel #96](https://github.com/derekross/linux-omarchy-mobile/pull/96), merged; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | testing (Omarchy's Location switch serves fixes from GPS, Galileo, BeiDou and GLONASS once the modem is up, started by hand: a 30-minute session through the switch on 2026-11-01 (omamobile-gnss 0.2.5's start, the modem link left to cycle) ran clean, 1763 of 1765 GGA sentences fixed, first fix 37 s after a client connected; needs [kernel #150](https://github.com/derekross/linux-omarchy-mobile/pull/150), merged, the PERIC0 clock fix [kernel #172](https://github.com/derekross/linux-omarchy-mobile/pull/172), merged (without it the modem link hung the palmtop within minutes), and [#114](https://github.com/derekross/omarchy-mobile/pull/114), merged, from whose package build a session in a moving car fixed 145 of 153 times; the GNSS link driver is merged, [kernel #185](https://github.com/derekross/linux-omarchy-mobile/pull/185), loaded by hand with the modem off, and a session through it waits on the modem link; [plan](../device/tegu/MODEM-PLAN.md), record with [#202](https://github.com/derekross/omarchy-mobile/pull/202)) | works (audio and sensor DSP through the GSA and Trusty, 93 services, started at boot by `omamobile-device-tegu` 0.2.3 from the device tree, [kernel #162](https://github.com/derekross/linux-omarchy-mobile/pull/162) in review; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (the TAS2572 amplifiers and the microphone through the AoC card and PipeWire, at boot with the AoC: a tone from the speaker, the microphone at -32 dBFS; speakers at a -10 dB ceiling; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (accelerometer, light, proximity, compass and gyroscope through the AoC and the sensor proxy, at boot with the AoC; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | WIP (registered on LTE, mobile data over `rmnet0`, texts both ways and speakerphone calls in and out with `omamobile-modem-sit` ([#356](https://github.com/derekross/omarchy-mobile/pull/356), [#367](https://github.com/derekross/omarchy-mobile/pull/367)), on the owner's kernel and on in-tree drivers from the open kernel PRs ([kernel #187](https://github.com/derekross/linux-omarchy-mobile/pull/187), [kernel #162](https://github.com/derekross/linux-omarchy-mobile/pull/162)); the package doesn't start the modem, the kernel PRs aren't merged, and calls have no echo cancellation or earpiece yet; [plan](../device/tegu/MODEM-PLAN.md), [record](../device/tegu/MODEM-PLAN.md#sim-test-results-2026-11-02-730-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty)) | works (NXP ST54L through nxp-nci, its clock pad from the PMU ([kernel #104](https://github.com/derekross/linux-omarchy-mobile/pull/104) and [kernel #105](https://github.com/derekross/linux-omarchy-mobile/pull/105), merged, with [kernel #131](https://github.com/derekross/linux-omarchy-mobile/pull/131), merged), loaded at boot by `omamobile-device-tegu` 0.2.3 with neard and the link opener: polls with no I2C errors and read a payment card; polling stops before sleep; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | works (main, ultrawide and front from the device tree, [kernel #164](https://github.com/derekross/linux-omarchy-mobile/pull/164) in review, with [kernel #63](https://github.com/derekross/linux-omarchy-mobile/pull/63) and [kernel #103](https://github.com/derekross/linux-omarchy-mobile/pull/103) in review: their drivers load at boot with nothing by hand, libcamera lists all three, and each streams, main at 19 fps and the others at 30 fps at 1280x960; basic picture quality through libcamera's software ISP; [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel); the main camera's contrast autofocus through its LC898129 ([kernel #213](https://github.com/derekross/linux-omarchy-mobile/pull/213) in review, and a lens node on top of kernel #164, not yet in a pull request; libcamera 0.7.2-4.23), close subjects checked, the far end not yet ([notes](../device/tegu/NOTES.md#2026-11-07-the-main-cameras-autofocus-lc898129))) | testing (s2idle when asked for, or through the shell's auto-sleep with the `omamobile-sleep` toggle on, which ships off; the power key lights the lock screen on the first press ([#268](https://github.com/derekross/omarchy-mobile/pull/268), [#275](https://github.com/derekross/omarchy-mobile/pull/275)), and the RTC wakes it; on 2026-11-01 thirty attended 120 s sleeps ([plan](../device/tegu/SLEEP-PLAN.md) S1) and a day of real use with auto-sleep on ([record](../device/tegu/NOTES.md#2026-11-01-afternoon-and-evening-wi-fi-from-the-package-the-wake-and-the-replug-storage-idle-the-panel-id)) all woke, but six test sleeps since 10-28 did not (one in 21 on the clock-fix kernel on 11-01, and one in 127 in an overnight series of 120 s sleeps on 11-01 to 11-02), so sleep tests stay attended ([plan](../device/tegu/SLEEP-PLAN.md) S1); the drain is about 300 mA asleep, the same as awake with the screen off, because nothing below the CPUs sleeps yet; [record](../device/tegu/NOTES.md#2026-10-29-the-device-package-boot-and-what-this-row-rests-on)) | works (opt-in) (enrolls, matches, refuses other fingers and unlocks the lock screen through Trusty and `omamobile-fingerprint`, 2026-10-29; the sensor binds from the device tree, [kernel #165](https://github.com/derekross/linux-omarchy-mobile/pull/165) in review, with [kernel #126](https://github.com/derekross/linux-omarchy-mobile/pull/126), merged; opt-in as on the 7 Pro, because the service's first run writes Trusty's secure storage; [plan](../device/tegu/FINGERPRINT-PLAN.md), [record](../device/tegu/NOTES.md#2026-10-31-and-11-01-every-testing-row-on-a-published-style-kernel)) | | Pixel 8 Pro ([notes](../device/husky/NOTES.md)) | husky | zuma (Tensor G3) | WIP ([#1](https://github.com/derekross/omarchy-mobile/issues/1): slot B; from 2026-11-01 to 2026-11-07 a local unit marked slot B on Lef's phone; stopped pending [#252](https://github.com/derekross/omarchy-mobile/issues/252); Omarchy's image from the signed repository boots to the lock screen; the zuma device tree is merged ([kernel #13](https://github.com/derekross/linux-omarchy-mobile/pull/13), [#53](https://github.com/derekross/linux-omarchy-mobile/pull/53))) | testing (UFS at HS-G4 behind the read-only guard; Arch on `userdata`; [UFS-PLAN](../device/husky/UFS-PLAN.md)) | WIP (simple-framebuffer with the panel's size, [kernel #154](https://github.com/derekross/linux-omarchy-mobile/pull/154): console and Omarchy's lock screen; 120 Hz with brightness on a test kernel, [kernel #160](https://github.com/derekross/linux-omarchy-mobile/pull/160), started by the device package, [#228](https://github.com/derekross/omarchy-mobile/pull/228)) | testing (panthor on the Mali-G715 on a test kernel, [kernel #157](https://github.com/derekross/linux-omarchy-mobile/pull/157); [ROADMAP](../device/husky/ROADMAP.md)) | works (ST FTM5 over SPI, merged, [kernel #153](https://github.com/derekross/linux-omarchy-mobile/pull/153); verified on both phones, [notes](../device/husky/NOTES.md#2026-10-31-the-touchscreen)) | works (power and volume through `gpio-keys`, merged, [kernel #148](https://github.com/derekross/linux-omarchy-mobile/pull/148); verified on both phones, [notes](../device/husky/NOTES.md#2026-10-30-the-buttons)) | testing (USB and SSH) | testing (BCM4398 on a test kernel, [kernel #156](https://github.com/derekross/linux-omarchy-mobile/pull/156); firmware from the owner's image, [#214](https://github.com/derekross/omarchy-mobile/pull/214); [NOTES](../device/husky/NOTES.md)) | testing (BCM4398D0 on the APM UART, pairing and A2DP, on a test kernel, [kernel #199](https://github.com/derekross/linux-omarchy-mobile/pull/199); firmware from the owner's image; [ROADMAP](../device/husky/ROADMAP.md)) | testing (gauge with Google's ATL model through a bring-up overlay, temperature, MFD, pack EEPROM, [kernel #163](https://github.com/derekross/linux-omarchy-mobile/pull/163) and [#175](https://github.com/derekross/linux-omarchy-mobile/pull/175); the bus on by default waits for [kernel #205](https://github.com/derekross/linux-omarchy-mobile/pull/205); [notes](../device/husky/BATTERY-NOTES.md)) | testing (the charger driver and `tcpci_maxim` as a sink, by hand under a dead-man tool: sink at the Type-C 3 A level (input limit 0xc2 0x13 to 0x77); +1.5 A measured from a 30 W charger without the driver (1.485 A is the device-tree cap); no host mode, [#282](https://github.com/derekross/omarchy-mobile/pull/282); [notes](../device/husky/BATTERY-NOTES.md), [#1](https://github.com/derekross/omarchy-mobile/issues/1#issuecomment-6562547503)) | testing (CS40L26 on a test kernel, [kernel #200](https://github.com/derekross/linux-omarchy-mobile/pull/200)) | testing (LM3644, 50 mA cap, on a test kernel, [kernel #200](https://github.com/derekross/linux-omarchy-mobile/pull/200)) | no (first steps as drafts: [kernel #210](https://github.com/derekross/linux-omarchy-mobile/pull/210), [#211](https://github.com/derekross/linux-omarchy-mobile/pull/211)) | testing (loads and runs through the GSA and Trusty on a test kernel; plan and results [AOC-PLAN](../device/husky/AOC-PLAN.md)) | testing (stereo speakers and one microphone through UCM2 and PipeWire on a test kernel, [kernel #203](https://github.com/derekross/linux-omarchy-mobile/pull/203), [#204](https://github.com/derekross/linux-omarchy-mobile/pull/204), package [#453](https://github.com/derekross/omarchy-mobile/pull/453)) | no | no | testing (a test kernel reads tags; [kernel #208](https://github.com/derekross/linux-omarchy-mobile/pull/208), [#209](https://github.com/derekross/linux-omarchy-mobile/pull/209)) | no | no | no | | Pixel 8a ([notes](../device/akita/NOTES.md)) | akita | zuma (Tensor G3) | WIP ([#1](https://github.com/derekross/omarchy-mobile/issues/1): slot B into the initramfs with USB and SSH, no Arch root yet; `reboot-to bootloader` reaches fastboot; the first-light board file is merged, [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192); [BRINGUP-M1](../device/akita/BRINGUP-M1.md), [notes](../device/akita/NOTES.md#2026-11-03-first-light-m13-and-the-console-m14)) | WIP (UFS at HS-G4 behind the read-only guard, from the initramfs only, nothing run on `userdata`; merged, [kernel #206](https://github.com/derekross/linux-omarchy-mobile/pull/206); the device package and storage plan are in review, [#456](https://github.com/derekross/omarchy-mobile/pull/456)) | WIP (simple-framebuffer: the boot console over Omarchy's splash; merged with [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192); [notes](../device/akita/NOTES.md#2026-11-03-first-light-m13-and-the-console-m14)) | no | no | no | testing (USB and SSH from the initramfs; merged with [kernel #192](https://github.com/derekross/linux-omarchy-mobile/pull/192)) | no | no | no | no | no | no | no | no | no | no | no | no | no | no | no | | Pixel 7 ([notes](../device/panther/NOTES.md)) | panther | gs201 (Tensor G2) | WIP (slot B, not marked successful; Arch and Hyprland boot; `boot` and `init_boot` carry AVB footers, which a phone whose `vbmeta_b` is stock's needs to start slot B (device-panther 0.1.6, [#396](https://github.com/derekross/omarchy-mobile/pull/396), [notes](../device/panther/NOTES.md#2026-11-02-avb-footers-on-boot-and-init_boot)); `reboot-to bootloader` reaches fastboot with `reboot=warm`, merged, [kernel #198](https://github.com/derekross/linux-omarchy-mobile/pull/198); [BRINGUP-M1](../device/panther/BRINGUP-M1.md); board file merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | testing (UFS behind the read-only guard; Arch on `userdata`; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | WIP (simple-framebuffer: console and the Hyprland desktop; brightness and display off/on over DCS through the S6E3FC3 panel driver and device-panther 0.1.4, merged, [kernel #177](https://github.com/derekross/linux-omarchy-mobile/pull/177); [DISPLAY-PLAN](../device/panther/DISPLAY-PLAN.md)) | testing (Panthor on the Mali-G710; Hyprland renders on it; merged through [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), with the always-on rule in device-panther 0.1.1, [#145](https://github.com/derekross/omarchy-mobile/pull/145); [notes](../device/panther/NOTES.md#2026-10-28-the-gpu-and-the-haptics-power-off-and-usb-after-a-replug)) | WIP (FocalTech FT3658: touches drive Hyprland and unlock the PIN screen on a test kernel; the driver, [kernel #109](https://github.com/derekross/linux-omarchy-mobile/pull/109), and the touch node, [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), are merged; stock's interrupt pull-up and CS delay, [kernel #166](https://github.com/derekross/linux-omarchy-mobile/pull/166), the driver's review fixes, [kernel #133](https://github.com/derekross/linux-omarchy-mobile/pull/133), and the kernel option with the touch notes, [#149](https://github.com/derekross/omarchy-mobile/pull/149), are merged) | testing (gpio-keys: power, volume; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108)) | testing (USB and SSH; merged, [kernel #108](https://github.com/derekross/linux-omarchy-mobile/pull/108); a replug comes back through `omamobile-usb-rescue` in device-panther 0.1.3, on the MAX77759's I2C bus, merged, [kernel #167](https://github.com/derekross/linux-omarchy-mobile/pull/167); [notes](../device/panther/NOTES.md#2026-10-29-usb-comes-back-after-a-replug-u1)) | no | testing (BCM4389 on the APM UART through hci_bcm with the phone's own patch, merged, [kernel #196](https://github.com/derekross/linux-omarchy-mobile/pull/196): a BLE mouse drives the shell, and headphones play over A2DP with their AVRCP buttons, on its author's Pixel 7; the Bluetooth address and the rest of the package side aren't merged yet; headset calls, suspend and power not tested) | WIP (MAX77759 fuel gauge with stock's battery model on a test kernel: percentage, capacity and temperature in upower and the bar; merged, [kernel #171](https://github.com/derekross/linux-omarchy-mobile/pull/171) and the driver fix [#170](https://github.com/derekross/linux-omarchy-mobile/pull/170); a second unit's Lishen pack isn't matched by that model yet, [notes](../device/panther/NOTES.md#2026-11-03-a-second-unit-angelrenefm); [BATTERY-PLAN](../device/panther/BATTERY-PLAN.md)) | no | testing (CS40L26 with the phone's own firmware, `tools/extract-vendor-firmware -d panther`; merged through [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134), with the feedbackd rule in device-panther 0.1.1, [#145](https://github.com/derekross/omarchy-mobile/pull/145); [notes](../device/panther/NOTES.md#2026-10-28-the-gpu-and-the-haptics-power-off-and-usb-after-a-replug)) | testing (LM3644 rear flash, 36 steps, from the node merged in [kernel #197](https://github.com/derekross/linux-omarchy-mobile/pull/197) and the bring-up overlay `torch.dtso`, [#426](https://github.com/derekross/omarchy-mobile/pull/426): lit on a second Pixel 7; the quick-settings tile not checked) | no | no | no | no | no | no | no (the package's camera start and DMA heap rule are merged, device-panther 0.1.9, [#443](https://github.com/derekross/omarchy-mobile/pull/443), inert until the camera device tree is proposed) | no (s2idle by default since [kernel #134](https://github.com/derekross/linux-omarchy-mobile/pull/134) and device-panther 0.1.1; not run yet) | WIP (the sensor's node, disabled, is merged, [kernel #207](https://github.com/derekross/linux-omarchy-mobile/pull/207); with a bring-up overlay and the package side, which is in review ([#458](https://github.com/derekross/omarchy-mobile/pull/458)), a finger enrolled and unlocked its author's Pixel 7, also after a reboot) | diff --git a/kernel/configs/omamobile.config b/kernel/configs/omamobile.config index 5e9dfd58e..0db708660 100644 --- a/kernel/configs/omamobile.config +++ b/kernel/configs/omamobile.config @@ -348,6 +348,9 @@ CONFIG_VIDEO_AK7375=m # their S5K3J1 and S5KGM5 too; the telephoto's SEM1215SA focus controller. # Blacklisted; DT nodes disabled until camera-front/camera-tele. CONFIG_VIDEO_SEM1215=m +# The Pixel 9a's main camera focus: its LC898129 focus and OIS controller, +# powered by the S5KGN8 sensor while it streams (lens-focus). +CONFIG_VIDEO_LC898129=m # Waydroid (device/cheetah/WAYDROID-PLAN.md W1). Binder, binderfs, PSI, # memfd, cgroups, namespaces, bridge, veth, tun, overlayfs and fuse are # already on. The host side (waydroid-net.sh) uses nftables only. What is diff --git a/packages/libcamera/0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch b/packages/libcamera/0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch new file mode 100644 index 000000000..b962af83f --- /dev/null +++ b/packages/libcamera/0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch @@ -0,0 +1,44 @@ +From b621dee1388a6e691dbcf1e364c9a04786a4afd1 Mon Sep 17 00:00:00 2001 +From: cbm +Date: Sat, 7 Nov 2026 21:47:03 +0100 +Subject: [PATCH] ipa: simple: Autofocus on the Pixel 9a's main camera + +The S5KGN8 module's focus now has a kernel lens driver (lc898129, a +V4L2 lens subdev linked to the sensor through lens-focus), so turn the +contrast autofocus on in its tuning file, with the coarse and fine +steps the Pixel 7 Pro's main camera uses. + +Tested on a Pixel 9a with omacam: a subject at about 25 cm comes into +focus in a little over a second. + +Signed-off-by: cbm +--- + src/ipa/simple/data/s5kgn8.yaml | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/ipa/simple/data/s5kgn8.yaml b/src/ipa/simple/data/s5kgn8.yaml +index 51ca9b0..c6a3d22 100644 +--- a/src/ipa/simple/data/s5kgn8.yaml ++++ b/src/ipa/simple/data/s5kgn8.yaml +@@ -2,7 +2,7 @@ + # + # Samsung S5KGN8 (the Pixel 9a's main camera), not calibrated yet. The + # black level comes from the sensor's helper. No colour matrix until one is +-# fitted on daylight shots, and no autofocus until the lens has a driver. ++# fitted on daylight shots. + %YAML 1.1 + --- + version: 1 +@@ -19,4 +19,9 @@ algorithms: + denoise: 0.015 + chromaDenoise: 0.03 + - Agc: ++ # Contrast autofocus through the module's LC898129 lens (0-4095), with ++ # the scan steps of the Pixel 7 Pro's main camera ++ - Af: ++ coarseSteps: 8 ++ fineSteps: 32 + ... +-- +2.56.0 + diff --git a/packages/libcamera/PKGBUILD b/packages/libcamera/PKGBUILD index 3437fb5d8..82cc11c47 100644 --- a/packages/libcamera/PKGBUILD +++ b/packages/libcamera/PKGBUILD @@ -182,7 +182,9 @@ # - 0056-libcamera-Add-the-Samsung-S5KGN8-sensor.patch: the Pixel 9a's main # camera: its black level (64 at 10 bits, measured), linear gain and an # uncalibrated tuning file (it ran with no helper before). -# - pkgrel 4.22, so it sorts above Arch Linux ARM's 0.7.2-4. +# - 0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch: contrast +# autofocus on the Pixel 9a's main camera, through its LC898129 lens driver. +# - pkgrel 4.23, so it sorts above Arch Linux ARM's 0.7.2-4. # # Maintainers of the original: David Runge, Carl Smedstad. @@ -195,7 +197,7 @@ pkgname=( python-libcamera ) pkgver=0.7.2 -pkgrel=4.22 +pkgrel=4.23 pkgdesc="A complex camera support library for Linux, Android, and ChromeOS (Omarchy Mobile: gs201 CSIS)" arch=(aarch64) url="https://libcamera.org/" @@ -284,6 +286,7 @@ source=( 0054-pipeline-simple-Pass-the-start-controls-to-the-softw.patch 0055-software_isp-debayer_egl-Correct-defective-pixels-be.patch 0056-libcamera-Add-the-Samsung-S5KGN8-sensor.patch + 0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch ) sha512sums=('a5656356617a01a7e8feb535380869d38b7c58139c7f99385af355629d3e1927bbd8847f7bec755c753c72f6b065df76de53c15f9af2e5901e83e7a144a2ddcd' '8b54cbdf6ed767ae8d52a14480a4653f4f3a1c2187c4ccf7ceb65eaa60c819cce514122591d6e0c2dfc39d7482739f8fdd4090dbaf63701445510eefc88fb19f' @@ -342,7 +345,8 @@ sha512sums=('a5656356617a01a7e8feb535380869d38b7c58139c7f99385af355629d3e1927bbd '6717f9f27c9822d5b21fb132b363227d72929ed9e4aa4e0d5521dac1039c101de318672cb25918b963c4b7394bd8a58d85edf418afa61bda7ee3358d482371e4' '8a80d2c8aa85f15c2fde64cbcb1fb9a55f257bb4414007672583e3602dc3897cce82e829ede22de928245b2f142e4aad09deeb06b9d2b6990a45c840e948e898' '4f618bd8f45eb5499dce75be70f62f7091fa61f3121a8067fcb38fcdb9eb778cc1d8f2c94daed0f5f9815bb8da1712f0515e2332544273595df18b1a422a0706' - '9bdbac40cf508f2068e4570da62d736509f0ef0617e60723ddcfdfb7f42d04c0d9f856faae52756b74b4d5971e6ada5ac61109f7b411c45a40ccb830b4249ade') + '9bdbac40cf508f2068e4570da62d736509f0ef0617e60723ddcfdfb7f42d04c0d9f856faae52756b74b4d5971e6ada5ac61109f7b411c45a40ccb830b4249ade' + 'ce713ca43e1a10001d1a433af097d7720448e6bcda7f6ccce6855bf6ac0fae87df0b0507cceab34d39af62cafb2b4861c790b4f156d4e6ec05b070f80f451f4a') b2sums=('1dbd3f78f8d9a2484331798b18b871d7585b5928988e91d586366049d85e3f126e7cfc58494400e69feeec99a77894252d582f0d8f183508e5d1b8220e70f3d5' '4a0e24feed22d32b83b0ec49c9a7616b77deb26cae82c17a38b54a81a0468e982852147bc2d5e3b611ba014ddbd7647acfe2e68591542420da73945ba1c0d6c2' 'cba8b638543a16bf80c2ae7dc0737f3874476fd1ff694639b459184725848e193518778d0336eef3d55ba4329d9bc63981d0aa8d8d9b5507c9ade4f17f7f407d' @@ -400,7 +404,8 @@ b2sums=('1dbd3f78f8d9a2484331798b18b871d7585b5928988e91d586366049d85e3f126e7cfc5 'b27b0e12bd345b8590d26cc1401f9cff8fd0777ba40a2d186e3db5e98edae84c8eb54fdf9c9bccd5c301d170907272a77cfd66bc40387a5bf5aaf15c8faad69b' '63c4bc9556ee28ea34f246ebe2c87a59f5dd50e56218ed5a9e2bb95af16d06672561b0981e3e0475cd885a7b7b8c4112cf203710e7e126cbf9de62e28b6a567f' 'd58a82be4991c6b4d46be10d0c2c21e7c4a5898c0f997bf64bc2b21702c5071e8e04020faf1389e7091b2f9060a71f41f3f15d8d7b491a167fef650588ecf889' - '82d09fef3abf67f5c3c6905d056faba7ba6b20edc3d9f6aa887d50c4372a2af770517e8974a53c3fd460fd0eec045804a3cf64191cfe966ec7fc11d23a61426a') + '82d09fef3abf67f5c3c6905d056faba7ba6b20edc3d9f6aa887d50c4372a2af770517e8974a53c3fd460fd0eec045804a3cf64191cfe966ec7fc11d23a61426a' + '1269473d5f4c8b327560312d1793f9f559bf82e178ecb35bb811d40ecdc5768ee803b27387951cfe62b070f6e60920f84ad669d246dcd0ad1732e3ba6b7f7e7b') _pick() { local p="$1" f d; shift @@ -471,6 +476,7 @@ prepare() { patch -Np1 < ../0054-pipeline-simple-Pass-the-start-controls-to-the-softw.patch patch -Np1 < ../0055-software_isp-debayer_egl-Correct-defective-pixels-be.patch patch -Np1 < ../0056-libcamera-Add-the-Samsung-S5KGN8-sensor.patch + patch -Np1 < ../0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch # add version, so that utils/gen-version.sh may rely on it printf "%s\n" "$pkgver" > .tarball-version diff --git a/packages/libcamera/README.md b/packages/libcamera/README.md index 18502612c..d2ffe8f66 100644 --- a/packages/libcamera/README.md +++ b/packages/libcamera/README.md @@ -71,6 +71,7 @@ in the table. See `device/cheetah/CAMERA-PLAN.md`, section 5.2. | `0054-pipeline-simple-Pass-the-start-controls-to-the-softw.patch` | The simple pipeline hands `Camera::start()`'s controls to the software ISP's IPA with the first request; without it a restarted camera kept the previous session's manual exposure mode | | `0055-software_isp-debayer_egl-Correct-defective-pixels-be.patch` | Defective pixel correction in a pass before the debayer, on the packed bytes: a sample beyond its eight same-colour neighbours' range is clamped to it. `LIBCAMERA_SOFTISP_NO_DPC` turns it off | | `0056-libcamera-Add-the-Samsung-S5KGN8-sensor.patch` | The S5KGN8 (the Pixel 9a's main camera) sensor helper, with the black level measured on the phone (64 at 10 bits) and the code / 32 gain, its properties, and an uncalibrated tuning file without a colour matrix or autofocus | +| `0057-ipa-simple-Autofocus-on-the-Pixel-9a-s-main-camera.patch` | Contrast autofocus on the S5KGN8, through the module's LC898129 lens driver, with the Pixel 7 Pro main camera's scan steps | | `libcamera-fix-python3.14-macro-redefinition.patch` | Arch's patch, unchanged (sha512 `8b54cbdf…`) | | `.SRCINFO` | `makepkg --printsrcinfo` output | From 5fc7ef5752d7ba553fe143aec8215777e92c6bfe Mon Sep 17 00:00:00 2001 From: angelrenefm <17342133+angelrenefm@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:51:41 +0100 Subject: [PATCH 15/66] omamobile-device-dodge 0.1.1: reboot-to prints usage on an option instead of rebooting (#506) The OnePlus 13's reboot-to passed "--help" to the kernel as the reboot reason, as the Pixels' did before #459: the phone rebooted. An argument that starts with "-" is never a reason, so print the usage and exit (0 for -h and --help, 2 for anything else), with the same text as the Pixels'. It has no libc, so the usage goes out through write(2) and the exit through exit_group(2), and a small loop compares the option. Both copies (the package's and the initramfs's) stay identical, as test/all checks. Not run on a OnePlus 13. Built as the package builds it (gcc -nostdlib on an aarch64 Linux, a Pixel 7) and with clang for aarch64, then run with options only: --help and -h printed the usage and returned 0, -z and --bootloader returned 2. The build from main, run under qemu-aarch64 as a normal user, shows the old path: --help reached reboot(... RESTART2, "--help") (refused there, EPERM). test/all passes. I used AI help (Claude) to work on this. The version (0.1.1) was set at merge. --- device/dodge/initramfs/reboot-to.c | 17 +++++++++++++++++ packages/omamobile-device-dodge/reboot-to.c | 17 +++++++++++++++++ packages/omamobile-device-dodge/version | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/device/dodge/initramfs/reboot-to.c b/device/dodge/initramfs/reboot-to.c index f663f18e4..4d98a95dd 100644 --- a/device/dodge/initramfs/reboot-to.c +++ b/device/dodge/initramfs/reboot-to.c @@ -7,6 +7,7 @@ // // aarch64 Linux entry: sp points at argc, then the argv pointers. +#define __NR_write 64 #define __NR_sync 81 #define __NR_reboot 142 #define __NR_exit_group 94 @@ -40,6 +41,16 @@ __attribute__((naked)) void _start(void) "b go\n"); } +static const char usage[] = "usage: reboot-to [REASON]\n" + "Reboot with REASON (default: bootloader), e.g. bootloader or recovery.\n"; + +static int same(const char *a, const char *b) +{ + while (*a && *a == *b) + a++, b++; + return *a == *b; +} + void go(long argc, char **argv) { const char *reason = "bootloader"; @@ -47,6 +58,12 @@ void go(long argc, char **argv) if (argc > 1 && argv[1] && argv[1][0]) reason = argv[1]; + /* An option is never a reason: don't reboot on "--help" or a typo */ + if (reason[0] == '-') { + scall(__NR_write, 1, (long)usage, sizeof(usage) - 1, 0); + scall(__NR_exit_group, same(reason, "-h") || same(reason, "--help") ? 0 : 2, 0, 0, 0); + } + scall(__NR_sync, 0, 0, 0, 0); scall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (long)reason); diff --git a/packages/omamobile-device-dodge/reboot-to.c b/packages/omamobile-device-dodge/reboot-to.c index f663f18e4..4d98a95dd 100644 --- a/packages/omamobile-device-dodge/reboot-to.c +++ b/packages/omamobile-device-dodge/reboot-to.c @@ -7,6 +7,7 @@ // // aarch64 Linux entry: sp points at argc, then the argv pointers. +#define __NR_write 64 #define __NR_sync 81 #define __NR_reboot 142 #define __NR_exit_group 94 @@ -40,6 +41,16 @@ __attribute__((naked)) void _start(void) "b go\n"); } +static const char usage[] = "usage: reboot-to [REASON]\n" + "Reboot with REASON (default: bootloader), e.g. bootloader or recovery.\n"; + +static int same(const char *a, const char *b) +{ + while (*a && *a == *b) + a++, b++; + return *a == *b; +} + void go(long argc, char **argv) { const char *reason = "bootloader"; @@ -47,6 +58,12 @@ void go(long argc, char **argv) if (argc > 1 && argv[1] && argv[1][0]) reason = argv[1]; + /* An option is never a reason: don't reboot on "--help" or a typo */ + if (reason[0] == '-') { + scall(__NR_write, 1, (long)usage, sizeof(usage) - 1, 0); + scall(__NR_exit_group, same(reason, "-h") || same(reason, "--help") ? 0 : 2, 0, 0, 0); + } + scall(__NR_sync, 0, 0, 0, 0); scall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (long)reason); diff --git a/packages/omamobile-device-dodge/version b/packages/omamobile-device-dodge/version index 6e8bf73aa..17e51c385 100644 --- a/packages/omamobile-device-dodge/version +++ b/packages/omamobile-device-dodge/version @@ -1 +1 @@ -0.1.0 +0.1.1 From 1e85e30e98575390865006924eb83de9393e0092 Mon Sep 17 00:00:00 2001 From: quatrixone <57962558+quatrixone@users.noreply.github.com> Date: Sun, 8 Nov 2026 18:52:50 +0100 Subject: [PATCH 16/66] phone-ssh: OMAMOBILE_SSH_CONNECT_TIMEOUT for phones with a slow first handshake (#504) Some phones take longer than ssh's default to finish the first SSH handshake while their USB link is still coming up. tools/phone-ssh and tools/phone-ssh-proxy now take the connect timeout from OMAMOBILE_SSH_CONNECT_TIMEOUT, defaulting to 6 s as before, so a slow phone can ask for more without making a dead connection slower to report everywhere else. tests/phone-ssh covers the default and the override, and that the proxy receives it. --- tests/phone-ssh | 22 ++++++++++++++++++++-- tools/phone-ssh | 10 ++++++++-- tools/phone-ssh-proxy | 11 +++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/tests/phone-ssh b/tests/phone-ssh index 407b13fc4..7f162abad 100755 --- a/tests/phone-ssh +++ b/tests/phone-ssh @@ -28,6 +28,15 @@ unset OMAMOBILE_SSH_HOST OMAMOBILE_SSH_KEY OMAMOBILE_SSH_KNOWN_HOSTS OMAMOBILE_S tools/phone-ssh 'printf "%s" "$HOME"' >"$scratch/default" grep -Fx root@172.16.42.1 "$scratch/default" >/dev/null grep -Fx 'printf "%s" "$HOME"' "$scratch/default" >/dev/null +grep -Fx ConnectTimeout=6 "$scratch/default" >/dev/null +OMAMOBILE_SSH_CONNECT_TIMEOUT=19 tools/phone-ssh true >"$scratch/timeout-override" +grep -Fx ConnectTimeout=19 "$scratch/timeout-override" >/dev/null +for bad_timeout in 0 -1 1.5 invalid 999x; do + if OMAMOBILE_SSH_CONNECT_TIMEOUT=$bad_timeout tools/phone-ssh true >"$scratch/bad-timeout" 2>/dev/null; then + echo 'not ok - invalid connection timeout accepted'; exit 1 + fi + [[ ! -s $scratch/bad-timeout ]] +done export OMAMOBILE_SSH_HOST='root@fe80::1234%usb-test' export OMAMOBILE_SSH_KEY="$scratch/key with spaces" printf 'fake identity\n' >"$OMAMOBILE_SSH_KEY" @@ -383,16 +392,25 @@ class RelayTests(unittest.TestCase): (family, socket.SOCK_STREAM, socket.IPPROTO_TCP, "", destination) ]) as resolve, patch.object(proxy.socket, "socket", return_value=sock), \ patch.object(proxy, "relay") as relay: - proxy.main(["--relay", "usb-test", address]) + proxy.main(["--relay", "usb-test", address, "19"]) resolve.assert_called_once_with(address, 22, type=socket.SOCK_STREAM, flags=socket.AI_NUMERICHOST) self.assertEqual(sock.method_calls[:4], [ unittest.mock.call.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, b"usb-test\0"), - unittest.mock.call.settimeout(6), unittest.mock.call.connect(destination), + unittest.mock.call.settimeout(19), unittest.mock.call.connect(destination), unittest.mock.call.settimeout(None), ]) relay.assert_called_once_with(sock) + def test_proxy_command_passes_timeout_to_relay(self): + with patch.object(proxy, "__file__", "/tmp/phone-ssh-proxy"): + from unittest.mock import patch as mock_patch + import contextlib, io + output = io.StringIO() + with contextlib.redirect_stdout(output): + proxy.main(["--command", "usb-test", "192.0.2.1", "17"]) + self.assertIn("--relay usb-test 192.0.2.1 17", output.getvalue()) + def test_binding_failure_cannot_fall_back_to_unbound_connect(self): from unittest.mock import MagicMock sock = MagicMock() diff --git a/tools/phone-ssh b/tools/phone-ssh index 4233b9e03..a58026ff8 100755 --- a/tools/phone-ssh +++ b/tools/phone-ssh @@ -13,6 +13,7 @@ # OMAMOBILE_SSH_HOST_KEY_ALIAS selects the name checked in that file, so # native and recovery systems can keep distinct pins at the same USB address. # OMAMOBILE_SSH_INTERFACE selects a direct interface for this socket only. +# OMAMOBILE_SSH_CONNECT_TIMEOUT sets the connection timeout in positive seconds (default 6). # With explicit CONFIG=/dev/null, the default USB address automatically uses # its unique main-table link route, avoiding VPN policy-route interception. # Set INTERFACE=off to opt out. Other SSH configs retain their own transports. @@ -41,6 +42,10 @@ known=${OMAMOBILE_SSH_KNOWN_HOSTS:-} alias=${OMAMOBILE_SSH_HOST_KEY_ALIAS:-} config=${OMAMOBILE_SSH_CONFIG:-} interface=${OMAMOBILE_SSH_INTERFACE:-auto} +connect_timeout=${OMAMOBILE_SSH_CONNECT_TIMEOUT:-6} +[[ $connect_timeout =~ ^[1-9][0-9]*$ ]] || { + echo 'phone-ssh: OMAMOBILE_SSH_CONNECT_TIMEOUT must be a positive integer' >&2; exit 1; +} proxy="" proxy_helper=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)/phone-ssh-proxy case $interface in @@ -56,7 +61,7 @@ case $interface in } ;; esac if [[ -n $interface ]]; then - proxy=$(python3 "$proxy_helper" --command "$interface" "${target##*@}") + proxy=$(python3 "$proxy_helper" --command "$interface" "${target##*@}" "$connect_timeout") fi [[ -z $alias || ( $alias != -* && $alias =~ ^[a-zA-Z0-9._:-]+$ ) ]] || { echo 'phone-ssh: invalid OMAMOBILE_SSH_HOST_KEY_ALIAS' >&2; exit 1; @@ -122,7 +127,8 @@ PYCONTEXT # short policy hash leaves room for OpenSSH's temporary 17-byte suffix. path="${XDG_RUNTIME_DIR:-/tmp}/omamobile-ssh-$context-%C" fi -opts=(-o LogLevel=ERROR -o ConnectTimeout=6) +# A slow USB link setup can delay the first handshake. +opts=(-o LogLevel=ERROR -o "ConnectTimeout=$connect_timeout") [[ -z $proxy ]] || opts+=(-o "ProxyCommand=$proxy") [[ -z $config ]] || opts+=(-F "$config") if [[ -n $known ]]; then diff --git a/tools/phone-ssh-proxy b/tools/phone-ssh-proxy index 0dec812ef..a7704bd80 100755 --- a/tools/phone-ssh-proxy +++ b/tools/phone-ssh-proxy @@ -82,14 +82,17 @@ def main(args): if args == ["--discover"]: print(discover()) return - if len(args) != 3 or args[0] not in ("--command", "--relay"): - raise ValueError("usage: phone-ssh-proxy --discover | --command|--relay INTERFACE IP") + if len(args) not in (3, 4) or args[0] not in ("--command", "--relay"): + raise ValueError("usage: phone-ssh-proxy --discover | --command INTERFACE IP [TIMEOUT] | --relay INTERFACE IP [TIMEOUT]") interface = interface_name(args[1]) address = str(ipaddress.ip_address(args[2])) + timeout = int(args[3]) if len(args) == 4 and args[3].isdigit() and int(args[3]) > 0 else 6 + if len(args) == 4 and (not args[3].isdigit() or int(args[3]) < 1): + raise ValueError("invalid connection timeout") if args[0] == "--command": # ProxyCommand is parsed by both OpenSSH (% tokens) and a shell. # Embed validated literal arguments, not expanded %h/%p tokens. - command = [sys.executable, str(Path(__file__).resolve()), "--relay", interface, address] + command = [sys.executable, str(Path(__file__).resolve()), "--relay", interface, address, str(timeout)] print(shlex.join(command).replace("%", "%%")) return family, kind, proto, _, destination = socket.getaddrinfo( @@ -97,7 +100,7 @@ def main(args): )[0] with socket.socket(family, kind, proto) as sock: sock.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, interface.encode() + b"\0") - sock.settimeout(6) + sock.settimeout(timeout) sock.connect(destination) sock.settimeout(None) relay(sock) From 0f14a00b37f6ffe3ce1fb4a145666523b1a3a38a Mon Sep 17 00:00:00 2001 From: Gr-linkk Date: Sun, 8 Nov 2026 10:53:58 -0700 Subject: [PATCH 17/66] omamobile-shell 0.2.104: show the battery's reported state (#421) The bar, the home widget and quick settings follow UPower's own battery.state instead of "charger online": charging and time estimates show only when the battery reports that state, and pending and unknown states are shown as such, so external power no longer implies charging. The bar's Full glyph loses its bolt too (on the 7 Pro as well as in quick settings): the icon helper chose the charging-full glyph for Full even when charging was false, and a Pixel 6 reporting Full at 91% showed the bolt. The battery-state test covers it. Tested on a Pixel 6 in all three states on all three surfaces. 0.2.104: main already carries 0.2.101 (#464), and #482 and #420 hold 0.2.102 and 0.2.103. --- .../plugins/omamobile.bar/Bar.qml | 2 +- .../plugins/omamobile.bar/StatusModel.js | 2 +- .../plugins/omamobile.home/BatteryWidget.qml | 11 ++- .../omamobile.quicksettings/QuickSettings.qml | 2 +- packages/omamobile-shell/test/all | 1 + .../omamobile-shell/test/battery-state.js | 68 +++++++++++++++++++ packages/omamobile-shell/version | 2 +- 7 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 packages/omamobile-shell/test/battery-state.js diff --git a/packages/omamobile-shell/plugins/omamobile.bar/Bar.qml b/packages/omamobile-shell/plugins/omamobile.bar/Bar.qml index 96f73fdd2..8d82e0cb2 100644 --- a/packages/omamobile-shell/plugins/omamobile.bar/Bar.qml +++ b/packages/omamobile-shell/plugins/omamobile.bar/Bar.qml @@ -193,7 +193,7 @@ Item { readonly property var battery: UPower.displayDevice readonly property bool hasBattery: !!battery && battery.isPresent === true readonly property int batteryPercent: hasBattery ? Math.round(battery.percentage * 100) : -1 - readonly property bool charging: hasBattery && !UPower.onBattery + readonly property bool charging: hasBattery && battery.state === UPowerDeviceState.Charging readonly property string batteryIcon: StatusModel.batteryIcon(batteryPercent, charging, hasBattery && battery.state === UPowerDeviceState.FullyCharged) diff --git a/packages/omamobile-shell/plugins/omamobile.bar/StatusModel.js b/packages/omamobile-shell/plugins/omamobile.bar/StatusModel.js index f5b7931e3..ec2ae710d 100644 --- a/packages/omamobile-shell/plugins/omamobile.bar/StatusModel.js +++ b/packages/omamobile-shell/plugins/omamobile.bar/StatusModel.js @@ -122,7 +122,7 @@ function unreadCount(names, seen) { function batteryIcon(percent, charging, full) { if (percent < 0) return "" - if (full) return "󰂅" + if (full) return "󰁹" var chargingIcons = ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"] var defaultIcons = ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] var index = Math.max(0, Math.min(9, Math.floor(percent / 10))) diff --git a/packages/omamobile-shell/plugins/omamobile.home/BatteryWidget.qml b/packages/omamobile-shell/plugins/omamobile.home/BatteryWidget.qml index 41c62586b..9ca592d1f 100644 --- a/packages/omamobile-shell/plugins/omamobile.home/BatteryWidget.qml +++ b/packages/omamobile-shell/plugins/omamobile.home/BatteryWidget.qml @@ -16,9 +16,10 @@ Item { readonly property var battery: UPower.displayDevice readonly property bool present: !!battery && battery.isPresent === true readonly property int percent: present ? Math.round(battery.percentage * 100) : -1 - readonly property bool charging: present && !UPower.onBattery + readonly property bool charging: present && battery.state === UPowerDeviceState.Charging + readonly property bool discharging: present && battery.state === UPowerDeviceState.Discharging readonly property bool full: present && battery.state === UPowerDeviceState.FullyCharged - readonly property real seconds: !present ? 0 : (charging ? battery.timeToFull : battery.timeToEmpty) + readonly property real seconds: charging ? battery.timeToFull : discharging ? battery.timeToEmpty : 0 function duration(s) { if (!s || s <= 0) return "" @@ -29,7 +30,11 @@ Item { readonly property string detail: !present ? "No battery" : full ? "Full" : charging ? (duration(seconds) ? "Full in " + duration(seconds) : "Charging") - : (duration(seconds) ? duration(seconds) + " left" : "On battery") + : discharging ? (duration(seconds) ? duration(seconds) + " left" : "On battery") + : battery.state === UPowerDeviceState.PendingCharge ? "Waiting to charge" + : battery.state === UPowerDeviceState.PendingDischarge ? "Waiting to discharge" + : battery.state === UPowerDeviceState.Empty ? "Empty" + : "Charging status unknown" readonly property color levelColor: percent >= 0 && percent <= 15 && !charging ? Commons.Color.urgent : Commons.Color.accent readonly property bool compact: width < 100 diff --git a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml index 23c455ebd..4b2d2f86f 100644 --- a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml +++ b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml @@ -1557,7 +1557,7 @@ Item { anchors.verticalCenter: parent.verticalCenter textFormat: Text.PlainText text: root.hasBattery - ? (UPower.onBattery ? "󰁹 " : "󰂄 ") + Math.round(root.battery.percentage * 100) + "%" + ? (root.battery.state === UPowerDeviceState.Charging ? "󰂄 " : "󰁹 ") + Math.round(root.battery.percentage * 100) + "%" : "" color: root.foreground font.family: Style.font.family diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 4a242065b..22301d507 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -908,6 +908,7 @@ if [[ -n ${OMAMOBILE_CALL_RENDER:-} ]]; then fi if command -v node >/dev/null; then node test/status-model.js >/dev/null || { node test/status-model.js; fail "status bar model"; } + node test/battery-state.js || fail "battery state bindings" fi python3 -B -c 'import ast,sys; ast.parse(open(sys.argv[1]).read())' bin/omamobile-cell-watch || fail "omamobile-cell-watch parses" if command -v dbus-run-session >/dev/null; then diff --git a/packages/omamobile-shell/test/battery-state.js b/packages/omamobile-shell/test/battery-state.js new file mode 100644 index 000000000..9ba0f8217 --- /dev/null +++ b/packages/omamobile-shell/test/battery-state.js @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: MIT +// Exercise the actual QML JavaScript bindings with representative UPower states. +const assert = require('assert') +const fs = require('fs') +const vm = require('vm') +const path = require('path') + +const root = process.argv[2] || path.join(__dirname, '..') +const read = (name) => fs.readFileSync(path.join(root, 'plugins', name), 'utf8') +const home = read('omamobile.home/BatteryWidget.qml') +const bar = read('omamobile.bar/Bar.qml') +const quick = read('omamobile.quicksettings/QuickSettings.qml') +const statusModel = require(path.resolve(root, 'plugins/omamobile.bar/StatusModel.js')) +assert.strictEqual(statusModel.batteryIcon(91, false, true), '󰁹', + 'Full below 100% must use the full battery glyph without a charging bolt') +assert.notStrictEqual(statusModel.batteryIcon(91, true, false), '󰁹', + 'Charging must retain its charging glyph') +function capture(text, pattern, name) { + const match = text.match(pattern) + assert(match, `could not find ${name} binding`) + return match[1] +} +const binding = (text, name) => capture(text, new RegExp(`readonly property (?:bool|real) ${name}: ([^\\n]+)`), name) +const S = { Unknown: 0, Charging: 1, Discharging: 2, Empty: 3, FullyCharged: 4, PendingCharge: 5, PendingDischarge: 6 } +const evaluate = (expr, ctx) => vm.runInNewContext(expr, ctx) +const barCharging = binding(bar, 'charging') +assert.strictEqual(evaluate(barCharging, { hasBattery: true, battery: { state: S.Unknown }, + UPower: { onBattery: false }, UPowerDeviceState: S }), false, 'unknown state must not show charging') +const homeCharging = binding(home, 'charging') +const homeDischarging = binding(home, 'discharging') +const homeSeconds = binding(home, 'seconds') +const homeDetail = capture(home, /readonly property string detail: ([\s\S]*?)\n\n/, 'battery detail') +const duration = capture(home, /(function duration\(s\) \{[\s\S]*?\n \})/, 'duration') +const quickText = capture(quick, /text: (root\.hasBattery\s*\n\s*\?[^\n]+\n\s*: "")/, 'quick settings battery text') + +function state(state, present = true) { + const battery = present ? { state, percentage: .5, timeToFull: 3600, timeToEmpty: 7200 } : null + // External power can be present even when the device does not report charging. + const ctx = { battery, present, hasBattery: present, UPowerDeviceState: S, UPower: { onBattery: false } } + ctx.charging = evaluate(homeCharging, ctx) + ctx.discharging = evaluate(homeDischarging, ctx) + ctx.full = present && state === S.FullyCharged + ctx.seconds = evaluate(homeSeconds, ctx) + ctx.duration = evaluate('(' + duration + ')', ctx) + return { + homeCharging: ctx.charging, + barCharging: evaluate(barCharging, ctx), + text: evaluate(quickText, { ...ctx, root: { hasBattery: present, battery } }), + detail: evaluate(homeDetail, ctx), + } +} + +for (const [value, text] of [[S.Unknown, 'Charging status unknown'], [S.PendingCharge, 'Waiting to charge'], + [S.PendingDischarge, 'Waiting to discharge'], [S.Empty, 'Empty'], [S.FullyCharged, 'Full']]) { + const got = state(value) + assert.strictEqual(got.homeCharging, false) + assert.strictEqual(got.barCharging, false) + assert.strictEqual(got.text, '󰁹 50%') + assert.strictEqual(got.detail, text) +} +assert.strictEqual(state(S.Charging).detail, 'Full in 1 h 0 min') +assert.strictEqual(state(S.Charging).homeCharging, true) +assert.strictEqual(state(S.Charging).text, '󰂄 50%') +assert.strictEqual(state(S.Charging).barCharging, true) +assert.strictEqual(state(S.Discharging).detail, '2 h 0 min left') +assert.strictEqual(state(S.Unknown, false).detail, 'No battery') +assert.strictEqual(state(S.Unknown, false).text, '') +console.log('ok - explicit battery states in home, bar and quick settings') diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index d8a838a1f..d3b7e5fff 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.101 +0.2.104 From 12b60ed463dc111ca40806369335c17c102ecda0 Mon Sep 17 00:00:00 2001 From: kloot Date: Sun, 8 Nov 2026 19:02:03 +0100 Subject: [PATCH 18/66] omamobile-shell 0.2.105: recents keep the user's card when a window closes (#524) Flicking a card up to close it, or any window closing while recent apps are open, dropped the switcher back to the first (newest) card. The ListView's model is root.windows, a new JavaScript array whenever the toplevel list changes, and a new model puts currentIndex back to 0; the re-centring after the count change then centred that 0. The view now remembers the card the user is on, by its window and by its index, whenever a swipe ends or it centres a card, and comes back to it after the model changes: the same window if it is still open, else the card that took the closed one's place (clamped to the last). Opening recents still starts on the newest card. test/switcher-touch: test_closing_a_window_keeps_the_place swipes to the second card, closes another window (the same window stays current), then the current one (the next card, not the newest). It fails without the change ("the same window after another one closed") and passes with it. Co-Authored-By: Claude Opus 5.5 --- .../plugins/omamobile.switcher/Switcher.qml | 23 +++++++++++- .../omamobile-shell/test/switcher-touch.qml | 37 +++++++++++++++++++ packages/omamobile-shell/version | 2 +- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml b/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml index 6c4a22d7b..62acc5d95 100644 --- a/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml +++ b/packages/omamobile-shell/plugins/omamobile.switcher/Switcher.qml @@ -299,9 +299,28 @@ Item { var i = Math.max(0, Math.min(count - 1, index)) currentIndex = i positionViewAtIndex(i, ListView.Center) + keep() } - onWidthChanged: Qt.callLater(function() { cards.centreOn(cards.currentIndex) }) - onCountChanged: Qt.callLater(function() { cards.centreOn(cards.currentIndex) }) + + // The card the user is on, by its window and by its place. + // root.windows is a new array whenever a window opens or closes, and a + // new model puts currentIndex back to 0: closing a card jumped back to + // the newest one. Come back to the same window, or, when that window + // is the one that closed, to the card that took its place. + property var keptWindow: null + property int keptIndex: 0 + function keep() { + keptIndex = currentIndex + keptWindow = root.windows[currentIndex] || null + } + function restore() { + var i = keptWindow ? root.windows.indexOf(keptWindow) : -1 + centreOn(i >= 0 ? i : keptIndex) + } + onMovementEnded: keep() + onWidthChanged: Qt.callLater(cards.restore) + onCountChanged: Qt.callLater(cards.restore) + onModelChanged: Qt.callLater(cards.restore) // 72% of the width upright; on its side, no wider than the screen's // shape gives the card's height (the title sits above the card). diff --git a/packages/omamobile-shell/test/switcher-touch.qml b/packages/omamobile-shell/test/switcher-touch.qml index 859b4da32..0ad4e9f9b 100644 --- a/packages/omamobile-shell/test/switcher-touch.qml +++ b/packages/omamobile-shell/test/switcher-touch.qml @@ -287,6 +287,43 @@ Item { tryVerify(function() { return test.offCentre(cards) < 1 }, 2000, "centred after a window closes") } + // Closing a window keeps the user's place: the same card when another + // window closed, the card that took its place when the current one did. + // root.windows is a new array on every change, and the new model used to + // drop recents back to the newest card. + function test_closing_a_window_keeps_the_place() { + var a = fakeWindow.createObject(top, { appId: "a" }), b = fakeWindow.createObject(top, { appId: "b" }), + c = fakeWindow.createObject(top, { appId: "c" }), d = fakeWindow.createObject(top, { appId: "d" }) + openWith([a, b, c, d]) // newest first: d, c, b, a + var cards = cardsList() + tryVerify(function() { return cards.count === 4 && cards.currentItem !== null }) + compare(cards.currentIndex, 0) + + var y = overlay.height / 2, x = overlay.width / 2 + var t = touchEvent(overlay.contentItem) + t.press(0, overlay.contentItem, x + 120, y).commit() + for (var j = 1; j <= 12; j++) { wait(16); t.move(0, overlay.contentItem, x + 120 - j * 25, y).commit() } + t.release(0, overlay.contentItem, x - 180, y).commit() + tryVerify(function() { return !cards.moving && !cards.flicking }, 3000) + var at = cards.currentIndex + verify(at > 0, "swiped on from the newest card") + var here = sw.windows[at] + + // Another window closes (the oldest): still on the same window. + top.drop(a) + tryVerify(function() { return cards.count === 3 }) + tryVerify(function() { return sw.windows[cards.currentIndex] === here }, 2000, "the same window after another one closed") + tryVerify(function() { return test.offCentre(cards) < 1 }, 2000, "centred") + + // The current window closes: the card that took its place, not the newest. + var place = cards.currentIndex + top.drop(here) + tryVerify(function() { return cards.count === 2 }) + tryVerify(function() { return cards.currentIndex === Math.min(place, cards.count - 1) }, 2000, "the next card, not back to the first") + verify(place === 0 || cards.currentIndex !== 0 || cards.count === 1, "not dropped back to the newest card") + tryVerify(function() { return test.offCentre(cards) < 1 }, 2000, "centred") + } + // A window that gets its size after it is shown still opens centred. function test_centred_after_a_resize() { var a = fakeWindow.createObject(top), b = fakeWindow.createObject(top, { appId: "chromium" }) diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index d3b7e5fff..d399056af 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.104 +0.2.105 From 804c5a01c126b915bdfc0a34310e1bb1ee629cf4 Mon Sep 17 00:00:00 2001 From: kloot Date: Sun, 8 Nov 2026 19:10:18 +0100 Subject: [PATCH 19/66] omamobile-shell 0.2.106: depend on dnsmasq for the Hotspot tile (#525) The Hotspot tile runs `nmcli device wifi hotspot`, whose connection uses ipv4.method shared. NetworkManager's shared mode runs dnsmasq for DHCP and DNS on the hotspot, and nothing in the root image pulls it in (only omamobile-waydroid depends on it, and images don't ship that). The access point comes up, then the activation fails: ip:shared4: could not start dnsmasq: Could not find "dnsmasq" binary state change: ip-config -> failed (reason 'ip-config-unavailable') and the phone goes back to its Wi-Fi network. Seen on a Pixel 9a; the missing binary is independent of the phone. With dnsmasq installed the same connection activates, gets 10.42.0.1/24 and dnsmasq serves 10.42.0.10-254. Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-shell/PKGBUILD | 1 + packages/omamobile-shell/version | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/omamobile-shell/PKGBUILD b/packages/omamobile-shell/PKGBUILD index ed1f88a61..c3c32ff32 100644 --- a/packages/omamobile-shell/PKGBUILD +++ b/packages/omamobile-shell/PKGBUILD @@ -13,6 +13,7 @@ depends=(omarchy omamobile-apps 'omamobile-omarchy>=0.1.11' 'omamobile-owl-widge inotify-tools qt6-declarative iproute2 jq # omamobile-sleepd: ss for SSH sessions; jq also for omamobile-keys # Both are in Omarchy's base package list, which root images install. + dnsmasq # the Hotspot tile: NetworkManager's shared mode hands out addresses with it foot xdg-terminal-exec # guard for hand-built/partial installations xdg-desktop-portal-gnome) # the file chooser (portal/hyprland-portals.conf) optdepends=('fprintd: fingerprint setup and unlock (with omamobile-fingerprint)' diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index d399056af..d08f818d4 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.105 +0.2.106 From 38e3bb083d6751fc7e0cc009ae81659b95b1f461 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 8 Nov 2026 19:28:25 -0500 Subject: [PATCH 20/66] omamobile-device-cheetah 0.1.47: load nvmem_max77759 for the reboot reason (#534) linux-omarchy-mobile#176 describes the MAX77759's reboot-reason cell and an nvmem-reboot-mode node on it, so `reboot-to bootloader` writes 0x800000fc (RSBM valid, bootloader) where Google's driver does and ABL stops in fastboot. The cell's provider is nvmem_max77759, which this package has blacklisted since the MAX77759 bring-up, so the reboot-mode driver waited for its supplier and the reason was never written. Tested on the maintainer's Pixel 7 Pro on 2026-11-08, on #176's kernel (7.3.0-rc6-omamobile-push1-g8de6aedc7373) with nvmem_max77759 loaded by hand: reboot-mode bound, the cell read 00 00 00 80, `reboot-to bootloader` reached fastboot about 4 s later with no buttons (the same command without the module did not that morning), `fastboot reboot` returned to slot B with the cell back at 00 00 00 80, and a plain `systemctl reboot` booted normally. The module autoloads by its platform:max77759-nvmem alias once the blacklist is gone. On a kernel without #176's cells it provides nothing anyone uses. tcpci_maxim and gpio_max77759 stay blacklisted. Co-Authored-By: Claude Opus 5.5 --- .../vendor/modprobe.d/omamobile-max77759.conf | 4 +++- packages/omamobile-device-cheetah/version | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-device-cheetah/vendor/modprobe.d/omamobile-max77759.conf b/packages/omamobile-device-cheetah/vendor/modprobe.d/omamobile-max77759.conf index d98aa8aaa..a04e81659 100644 --- a/packages/omamobile-device-cheetah/vendor/modprobe.d/omamobile-max77759.conf +++ b/packages/omamobile-device-cheetah/vendor/modprobe.d/omamobile-max77759.conf @@ -5,6 +5,8 @@ # The MFD core and the charger load at boot (omamobile-charger.conf sets the # charger's input limit and temperature guard; USB-C-PLAN D1). tcpci_maxim # would take over the USB-C port we use for SSH: it waits for gate B4. +# nvmem_max77759 loads: it provides the reboot-reason cell that +# nvmem-reboot-mode writes for `reboot-to bootloader` (linux-omarchy-mobile +# #176). blacklist tcpci_maxim blacklist gpio_max77759 -blacklist nvmem_max77759 diff --git a/packages/omamobile-device-cheetah/version b/packages/omamobile-device-cheetah/version index 6871b9e7a..9506d143f 100644 --- a/packages/omamobile-device-cheetah/version +++ b/packages/omamobile-device-cheetah/version @@ -1 +1 @@ -0.1.44 +0.1.47 From d76d1c6fa100d33ac0ab6e8917d43d9b860f7aac Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 8 Nov 2026 19:36:13 -0500 Subject: [PATCH 21/66] build-packages: sign the index as the container's root on a host without pacman (#544) On a host without repo-add (ms01, Ubuntu), build-packages runs pacman's repo-add from the Arch Linux ARM image with -u $(id -u). Under rootless Docker that container uid is a subordinate uid on the host, which can't read keys/gnupg.release (mode 700), so the first dry run on ms01 built omamobile-device-cheetah and then stopped at the index: "The key 20567593... does not exist in your keyring". The desktop never hit it: it is an Arch machine and runs repo-add on the host. repo-add now runs as the container's root and hands /repo back to the owner it arrived with, as the package build already does for #73: under rootless Docker that root is this user; under rootful Docker root reads the keyring and the chown keeps the index this user's. Checked on ms01 (rootless Docker 29.9.3) on a copy of out/repo/aarch64: 43 packages indexed, omamobile.db.tar.gz and its .sig owned by the user, gpg --verify: Good signature from the release key, keyring ownership unchanged. Co-Authored-By: Claude Opus 5.5 --- tools/build-packages | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/build-packages b/tools/build-packages index 3ff042990..fe3e2549f 100755 --- a/tools/build-packages +++ b/tools/build-packages @@ -319,10 +319,17 @@ sign_and_index() { (cd "$repo" && repo-add --quiet --sign --key "$key" omamobile.db.tar.gz "${packages[@]}") else # Not an Arch machine: pacman's repo-add from the Arch Linux ARM image, - # as this user, with the same key. - docker run --rm --platform linux/arm64 -u "$(id -u):$(id -g)" \ + # with the same key. It runs as the container's root and hands /repo + # back to the owner it arrived with, as the build does: under rootless + # Docker the container's root is this user and a container uid such as + # this user's is a subordinate uid on the host, which can't read the + # keyring (mode 700), so `-u $(id -u)` failed there with "The key ... + # does not exist in your keyring"; under rootful Docker root reads it + # and the chown keeps the index this user's. + docker run --rm --platform linux/arm64 \ -v "$ROOT/$repo:/repo" -v "$GNUPGHOME:/gnupg" -e GNUPGHOME=/gnupg -e HOME=/tmp -w /repo \ - "$(alarm_base_image)" repo-add --quiet --sign --key "$key" omamobile.db.tar.gz "${packages[@]}" + "$(alarm_base_image)" bash -c 'owner=$(stat -c %u:%g /repo); trap "chown -R $owner /repo" EXIT + repo-add --quiet --sign --key "$0" omamobile.db.tar.gz "$@"' "$key" "${packages[@]}" fi } From 29a6df002a526ee75a5597867f3736c6e74524f5 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 8 Nov 2026 19:36:17 -0500 Subject: [PATCH 22/66] omamobile-shell: nodejs as a check dependency (#545) test/weather.py (since 0.2.90, #366) runs plugins/omamobile.home/HomeModel.js under node, but the PKGBUILD never said so. CI's runner and the build image have node, so nothing noticed until tools/phone-install-package built the shell on the Pixel 7 Pro, which has no node: check() failed at "omamobile-weather" and the package wasn't installed (2026-11-08, while installing #420 for its test). phone-install-package installs a package's checkdepends for the build and removes them afterwards, so with this line the phone built and installed it and nodejs was gone again. No version change: the package's files are the same. Co-Authored-By: Claude Opus 5.5 --- packages/omamobile-shell/PKGBUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/omamobile-shell/PKGBUILD b/packages/omamobile-shell/PKGBUILD index c3c32ff32..4517ea59a 100644 --- a/packages/omamobile-shell/PKGBUILD +++ b/packages/omamobile-shell/PKGBUILD @@ -16,6 +16,7 @@ depends=(omarchy omamobile-apps 'omamobile-omarchy>=0.1.11' 'omamobile-owl-widge dnsmasq # the Hotspot tile: NetworkManager's shared mode hands out addresses with it foot xdg-terminal-exec # guard for hand-built/partial installations xdg-desktop-portal-gnome) # the file chooser (portal/hyprland-portals.conf) +checkdepends=(nodejs) # test/weather.py runs HomeModel.js under node optdepends=('fprintd: fingerprint setup and unlock (with omamobile-fingerprint)' 'omamobile-voice: the speech model for voice input, so Voxtype works with no download (the root image has it)' 'voxtype-bin: voice input (the root image has it; or Install > AI > Dictation)') From c8098b9cdcc0371e9a0ba982c7d76ba3d8acd2ed Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 8 Nov 2026 20:42:18 -0500 Subject: [PATCH 23/66] device/cheetah: NOTES, the release kernel for 2026.11.08 and the day's runs (#546) The boot of 7.3.0-rc6-omamobile-g1a9d1d4e9289 (omamobile at 1a9d1d4e9289, the planned kernel-2026.11.08) that tools/release's kernel stage looks for, the five kernel pull requests that passed on this phone today, the flat battery of issue #169 and its fix, and the modem marker a reboot-to leaves behind. Co-Authored-By: Claude Opus 5.5 --- device/cheetah/NOTES.md | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/device/cheetah/NOTES.md b/device/cheetah/NOTES.md index 0861b2479..ef837f802 100644 --- a/device/cheetah/NOTES.md +++ b/device/cheetah/NOTES.md @@ -2,6 +2,55 @@ Findings from real hardware, newest first. `BRINGUP-M1.md` is the research map written before first boot. +## 2026-11-08: the release kernel for 2026.11.08, a flat battery, the reboot reason + +Kernel `7.3.0-rc6-omamobile-g1a9d1d4e9289`, `omamobile` at `1a9d1d4e9289` +(the planned `kernel-2026.11.08`), built with the release `LOCALVERSION` and +the development initramfs and pushed to slot B; `omamobile-device-cheetah` +0.1.43, `omamobile-shell` 0.2.107 and `omamobile-omarchy` 0.1.37 (#420's test +build), Omarchy 4.0.6. + +- **The release kernel boots** [V]: `uname -r` reads + `7.3.0-rc6-omamobile-g1a9d1d4e9289`. Touch probed as before (`S3908GA1B0-15.0, + TouchComm v1, build 4104960, message CRC off`), the charger's guard had its + battery reading at probe (4.67 s, mode 5), the sound card registered all 18 + playback PCMs, Wi-Fi connected, and the modem came up at boot: IMS + registered (`state 2 (VoLTE registered)`) about 100 s after boot. + `tools/phone-smoke`: 18 ok, cameras skipped (no libcamera tools); its one + "not ok" is the modem's `rx_demux … is not opened` drops, at the rate of + every modem-up boot today. +- **This tree, piece by piece** [V], each on its own test kernel, `-push1` + builds of the PR merged onto `omamobile`, and posted on the PR: + linux-omarchy-mobile#194 (touch: both probe lines unchanged, no fallback, + no desync after a minute of touch), #201 (S2MPG12 RTC: reads 0 s off, a + wake alarm awake, 10 RTC-woken s2idle cycles with the modem off, none woken + early), #191 with #187 (Wi-Fi scans, a 300 MB download at about 130 Mbit/s + with no `No PKTID`; the modem: an SMS, an answered call, 10 minutes idle), + #176 (the reboot reason: with `nvmem_max77759` loaded by hand, `reboot-to + bootloader` reached fastboot without the buttons, about 4 s; device-cheetah + 0.1.47, #534, stops blacklisting it) and #162 (the AoC series: the same + PCMs, both amplifiers' protection firmware, a -20 dBFS tone clean from both + speakers, the three sensors). +- **A flat battery** [V] (issue #169): after five days unplugged the phone + booted Linux at 3.14 V, the gauge's model load failed (`-110`) and the + charger logged `charging inhibited`; the battery read -706 mA on the + laptop's port. About 20 minutes in fastboot on the cable took it from 3.40 + to 3.91 V, and the next boot loaded the model and charged at 1.43 A. On that + boot the charger still probed before the gauge answered and charged only + from its guard's next period, 31 s later. The fix (`omamobile` 01ba2e2119ed, + 28bab7f602ca, 1a9d1d4e9289) re-checks a missing reading every 2 s and at the + gauge's first report: unloading and reloading the gauge, charging resumed + 10 ms after it came back. The model-load retry itself waits for the next + real flat battery. +- **A modem marker left by `reboot-to`** [V]: the `reboot-to bootloader` that + took the flat phone to fastboot stopped no unit, so `/var/lib/omamobile/modem-up` + stayed and the next boot skipped the modem once ("ended without a clean + stop"), as designed. Stop the modem first (`systemctl stop + omamobile-modem`) before a `reboot-to` or a `bin/omamobile push`; that stop + takes 40 s and ends "failed" with a recorded crash, issue #532. To keep the + modem off for a boot (a suspend test), `systemctl mask + omamobile-modem-boot.target`, not `/etc/omamobile/modem-hold`. + ## 2026-11-03: calls and texts through the apps, the SIM configures itself, the earpiece at the loud stage, the stack on by default Kernel `7.3.0-rc6-omamobile-g2219cc6cda77` (the release kernel); From 71b47a6a4a199888e7b88d1b41cb93ac979f929c Mon Sep 17 00:00:00 2001 From: angelrenefm <17342133+angelrenefm@users.noreply.github.com> Date: Mon, 9 Nov 2026 02:53:58 +0100 Subject: [PATCH 24/66] omamobile-omarchy 0.1.37, omamobile-shell 0.2.107: double tap to wake, a single touch leaves the screen dark (#420) A phone in a pocket woke on any touch: the locked screen lit on the first contact, and a brush of the palm did the same. Now a double tap wakes it, as on Android, and a single touch leaves it dark. omamobile-shell's new omamobile-doubletap (a user unit for every graphical session) reads the touchscreen without a grab: the first input device with INPUT_PROP_DIRECT, BTN_TOUCH and ABS_MT_POSITION_X, with the user in the input group. It times two taps from one lift to the next touch. While the screen is dark it wakes the lock through its IPC (0009), as the power key does, unless the proximity sensor reads near. Lit, it does nothing, so apps keep their own double taps. Hyprland's misc:mouse_move_enables_dpms is off on the phone (hypr/phone.lua), so the first touch no longer lights the panel before the lock sees it. omamobile-omarchy's 0029 makes the locked, dark lock ignore every touch (the glance's wake-only touch from 0023): only omamobile-doubletap or the power key wakes it. On a computer (keypad off) a click or a mouse move wakes the lock as before. A dark, unlocked screen locks within about 1.5 s, so a tap after that reaches nothing. Tested on the maintainer's Pixel 7 Pro on 2026-11-08 (Omarchy 4.0.6, both packages built from this branch merged onto main, 29 patches applied): a single touch while dark stayed dark; a double tap lit the lock; covered, a double tap didn't wake, and uncovered it did; a tap on a dark unlocked screen reached nothing and Power woke to the lock; a short press locked once; double taps inside an app behaved as before. The watcher used 16.9 s of CPU in 49 minutes of that session. Co-Authored-By: Claude Opus 5.5 --- ...e-tap-to-wake-for-touch-only-devices.patch | 71 +++++ .../omamobile-omarchy/test/lock-glance.qml | 49 ++- packages/omamobile-omarchy/test/patches.py | 3 + packages/omamobile-omarchy/version | 2 +- packages/omamobile-shell/README.md | 1 + .../omamobile-shell/bin/omamobile-doubletap | 297 ++++++++++++++++++ packages/omamobile-shell/bin/omamobile-keys | 49 ++- packages/omamobile-shell/hypr/phone.lua | 6 +- packages/omamobile-shell/install | 4 + .../systemd/user/omamobile-doubletap.service | 15 + packages/omamobile-shell/test/all | 10 + packages/omamobile-shell/test/doubletap.py | 153 +++++++++ packages/omamobile-shell/test/keys.sh | 35 +++ packages/omamobile-shell/test/phone-rules.lua | 2 + packages/omamobile-shell/version | 2 +- 15 files changed, 677 insertions(+), 22 deletions(-) create mode 100644 packages/omamobile-omarchy/patches/0029-lock-double-tap-to-wake-for-touch-only-devices.patch create mode 100755 packages/omamobile-shell/bin/omamobile-doubletap create mode 100644 packages/omamobile-shell/systemd/user/omamobile-doubletap.service create mode 100644 packages/omamobile-shell/test/doubletap.py diff --git a/packages/omamobile-omarchy/patches/0029-lock-double-tap-to-wake-for-touch-only-devices.patch b/packages/omamobile-omarchy/patches/0029-lock-double-tap-to-wake-for-touch-only-devices.patch new file mode 100644 index 000000000..dce7f2df7 --- /dev/null +++ b/packages/omamobile-omarchy/patches/0029-lock-double-tap-to-wake-for-touch-only-devices.patch @@ -0,0 +1,71 @@ +# Lock: double tap to wake on touch-only devices (the lock-keypad toggle), +# as a phone does. While the locked display is dark, no touch lights it or +# does anything else (the glance's wake-only touch from 0023): the double +# tap is recognised by omamobile-shell's omamobile-doubletap, which skips it +# while the proximity sensor reads near (a pocket) and wakes the lock +# through its IPC (0009), as the power key does. A touch in a pocket or a +# brush of the palm no longer lights the screen. On a computer (keypad off) +# a click or a mouse move wakes the lock as before. +# +# The phone's compositor side turns Hyprland's misc:mouse_move_enables_dpms +# off, so the first touch doesn't light the panel before the lock sees it +# (omamobile-shell, hypr/phone.lua). Without omamobile-shell that setting +# stays on and Hyprland lights the panel on any touch, as before. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0023. +diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml +index 7fa116f..cfc291b 100644 +--- i/shell/plugins/lock/LockGlance.qml ++++ w/shell/plugins/lock/LockGlance.qml +@@ -126,12 +126,14 @@ Item { + wakeGuardUntil = Date.now() + wakeGuardMs + } + +- // Whether a touch that starts now only wakes the screen; a dark one is +- // lit through the lock, as any touch on the lock lights it. ++ // Whether a touch that starts now only wakes the screen; on a dark one ++ // it does nothing (omamobile-doubletap wakes it on a double tap). + function wakeTouch() { + if (lock.displayDark) { +- armWakeGuard() +- lock.wakeRequested() ++ if (lock.darkTapWakes()) { ++ armWakeGuard() ++ lock.wakeRequested() ++ } + return true + } + return Date.now() < wakeGuardUntil +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +index 4f17492..852f7c3 100644 +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -39,6 +39,13 @@ Item { + property int wakeSerial: 0 + property int blankSerial: 0 + property bool displayDark: false ++ // Double tap to wake: on a touch-only lock no touch on the dark screen ++ // wakes it; omamobile-doubletap recognises the double tap (and ignores it ++ // with the phone in a pocket, by proximity) and wakes the lock through ++ // its IPC. A computer's lock wakes on any input as before. ++ function darkTapWakes() { ++ return !keypad ++ } + readonly property real pinOpacity: 1 - glance.progress + readonly property bool pinVisible: glance.progress < 1 + property bool switchedInput: false +@@ -195,8 +202,12 @@ Item { + MouseArea { + anchors.fill: parent + hoverEnabled: !root.keypad +- onClicked: { root.wakeRequested(); root.forcePasswordFocus() } +- onPositionChanged: root.wakeRequested() ++ onClicked: { ++ if (root.displayDark && !root.darkTapWakes()) return ++ root.wakeRequested() ++ root.forcePasswordFocus() ++ } ++ onPositionChanged: if (!(root.keypad && root.displayDark)) root.wakeRequested() + } + + Item { diff --git a/packages/omamobile-omarchy/test/lock-glance.qml b/packages/omamobile-omarchy/test/lock-glance.qml index a2d6c2ef5..12684747e 100644 --- a/packages/omamobile-omarchy/test/lock-glance.qml +++ b/packages/omamobile-omarchy/test/lock-glance.qml @@ -326,28 +326,52 @@ Item { compare(visiblePinParts(), []) } - function test_wake_tap_on_dark_display_only_wakes() { + // Patch 0029: no tap wakes the dark screen; omamobile-doubletap + // recognises the double tap (not in a pocket, by proximity) and wakes + // the lock through its IPC, as the power key does. + function test_double_tap_on_dark_display_is_left_to_the_daemon() { toPin() blank() harness.wakes = 0 mouseClick(harness.view, 240, 300) + wait(150) + mouseClick(harness.view, 250, 310) settle() - compare(glance().showing, true, "the tap that woke the screen doesn't show the PIN view") - compare(harness.view.displayDark, false, "it lit the screen through the lock") - compare(harness.wakes, 1) - wait(200) + compare(harness.wakes, 0, "the lock doesn't wake itself on a double tap") + compare(harness.view.displayDark, true) + compare(glance().showing, true, "nor do the taps show the PIN view") + // omamobile-doubletap's wake, through the lock's IPC + harness.view.wakeSerial += 1 + harness.view.displayDark = false + settle() + compare(glance().showing, true, "the wake shows the glance") + wait(500) toPin() compare(glance().showing, false, "a swipe up on the lit glance shows the PIN view") } - function test_wake_swipe_on_dark_display_only_wakes() { + function test_lone_taps_on_dark_display_do_nothing() { blank() + harness.wakes = 0 + mouseClick(harness.view, 240, 300) + wait(600) + mouseClick(harness.view, 240, 300) + wait(600) + compare(harness.wakes, 0, "lone taps don't wake it") + compare(harness.view.displayDark, true) + compare(glance().showing, true) + } + + function test_wake_swipe_on_dark_display_does_nothing() { + blank() + harness.wakes = 0 mousePress(harness.view, 240, 600) for (var y = 590; y >= 400; y -= 10) mouseMove(harness.view, 240, y, -1, Qt.LeftButton) mouseRelease(harness.view, 240, 400) settle() - compare(glance().showing, true) - compare(harness.view.displayDark, false) + compare(glance().showing, true, "a swipe on the dark screen doesn't show the PIN view") + compare(harness.view.displayDark, true, "nor does it wake the screen") + compare(harness.wakes, 0) } function test_touch_right_after_a_wake_only_wakes() { @@ -698,6 +722,9 @@ Item { compare(one("lockPinClock").visible, false) compare(one("lockEmergencyCall").visible, false) verify(findAll(harness.view, function(i) { return i.visible && String(i.text) === "Enter Password" }).length > 0) + harness.wakes = 0 + mouseClick(harness.view, 240, 300) + compare(harness.wakes, 1, "one click wakes a computer's dark lock (0029 is touch-only)") } // Patch 0026: the battery, top right, over the glance and the PIN view @@ -867,9 +894,11 @@ Item { show() blank() tapOn(glanceButton("lockMediaPlayPause")) + wait(100) + tapOn(glanceButton("lockMediaPlayPause")) settle() - compare(p.calls, [], "the tap that lit the screen pressed nothing") - compare(harness.view.displayDark, false) + compare(p.calls, [], "a double tap on the dark screen presses nothing") + compare(harness.view.displayDark, true, "omamobile-doubletap wakes it, not the lock") } function test_what_it_cannot_do_does_nothing() { diff --git a/packages/omamobile-omarchy/test/patches.py b/packages/omamobile-omarchy/test/patches.py index b615fbf58..6e49f4349 100755 --- a/packages/omamobile-omarchy/test/patches.py +++ b/packages/omamobile-omarchy/test/patches.py @@ -519,6 +519,9 @@ def lock_glance(root): ok("XMLHttpRequest" not in glance and "curl" not in glance and "execDetached" not in glance and "call notifications forget" in glance and "invokeAction" not in glance, "real omarchy: the glance asks no network and runs no notification action, only the forget call (0023)") + ok("function darkTapWakes()" in view and "if (root.displayDark && !root.darkTapWakes()) return" in view + and "if (lock.darkTapWakes()) {" in read(root, lock + "LockGlance.qml"), + "real omarchy: a dark touch-only lock leaves the double tap to omamobile-doubletap (0029)") p = subprocess.run(["bash", os.path.join(HERE, "lock-glance"), os.path.join(root, "usr/share/omarchy/shell")], capture_output=True, text=True) if p.returncode == 77: diff --git a/packages/omamobile-omarchy/version b/packages/omamobile-omarchy/version index a52e04166..9f42295fc 100644 --- a/packages/omamobile-omarchy/version +++ b/packages/omamobile-omarchy/version @@ -1 +1 @@ -0.1.35 +0.1.37 diff --git a/packages/omamobile-shell/README.md b/packages/omamobile-shell/README.md index e726618fe..3efb5644d 100644 --- a/packages/omamobile-shell/README.md +++ b/packages/omamobile-shell/README.md @@ -26,6 +26,7 @@ Omarchy Mobile's phone profile for Omarchy's own shell. It isn't a fork: these a | `bin/omamobile-screenshot-open` | What a screenshot toast's tap ("Tap to view", patch 0020) opens on a phone (`OMARCHY_SCREENSHOT_EDITOR`, set in `environment.d/30-omamobile-screenshot.conf`; Omarchy passes the saved file's path): the screenshot in Loupe (omamobile-apps), fitted, with touch zoom, pan and swipe, and Loupe's copy, share and delete. Tensaku, Omarchy's default, can't be panned or zoomed by touch; without Loupe it is the fallback, through `omamobile-screenshot-edit` | | `bin/omamobile-screenshot-edit` | Tensaku as Omarchy opens a screenshot in it (`tensaku-edit`), with GTK's simple input-method context so the on-screen keyboard doesn't come up over the image (show it by hand for the text tool). `omamobile-setup-user` gives Tensaku's own entry (drawer, Loupe's Open With) the same context once, and `hypr/phone.lua` maximizes its window, which Omarchy floats by class | | `bin/omamobile-osk-guard` | Turns the on-screen keyboard (`screen-keyboard-enabled`) back on when it was left off with no screensaver running (a user unit for every graphical session) | +| `bin/omamobile-doubletap` | Double tap to wake, as on Android: two taps within 0.4 s and about 150 px of each other (14 % of the touchscreen's width) on a dark phone wake it as a short power press does (`omamobile-keys double-tap`, which leaves a lit screen alone). `hypr/phone.lua` turns Hyprland's `misc:mouse_move_enables_dpms` off, so a single touch no longer lights the screen; on the lock no touch wakes it either (patch 0029), and this daemon wakes it through `omamobile-keys double-tap`. With the phone in a pocket (proximity near, through iio-sensor-proxy, claimed only from the first dark tap until 2 s after the last) the double tap is skipped; without a proximity sensor it wakes as before. A screen that goes dark while unlocked (an idle blank, the panel powered off by hand) is locked at once (`omamobile-keys dark-unlocked`), as on Android: Hyprland sends a touch to the window under it whatever the screen's state, so on a dark unlocked phone it reached an app no one could see. It works while the phone is awake: a double tap can't wake it from sleep (with the sleep toggle on, the first 30 s after the screen goes off). It times a double tap from one lift to the next touch, and it only wakes: the lock itself ignores touches while dark (0029). The touchscreen is the first input device with `INPUT_PROP_DIRECT`, `BTN_TOUCH` and `ABS_MT_POSITION_X`, read without a grab (the user is in the `input` group). A user unit for every graphical session | | `bin/omamobile-sleepd` | Sleep (s2idle) once the screen has been off behind a secure lock for `OMAMOBILE_SLEEP_AFTER_OFF` s (30), and again 5 s after a dark resume; `now` for the power key (`omamobile-keys`), `check` to see what holds it awake. Refuses with the screen on, Stay awake on, an SSH session open, a logind sleep block inhibitor (calls, GNSS) or a RUNNING PipeWire sink. A user unit for every graphical session, **off until `omarchy-toggle omamobile-sleep on`** (device/cheetah/SUSPEND-PLAN.md 6.2) | | `bin/omamobile-weather` | The current weather for the lock screen's glance (`~/.local/state/omamobile/weather.json`, with the `source` it used) from Open-Meteo, at login and every 30 minutes (`omamobile-weather.timer`, a user unit for every graphical session). Where, in order: the phone's position from GeoClue at city accuracy, at most every 3 h and only while the Location switch is on and GeoClue has an agent for the user (omamobile-gnss's unit, or any other instance of GeoClue's demo agent the user runs; never a prompt); the setting `~/.config/omamobile/weather.json` (`omamobile-weather set "State College, PA" F`, or `{"latitude", "longitude"}`; `"location": "fixed"` puts it before the position); the home screen's today widget's city, or the weather widget's named place. Unit: the setting's, else the locale's. A failure keeps the old reading; a run that starts before the network is back (login, or the catch-up run on resume) tries again with backoff for up to 75 s and then gives up without failing the unit. `omamobile-weather show` says where it would look | | `bin/omamobile-fp-enroll` | fprintd enrollment helper the fingerprint screen runs (JSON lines) | diff --git a/packages/omamobile-shell/bin/omamobile-doubletap b/packages/omamobile-shell/bin/omamobile-doubletap new file mode 100755 index 000000000..4c2fd3a73 --- /dev/null +++ b/packages/omamobile-shell/bin/omamobile-doubletap @@ -0,0 +1,297 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Double tap to wake, as on Android: two short taps close together, in time +and place, on the touchscreen of a dark phone wake it as a short press of +the power key does (omamobile-keys double-tap, which leaves a lit screen +alone). A single touch no longer lights the screen: hypr/phone.lua turns +Hyprland's misc:mouse_move_enables_dpms off, and the lock ignores touches +while its display is dark (patches/omarchy/0029), so the double tap seen +here is the only touch that wakes it. + +Runs for every user's graphical session (omamobile-doubletap.service); the +user is in the input group, so it reads the touchscreen's evdev node +without grabbing it (the shell and the fingerprint bridge keep reading it). +The touchscreen is the first input device with INPUT_PROP_DIRECT, BTN_TOUCH +and ABS_MT_POSITION_X, whatever its driver; with none it waits for one. + +In a pocket, as Android does: when the phone has a proximity sensor +(iio-sensor-proxy's net.hadess.SensorProxy, HasProximity; omamobile-sensors +on the AoC phones), the first touch on a dark screen claims it, and a double +tap while it reads near is ignored. The sensor runs only from that touch +until RELEASE_AFTER of no touches. Without the service or the sensor +nothing changes. +""" + +import fcntl +import glob +import os +import select +import struct +import subprocess +import sys +import time + +try: + from gi.repository import Gio, GLib +except ImportError: # no python-gobject: no proximity guard + Gio = GLib = None + +TAP_MAX = 0.30 # s, a finger down to up for a tap +GAP_MAX = 0.40 # s, the first tap's lift to the second's touch +DIST_MAX = 0.14 # of the touchscreen's width between the taps (150 px of 1080) +WAIT = 5 # s between looks for a touchscreen +FRESH = 0.3 # s after the claim before ProximityNear counts (the sensor reports every 0.2 s) +RELEASE_AFTER = 2 # s of no touches before the proximity claim ends +DBUS_TIMEOUT = 200 # ms for each call to the sensor proxy + +EV_KEY, EV_ABS = 0x01, 0x03 +BTN_TOUCH = 0x14a +ABS_MT_POSITION_X, ABS_MT_POSITION_Y = 0x35, 0x36 +INPUT_PROP_DIRECT = 0x01 +EVENT = struct.Struct("llHHi") # struct input_event: timeval, type, code, value +LONG_BITS = struct.calcsize("l") * 8 + + +def bitmask(text): + """A sysfs capability bitmask (hex words, the most significant first).""" + value = 0 + for word in text.split(): + value = (value << LONG_BITS) | int(word, 16) + return value + + +def has(mask, bit): + return bool(mask >> bit & 1) + + +def find_touchscreen(sysfs="/sys"): + """The /dev/input node of the first direct (on-screen) multi-touch + device, or None.""" + def number(path): + return int(path.rsplit("event", 1)[1]) + for event in sorted(glob.glob(sysfs + "/class/input/event*"), key=number): + caps = event + "/device/" + try: + props = bitmask(open(caps + "properties").read()) + keys = bitmask(open(caps + "capabilities/key").read()) + abs_ = bitmask(open(caps + "capabilities/abs").read()) + except (OSError, ValueError): + continue + if has(props, INPUT_PROP_DIRECT) and has(keys, BTN_TOUCH) and has(abs_, ABS_MT_POSITION_X): + return "/dev/input/" + os.path.basename(event) + return None + + +def x_range(fd): + """The touchscreen's X span (EVIOCGABS(ABS_MT_POSITION_X)), or 1080.""" + try: + size = struct.calcsize("6i") + request = (2 << 30) | (size << 16) | (ord("E") << 8) | (0x40 + ABS_MT_POSITION_X) + _, low, high, _, _, _ = struct.unpack("6i", fcntl.ioctl(fd, request, bytes(size))) + return high - low if high > low else 1080 + except OSError: + return 1080 + + +class DoubleTap: + """Fed input events; feed() answers True on the second tap of a double + tap. Coordinates are the slot's last reported ones (pointer emulation + reports BTN_TOUCH for the first finger down and the last one up).""" + + def __init__(self, dist_max): + self.dist_max = dist_max + self.x = self.y = 0 + self.down_at = None + self.down_xy = (0, 0) + self.last_tap = None # (lifted at, where) + + def feed(self, t, type_, code, value): + if type_ == EV_ABS and code == ABS_MT_POSITION_X: + self.x = value + elif type_ == EV_ABS and code == ABS_MT_POSITION_Y: + self.y = value + elif type_ == EV_KEY and code == BTN_TOUCH: + if value == 1: + self.down_at, self.down_xy = t, (self.x, self.y) + elif self.down_at is not None: + down_at, self.down_at = self.down_at, None + if t - down_at > TAP_MAX: + self.last_tap = None + return False + last, self.last_tap = self.last_tap, (t, self.down_xy) + if last and down_at - last[0] <= GAP_MAX and \ + abs(self.down_xy[0] - last[1][0]) + abs(self.down_xy[1] - last[1][1]) <= self.dist_max: + self.last_tap = None + return True + return False + + +def screen_dark(sysfs="/sys"): + """Whether the panel is off: a DSI connector's DPMS isn't On (the state + omamobile-sensor-proxy sends the AoC). With no DSI connector it can't + tell, and says dark: the claim is then only made on touches.""" + states = [] + for path in glob.glob(sysfs + "/class/drm/*-DSI-*/dpms"): + try: + states.append(open(path).read().strip()) + except OSError: + pass + return not states or any(s != "On" for s in states) + + +class Proximity: + """iio-sensor-proxy's proximity on the system bus. claim() starts the + sensor (once), near() says whether it reads near, release() stops it. + Any failure (no python-gobject, no service, no sensor) reads as far.""" + + NAME = "net.hadess.SensorProxy" + PATH = "/net/hadess/SensorProxy" + + def __init__(self): + self.bus = None + self.claimed_at = None # time.monotonic() of the claim + + def _call(self, iface, method, args=None): + if Gio is None: + raise OSError("no python-gobject") + if self.bus is None: + self.bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None) + # NO_AUTO_START: never start a sensor service for this. + return self.bus.call_sync(self.NAME, self.PATH, iface, method, args, None, + Gio.DBusCallFlags.NO_AUTO_START, DBUS_TIMEOUT, None).unpack() + + def _get(self, prop): + return self._call("org.freedesktop.DBus.Properties", "Get", + GLib.Variant("(ss)", (self.NAME, prop)))[0] + + def claim(self): + if self.claimed_at is not None: + return + try: + if self._get("HasProximity"): + self._call(self.NAME, "ClaimProximity") + self.claimed_at = time.monotonic() + except Exception: # noqa: BLE001 - GLib.Error, OSError: as today + pass + + def near(self): + if self.claimed_at is None: + return False + # Give the sensor its first reading (a fast double tap is ~0.25 s). + left = FRESH - (time.monotonic() - self.claimed_at) + if left > 0: + time.sleep(left) + try: + return bool(self._get("ProximityNear")) + except Exception: # noqa: BLE001 + return False + + def release(self): + if self.claimed_at is None: + return + self.claimed_at = None + try: + self._call(self.NAME, "ReleaseProximity") + except Exception: # noqa: BLE001 - the proxy also drops it when we leave the bus + pass + + +def wake(): + subprocess.run(["omamobile-keys", "double-tap"], check=False) + + +def lock_dark_unlocked(): + """The screen just went dark: omamobile-keys locks it if it is unlocked + (a dark phone is a locked one, as on Android).""" + subprocess.run(["omamobile-keys", "dark-unlocked"], check=False) + + +def has_dsi(sysfs="/sys"): + """Whether screen_dark() can tell: a phone with no DSI connector reads as + dark for the proximity claim, but must not be locked for it.""" + return bool(glob.glob(sysfs + "/class/drm/*-DSI-*/dpms")) + + +# How often the screen's state is looked at for the dark-and-unlocked lock: +# a sysfs read; at 1 s the lock came 0.7 s after the screen went dark, a +# window in which a touch still reached the app. +DARK_POLL = 0.25 + + +def watch(fd, prox): + try: + taps = DoubleTap(DIST_MAX * x_range(fd)) + last_touch = 0.0 + can_tell = has_dsi() + was_dark = screen_dark() if can_tell else False + while True: + # The screen went dark: lock it if unlocked, before a touch on it + # can reach the app underneath. + if can_tell: + dark = screen_dark() + if dark and not was_dark: + lock_dark_unlocked() + was_dark = dark + # Nothing to read for a moment: the proximity claim ends after + # RELEASE_AFTER of no touches, and the screen is looked at again. + if not select.select([fd], [], [], DARK_POLL)[0]: + if prox.claimed_at is not None and time.monotonic() - last_touch >= RELEASE_AFTER: + prox.release() + continue + data = os.read(fd, EVENT.size * 64) + if not data: + return + for i in range(0, len(data) - EVENT.size + 1, EVENT.size): + sec, usec, type_, code, value = EVENT.unpack_from(data, i) + if type_ == EV_KEY and code == BTN_TOUCH and value == 1: + last_touch = time.monotonic() + if prox.claimed_at is None and screen_dark(): + prox.claim() + if taps.feed(sec + usec / 1e6, type_, code, value): + if prox.near(): + print("omamobile-doubletap: proximity near, double tap ignored", flush=True) + else: + wake() + finally: + prox.release() + os.close(fd) + + +def main(): + said = "" + prox = Proximity() + + def say(text): + # Once per change, not every WAIT seconds into the journal. + nonlocal said + if text != said: + print("omamobile-doubletap: " + text, flush=True) + said = text + + while True: + path = find_touchscreen() + if not path: + say("no touchscreen yet") + time.sleep(WAIT) + continue + try: + fd = os.open(path, os.O_RDONLY) + except OSError as e: + # Not readable (the user isn't in the input group) or just gone. + say("%s: %s" % (path, e)) + time.sleep(WAIT) + continue + say("watching " + path) + try: + watch(fd, prox) + except OSError as e: + # Gone (the driver reloaded): look again. + say("%s: %s" % (path, e)) + time.sleep(WAIT) + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + sys.exit(0) diff --git a/packages/omamobile-shell/bin/omamobile-keys b/packages/omamobile-shell/bin/omamobile-keys index c3becc29c..861436235 100644 --- a/packages/omamobile-shell/bin/omamobile-keys +++ b/packages/omamobile-shell/bin/omamobile-keys @@ -16,6 +16,12 @@ # power + volume down together: screenshot (Omarchy's, full screen) # wake omamobile-sleepd, after Power woke the phone from # sleep: the PIN pad, as the lost press would have +# double-tap omamobile-doubletap, after a double tap on the +# touchscreen: a dark screen wakes as a short press +# wakes it (locked or not); a lit one is left alone +# dark-unlocked omamobile-doubletap, when the screen has gone dark +# while unlocked: it locks, so a dark phone is a +# locked one, as on Android # volume down alone lowers the volume after a 0.15 s wait for power # volume up raises the volume # power + volume up held together, when turned on in the voice settings @@ -98,6 +104,19 @@ wake_locked() { [[ $(brightnessctl -d "$device" get 2>/dev/null || echo 1) -gt 0 ]] || brightnessctl -q -d "$device" set 40% } +# Light an unlocked but dark display (the lock didn't engage, or the panel +# was powered off by hand). A saved brightness of 0 would wake to a black +# panel. +wake_unlocked() { + omarchy-brightness-display on + local device + device=$(omarchy-hw-display 2>/dev/null) + sleep 0.3 + if [[ -n $device ]]; then + [[ $(brightnessctl -d "$device" get 2>/dev/null || echo 1) -gt 0 ]] || brightnessctl -q -d "$device" set 40% + fi +} + # The panel is off when its backlight's bl_power says so (4), or when Hyprland # has the display powered off: on tegu a DPMS-off panel keeps bl_power at 0, # and judging by bl_power alone made every Power press lock a dark phone @@ -180,14 +199,7 @@ short_press() { elif screen_off; then # Unlocked but dark (the lock didn't engage, or the panel was powered # off by hand): a press wakes it instead of locking into the dark again. - omarchy-brightness-display on - local device - device=$(omarchy-hw-display 2>/dev/null) - # A saved brightness of 0 would wake to a black panel. - sleep 0.3 - if [[ -n $device ]]; then - [[ $(brightnessctl -d "$device" get 2>/dev/null || echo 1) -gt 0 ]] || brightnessctl -q -d "$device" set 40% - fi + wake_unlocked else # Dark at once, as on Android, but only by the backlight: Omarchy's lock # waits for a working screen ("screen-stabilizing"), so powering the panel @@ -309,8 +321,27 @@ case "${1:-}" in now >"$state/power-wake" if locked && screen_off; then wake_locked; fi ;; + double-tap) + # omamobile-doubletap: a double tap on the touchscreen. Only a dark + # screen wakes; the lock ignores touches while dark (patches/omarchy/0029), + # so this is the double tap's only wake, and it lights the panel too. + screen_off || exit 0 + if locked; then wake_locked; else wake_unlocked; fi + ;; + dark-unlocked) + # omamobile-doubletap: the screen went dark while unlocked (an idle + # blank, or the panel powered off by hand). Hyprland sends a touch to the + # window under it whatever the screen's state, so a tap on a dark + # unlocked phone reached an app no one could see. As on Android, a dark + # phone is a locked one: lock now, behind the dark panel, and the lock's + # surface takes those touches (derekross/omarchy-mobile#420's review). + locked && exit 0 + screen_off || exit 0 + omarchy-system-lock + lock_dark + ;; *) - echo "Usage: omamobile-keys power-down|power-up|volume-down|volume-up|volume-up-release|wake" >&2 + echo "Usage: omamobile-keys power-down|power-up|volume-down|volume-up|volume-up-release|wake|double-tap|dark-unlocked" >&2 exit 1 ;; esac diff --git a/packages/omamobile-shell/hypr/phone.lua b/packages/omamobile-shell/hypr/phone.lua index bca9c9d78..e055deb25 100644 --- a/packages/omamobile-shell/hypr/phone.lua +++ b/packages/omamobile-shell/hypr/phone.lua @@ -125,8 +125,12 @@ o.launch_on_start("gsettings set org.gnome.desktop.a11y.applications screen-keyb -- Hardware keys don't wake the screen, as on Android: power wakes it through -- omamobile-keys, which decides from the screen's state when it is released. -- With Omarchy's key_press_enables_dpms, the press itself lit the screen and --- the release then turned it off again. Touch still wakes it. +-- the release then turned it off again. hl.config({ misc = { key_press_enables_dpms = false } }) +-- Nor does a single touch: a double tap wakes it, as on Android +-- (omamobile-doubletap; the lock ignores touches while dark, patches/omarchy/0029), +-- so a touch in a pocket or a brush of the palm leaves it dark. +hl.config({ misc = { mouse_move_enables_dpms = false } }) -- Hyprland 0.57 turned quirks:skip_non_kms_dmabuf_formats on by default: it -- offers clients only the formats a display plane can scan out. gs201's DECON diff --git a/packages/omamobile-shell/install b/packages/omamobile-shell/install index 6cce68309..f886a7c8d 100755 --- a/packages/omamobile-shell/install +++ b/packages/omamobile-shell/install @@ -53,6 +53,10 @@ ln -sfn ../omamobile-osk-guard.service "$destination/usr/lib/systemd/user/graphi # until the user turns the omamobile-sleep toggle on. install -Dm644 systemd/user/omamobile-sleepd.service "$destination/usr/lib/systemd/user/omamobile-sleepd.service" ln -sfn ../omamobile-sleepd.service "$destination/usr/lib/systemd/user/graphical-session.target.wants/omamobile-sleepd.service" +# Double tap to wake (hypr/phone.lua turns Hyprland's wake on touch off), for +# every user's graphical session. +install -Dm644 systemd/user/omamobile-doubletap.service "$destination/usr/lib/systemd/user/omamobile-doubletap.service" +ln -sfn ../omamobile-doubletap.service "$destination/usr/lib/systemd/user/graphical-session.target.wants/omamobile-doubletap.service" # The lock screen's weather, at login and every 30 minutes, for every user's # graphical session; it fetches nothing until a place is set. install -Dm644 systemd/user/omamobile-weather.service "$destination/usr/lib/systemd/user/omamobile-weather.service" diff --git a/packages/omamobile-shell/systemd/user/omamobile-doubletap.service b/packages/omamobile-shell/systemd/user/omamobile-doubletap.service new file mode 100644 index 000000000..40b7e6a1d --- /dev/null +++ b/packages/omamobile-shell/systemd/user/omamobile-doubletap.service @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: MIT +# Double tap to wake (bin/omamobile-doubletap): a double tap on the +# touchscreen of a dark phone wakes it, for every user's graphical session. +[Unit] +Description=Omarchy Mobile double tap to wake +PartOf=graphical-session.target +After=graphical-session.target + +[Service] +ExecStart=/usr/bin/omamobile-doubletap +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=graphical-session.target diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 22301d507..9e19f2609 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -1047,6 +1047,9 @@ PY pass "Mobile network page" bash -n bin/omamobile-sleepd || fail "omamobile-sleepd parses" bash test/sleepd.sh || fail "omamobile-sleepd" +python3 -B -c 'import ast,sys; ast.parse(open(sys.argv[1]).read())' bin/omamobile-doubletap || fail "omamobile-doubletap parses" +python3 -B test/doubletap.py >/dev/null || { python3 -B test/doubletap.py | grep -v '^ok'; fail "omamobile-doubletap"; } +pass "omamobile-doubletap: double taps and the touchscreen by its capabilities" python3 -B -c 'import ast,sys; ast.parse(open(sys.argv[1]).read())' bin/omamobile-weather || fail "omamobile-weather parses" python3 -B test/weather.py 2>/dev/null || fail "omamobile-weather" tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT @@ -1090,6 +1093,13 @@ grep -cx 'ExecStart=/usr/bin/omamobile-setup-user' systemd/user/omamobile-setup- $(readlink "$u/graphical-session.target.wants/omamobile-sleepd.service") == ../omamobile-sleepd.service ]] \ || fail "the sleep watcher is staged and runs for every user's session" grep -cx 'ExecStart=/usr/bin/omamobile-sleepd' systemd/user/omamobile-sleepd.service >/dev/null || fail "the unit runs the watcher" +# Double tap to wake: phone.lua turns Hyprland's wake on touch off, so the +# watcher must run for every session, or a single touch and a double tap +# both leave an unlocked phone dark. +[[ -x $tmp/root/usr/bin/omamobile-doubletap && -f $u/omamobile-doubletap.service && + $(readlink "$u/graphical-session.target.wants/omamobile-doubletap.service") == ../omamobile-doubletap.service ]] \ + || fail "the double-tap watcher is staged and runs for every user's session" +grep -cx 'ExecStart=/usr/bin/omamobile-doubletap' systemd/user/omamobile-doubletap.service >/dev/null || fail "the unit runs the double-tap watcher" # The lock screen's weather: a timer for every session, a one-shot service. [[ -x $tmp/root/usr/bin/omamobile-weather && -f $u/omamobile-weather.service && -f $u/omamobile-weather.timer && $(readlink "$u/graphical-session.target.wants/omamobile-weather.timer") == ../omamobile-weather.timer ]] \ diff --git a/packages/omamobile-shell/test/doubletap.py b/packages/omamobile-shell/test/doubletap.py new file mode 100644 index 000000000..501214460 --- /dev/null +++ b/packages/omamobile-shell/test/doubletap.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Tests for bin/omamobile-doubletap: the double-tap detector against +synthetic event streams, and the touchscreen found by its capabilities in a +fake /sys (a direct multi-touch device, whatever its name).""" + +import importlib.machinery +import importlib.util +import os +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +TOOL = os.path.join(HERE, "..", "bin", "omamobile-doubletap") +failures = 0 + + +def check(name, condition, detail=""): + global failures + print("%s - doubletap: %s%s" % ("ok" if condition else "not ok", name, "" if condition else " # " + str(detail))) + if not condition: + failures += 1 + + +loader = importlib.machinery.SourceFileLoader("doubletap", TOOL) +spec = importlib.util.spec_from_loader("doubletap", loader) +dt = importlib.util.module_from_spec(spec) +loader.exec_module(dt) + + +def tap(t, x, y, length=0.08): + """A tap's events as a touchscreen with pointer emulation sends them.""" + return [(t, dt.EV_ABS, dt.ABS_MT_POSITION_X, x), (t, dt.EV_ABS, dt.ABS_MT_POSITION_Y, y), + (t, dt.EV_KEY, dt.BTN_TOUCH, 1), (t + length, dt.EV_KEY, dt.BTN_TOUCH, 0)] + + +def wakes(*taps): + d = dt.DoubleTap(150) + events = [e for group in taps for e in group] + return sum(1 for e in events if d.feed(*e)) + + +check("two quick taps in one place wake", wakes(tap(10.0, 500, 1000), tap(10.25, 520, 1010)) == 1) +check("a single tap doesn't", wakes(tap(10.0, 500, 1000)) == 0) +check("taps further apart than 400 ms don't", wakes(tap(10.0, 500, 1000), tap(10.6, 500, 1000)) == 0) +check("taps far apart on the screen don't", wakes(tap(10.0, 100, 1000), tap(10.2, 700, 1000)) == 0) +check("a long press then a tap doesn't", wakes(tap(10.0, 500, 1000, length=0.6), tap(10.7, 500, 1000)) == 0) +check("a tap then a long press doesn't", wakes(tap(10.0, 500, 1000), tap(10.2, 500, 1000, length=0.6)) == 0) +check("three quick taps wake once", wakes(tap(10.0, 500, 1000), tap(10.2, 500, 1000), tap(10.4, 500, 1000)) == 1) +check("four quick taps wake twice", wakes(*(tap(10.0 + 0.2 * i, 500, 1000) for i in range(4))) == 2) +check("a swipe doesn't count as a tap", wakes(tap(10.0, 500, 1000, length=0.5), tap(10.6, 500, 1000)) == 0) + +check("bitmask reads sysfs words, most significant first", + dt.bitmask("1 0") == 1 << dt.LONG_BITS and dt.has(dt.bitmask("400 0 0 0 0"), 10 + 4 * dt.LONG_BITS)) + + +def device(root, n, name, props, keys, abs_): + d = os.path.join(root, "class/input/event%d/device" % n) + os.makedirs(d + "/capabilities") + for f, v in (("name", name), ("properties", props), ("capabilities/key", keys), ("capabilities/abs", abs_)): + with open(os.path.join(d, f), "w") as fh: + fh.write(v + "\n") + + +def keys_with(*bits): + v = 0 + for b in bits: + v |= 1 << b + words = [] + while v: + words.append("%x" % (v & ((1 << dt.LONG_BITS) - 1))) + v >>= dt.LONG_BITS + return " ".join(reversed(words)) or "0" + + +with tempfile.TemporaryDirectory() as root: + check("no input devices: none", dt.find_touchscreen(root) is None) + mt = keys_with(dt.ABS_MT_POSITION_X, dt.ABS_MT_POSITION_Y) + # The power key, a touchpad (multi-touch but not direct), then the + # touchscreen at event10 (sorted by number, not as text). + device(root, 0, "gpio-keys", "0", keys_with(116), "0") + device(root, 2, "touchpad", "1", keys_with(dt.BTN_TOUCH), mt) + device(root, 10, "any_touch_driver", "2", keys_with(dt.BTN_TOUCH), mt) + device(root, 11, "second_screen", "2", keys_with(dt.BTN_TOUCH), mt) + check("the first direct multi-touch device, by number, whatever its name", + dt.find_touchscreen(root) == "/dev/input/event10", dt.find_touchscreen(root)) + +with tempfile.TemporaryDirectory() as root: + device(root, 3, "pen", "2", keys_with(dt.BTN_TOUCH), keys_with(0, 1)) + check("a direct device without multi-touch isn't taken", dt.find_touchscreen(root) is None) + + +class FakeProximity(dt.Proximity): + """The sensor proxy's answers, without a bus: has, near, or raises.""" + + def __init__(self, has=True, near=False, absent=False): + super().__init__() + self.has, self.is_near, self.absent, self.calls = has, near, absent, [] + + def _call(self, iface, method, args=None): + self.calls.append(method) + if self.absent: + raise OSError("no net.hadess.SensorProxy") + return (None,) + + def _get(self, prop): + if self.absent: + raise OSError("no net.hadess.SensorProxy") + return {"HasProximity": self.has, "ProximityNear": self.is_near}[prop] + + +dt.FRESH = 0 # no wait for the first reading in the tests +p = FakeProximity(near=True) +p.claim() +check("near with a sensor that reads near", p.near() is True) +p.claim() +check("one claim however many touches", p.calls == ["ClaimProximity"], p.calls) +p.release() +check("release ends the claim", p.calls[-1] == "ReleaseProximity" and p.claimed_at is None, p.calls) +p = FakeProximity(near=False) +p.claim() +check("far with a sensor that reads far", p.near() is False) +p = FakeProximity(has=False, near=True) +p.claim() +check("no sensor (HasProximity false): no claim, reads far", p.calls == [] and p.near() is False, p.calls) +p = FakeProximity(absent=True) +p.claim() +check("no sensor proxy: reads far", p.claimed_at is None and p.near() is False) +p.release() + +with tempfile.TemporaryDirectory() as root: + check("no DSI connector: counts as dark", dt.screen_dark(root) is True) + os.makedirs(root + "/class/drm/card0-DSI-1") + with open(root + "/class/drm/card0-DSI-1/dpms", "w") as fh: + fh.write("On\n") + check("a lit DSI panel isn't dark", dt.screen_dark(root) is False) + with open(root + "/class/drm/card0-DSI-1/dpms", "w") as fh: + fh.write("Off\n") + check("a DSI panel with DPMS off is dark", dt.screen_dark(root) is True) + +# The dark-and-unlocked lock only where the screen's state can be told: with +# a DSI connector, not on a machine without one (screen_dark() reads it as +# dark there, for the proximity claim alone). +with tempfile.TemporaryDirectory() as sysfs: + check("no DSI connector: the dark lock is off", not dt.has_dsi(sysfs)) + os.makedirs(sysfs + "/class/drm/card0-DSI-1") + open(sysfs + "/class/drm/card0-DSI-1/dpms", "w").write("On\n") + check("a DSI connector: the dark lock is on", dt.has_dsi(sysfs)) + check("its DPMS On reads lit", not dt.screen_dark(sysfs)) + open(sysfs + "/class/drm/card0-DSI-1/dpms", "w").write("Off\n") + check("its DPMS Off reads dark", dt.screen_dark(sysfs)) + +sys.exit(1 if failures else 0) diff --git a/packages/omamobile-shell/test/keys.sh b/packages/omamobile-shell/test/keys.sh index 3cf1a2cd0..c13f42c54 100755 --- a/packages/omamobile-shell/test/keys.sh +++ b/packages/omamobile-shell/test/keys.sh @@ -109,6 +109,41 @@ echo false >"$t/locked" press; grep -q "omarchy-system-lock" "$log" || fail "an unanswered screen state reads as lit: the press locks" echo "ok - power key: lock, screen off, and wake by lock and screen state" +# A double tap on the touchscreen (omamobile-doubletap): a dark screen wakes +# as a short press wakes it, locked or not; a lit one is left alone. +cat >"$t/bin/hyprctl" <"$t/locked"; echo false >"$t/dpms" +tap2; grep -q "omarchy-shell lock wake" "$log" && grep -q "omarchy-brightness-display on" "$log" \ + || fail "double tap, locked and dark: wakes the lock screen and lights it" +echo false >"$t/locked"; echo false >"$t/dpms" +tap2; grep -q "omarchy-brightness-display on" "$log" || fail "double tap, unlocked and dark: lights the screen" +grep -q "omarchy-shell lock wake" "$log" && fail "double tap, unlocked and dark: no lock wake" +for locked in true false; do + echo $locked >"$t/locked"; echo true >"$t/dpms" + tap2; [[ ! -s $log ]] || fail "double tap on a lit screen (locked $locked) does nothing" +done +grep -qE "omarchy-system-lock|lock dark|omamobile-sleepd" "$log" && fail "a double tap never locks or sleeps" +[[ ! -e $t/run/omamobile-keys/power-wake ]] || fail "a double tap doesn't swallow the next power press" +echo "ok - double tap: wakes a dark screen, locked or not, and leaves a lit one alone" + +# The screen gone dark while unlocked (omamobile-doubletap tells): it locks, +# and the new lock hears it is dark, so a touch on the dark screen reaches +# the lock, never the app under it. Lit, or already locked: nothing. +darku() { reset; keys dark-unlocked; } +echo false >"$t/locked"; echo false >"$t/dpms" +darku; before "omarchy-system-lock" "omarchy-shell lock dark" || fail "dark and unlocked: locks, then the lock hears it is dark" +grep -qE "brightness-display|omamobile-sleepd" "$log" && fail "dark and unlocked: the panel is left as it is" +echo false >"$t/locked"; echo true >"$t/dpms" +darku; [[ ! -s $log ]] || fail "lit and unlocked: dark-unlocked does nothing" +echo true >"$t/locked"; echo false >"$t/dpms" +darku; [[ ! -s $log ]] || fail "dark and locked: dark-unlocked does nothing" +echo "ok - a screen gone dark while unlocked locks, as on Android" + # A lock slower than the long-press timer (it takes about a second on the # phone) must not turn the short press into a long one that wakes the lock. cat >"$t/bin/hyprctl" < Date: Mon, 9 Nov 2026 12:37:40 -0300 Subject: [PATCH 25/66] omamobile-waydroid 0.1.1: allow Android's character devices, keep block devices denied (#493) LXC 7's cgroup2 filter starts in "block everything" mode and leaves deny rules out of the program, so a conf with only `deny = b *:*` allowed nothing and lxc-start died on /dev/null. lxc-omamobile.conf now allows the standard nodes, tty/pts, fuse, tun, the render node and binderfs's major; no `b` allow exists, and the deny covers an `allow = a` before the include. omamobile-waydroid-check compares the binder major in /proc/devices with the conf before every start. /dev/uhid is deliberately not allowed (host input). W4 exports PATH for lxc-attach and takes mknod's EPERM as the pass condition. Tested on a Pixel 7 Pro on 7.3.0-rc6-omamobile-push1-g4cdfc1aa4b6b. Fixes #465. --- device/cheetah/WAYDROID-PLAN.md | 31 ++++++++++--- .../omamobile-waydroid/lib/lxc-omamobile.conf | 44 ++++++++++++++++++- .../lib/omamobile-waydroid-check | 13 ++++++ packages/omamobile-waydroid/test/all | 25 +++++++++++ packages/omamobile-waydroid/version | 2 +- 5 files changed, 105 insertions(+), 10 deletions(-) diff --git a/device/cheetah/WAYDROID-PLAN.md b/device/cheetah/WAYDROID-PLAN.md index c6cb16d4b..0fb053168 100644 --- a/device/cheetah/WAYDROID-PLAN.md +++ b/device/cheetah/WAYDROID-PLAN.md @@ -178,8 +178,20 @@ Waydroid 1.6.3 does three things that are wrong on this phone: - `config` (`ExecStartPre` of `waydroid-container.service`, through our drop-in) drops any such lines from the generated `config_nodes` and appends `lxc.include = /usr/share/omamobile-waydroid/lxc-omamobile.conf`, - whose one rule is `lxc.cgroup2.devices.deny = b *:* rwm`: no block - device at all, whoever makes the node. + which allows the character devices Android uses (`c 1:3` for `/dev/null`, + the standard nodes, binderfs's major) and denies every block device with + `lxc.cgroup2.devices.deny = b *:* rwm`, whoever makes the node. With LXC 7 + the filter starts in "block everything" mode and leaves deny rules out of + the device program, so a list with only the deny rule allows nothing and + `lxc-start` dies with `Can't open /dev/null`. Block devices are refused + because no rule allows a `b` device, and the order of the lines does not + matter. The deny line covers one case: an `lxc.cgroup2.devices.allow = a` + placed before our include (a hand-edit) switches LXC to "allow everything", + and the `b *:*` deny keeps block devices out. An `allow = a` placed after + the include would clear every rule before it and open everything, so + `test/all` fails if the file has one. The binder major is assigned at boot + (507 on cheetah); `omamobile-waydroid-check` compares it with the line in + the file before every start. - `verify` (`ExecStartPre` too) refuses to start the container unless all of it is in place. `waydroid upgrade` regenerates the config, so this runs before every start. @@ -263,7 +275,7 @@ Android, or Android posts "Configure physical keyboard". | `lib/omamobile-waydroid-check` | `/usr/lib/omamobile-waydroid` | Read-only: kernel options (`/proc/config.gz` or `CONFIG_FILE=`), binderfs, PSI, the Panthor render node, cgroup2 | | `lib/omamobile-waydroid-harden` | same | Section 5 | | `lib/omamobile-waydroid-mesa` | same | Section 3 | -| `lib/lxc-omamobile.conf` | `/usr/share/omamobile-waydroid` | The block-device deny rule | +| `lib/lxc-omamobile.conf` | `/usr/share/omamobile-waydroid` | The device rules: allow list, then the block-device deny | | `systemd/waydroid-container-omamobile.conf` | `waydroid-container.service.d/omamobile.conf` | `ExecStartPre`: check, harden config, harden verify | | `libalpm/90-omamobile-waydroid.hook` | `/usr/share/libalpm/hooks` | `harden patch` after `waydroid` installs or upgrades | | `etc/omamobile/waydroid.conf` | `/etc/omamobile` (backup) | `SYSTEM_TYPE`, `LCD_DENSITY`, `MULTI_WINDOWS` | @@ -355,17 +367,22 @@ Stream the kernel log first: `tools/phone-ssh 'dmesg -w' | tee logs/waydroid-w4. tools/phone-ssh 'systemctl start waydroid-container; sleep 5; systemctl --no-pager status waydroid-container | head -5; \ ls -l /dev/binderfs; waydroid status' # Block devices must be unreachable from inside (loop0 is harmless to read): +# lxc-attach gives Android's shell no PATH: without the export every command +# is "inaccessible or not found" (rc=127), which looks like a refusal. tools/phone-ssh 'lxc-attach -P /var/lib/waydroid/lxc -n waydroid -- /system/bin/sh -c \ - "mknod /dev/omtest b 7 0; head -c 1 /dev/omtest > /dev/null; echo rc=\$?; rm -f /dev/omtest"' -tools/phone-ssh 'lxc-attach -P /var/lib/waydroid/lxc -n waydroid -- /system/bin/ls /sys/kernel/debug /dev | head' + "export PATH=/system/bin:\$PATH; toybox mknod /dev/omtest b 7 0; echo mknod_rc=\$?; toybox head -c 1 /dev/omtest > /dev/null; echo head_rc=\$?; toybox rm -f /dev/omtest"' +tools/phone-ssh 'lxc-attach -P /var/lib/waydroid/lxc -n waydroid -- /system/bin/sh -c \ + "export PATH=/system/bin:\$PATH; toybox ls /sys/kernel/debug /dev | toybox head"' ``` The `lxc-attach` lines need a running container; if the container only starts with a session, run them after W5's session start instead. - **Expect:** the service is active (its three `ExecStartPre` lines passed); - `binder`, `vndbinder`, `hwbinder` in `/dev/binderfs`; the `head` read - fails with "Operation not permitted"; `/sys/kernel/debug` empty or + `binder`, `vndbinder`, `hwbinder` in `/dev/binderfs`; `toybox mknod` + prints `mknod: /dev/omtest: Operation not permitted` (that line is the pass + condition, not a nonzero rc: a missing command also gives one); + `/sys/kernel/debug` empty or missing inside; no `video*` or `fb*` in the container's `/dev`. - **Stop:** the block read succeeds (stop the container at once and fix the device rule before anything else); any oops; any diff --git a/packages/omamobile-waydroid/lib/lxc-omamobile.conf b/packages/omamobile-waydroid/lib/lxc-omamobile.conf index c2d32bd24..4a5ae0513 100644 --- a/packages/omamobile-waydroid/lib/lxc-omamobile.conf +++ b/packages/omamobile-waydroid/lib/lxc-omamobile.conf @@ -5,6 +5,46 @@ # Waydroid's container is privileged and keeps CAP_MKNOD and CAP_SYS_ADMIN. # Nothing Android needs here is a block device, so deny all of them: Android # must never be able to make a node for the UFS (/dev/sda...), clear the -# storage guard's read-only flag or write a partition. Character devices -# stay as Waydroid binds them (binder, the render node, fuse, tun...). +# storage guard's read-only flag or write a partition. +# +# How LXC 7's cgroup2 device filter treats this file: it starts in "block +# everything" mode, and in that mode deny rules are left out of the device +# program. So with only a deny rule nothing is allowed, not even /dev/null, +# and lxc-start dies with "Can't open /dev/null: Operation not permitted". +# The allow lines below are the character devices Android uses. Block devices +# are refused because no rule allows a "b" device; the order of the allow and +# deny lines does not matter. The deny line still matters in one case: an +# "lxc.cgroup2.devices.allow = a" placed before this include switches LXC to +# "allow everything" mode, and the deny is what keeps block devices out then. +# A global "allow = a" placed after this include would clear every rule above +# it and open all devices: never add one (test/all fails if this file has one). +# +# The allow lines are the standard nodes and the ones Waydroid binds (its +# generated config_nodes); each is checked on a Pixel 7 Pro: the container +# starts, Android boots, GLES is Mesa/Panfrost and the network works. Of these +# only binder was shown to be needed (without it Android's init reboots the +# container); the others are the nodes Waydroid binds or Android opens. +# +# /dev/uhid (c 10:239) is deliberately left out, although Waydroid binds it +# for adb. It creates real HID devices on the host, which Hyprland picks up +# like any keyboard or mouse, so root inside the container could type into the +# phone's own session. Android boots without it and nothing in logcat or dmesg +# asks for it. If an Android feature turns out to need it, add it back with +# that feature as the reason. +lxc.cgroup2.devices.allow = c 1:3 rwm +lxc.cgroup2.devices.allow = c 1:5 rwm +lxc.cgroup2.devices.allow = c 1:7 rwm +lxc.cgroup2.devices.allow = c 1:8 rwm +lxc.cgroup2.devices.allow = c 1:9 rwm +lxc.cgroup2.devices.allow = c 1:11 rwm +lxc.cgroup2.devices.allow = c 5:* rwm +lxc.cgroup2.devices.allow = c 136:* rwm +lxc.cgroup2.devices.allow = c 10:200 rwm +lxc.cgroup2.devices.allow = c 10:229 rwm +lxc.cgroup2.devices.allow = c 226:128 rwm +# binderfs (binder, vndbinder, hwbinder). Its major is assigned when the +# kernel boots, not fixed: 507 on the cheetah kernel. omamobile-waydroid-check +# compares this line with the "binder" line of /proc/devices before every +# container start and refuses to start when they differ. +lxc.cgroup2.devices.allow = c 507:* rwm lxc.cgroup2.devices.deny = b *:* rwm diff --git a/packages/omamobile-waydroid/lib/omamobile-waydroid-check b/packages/omamobile-waydroid/lib/omamobile-waydroid-check index 5c6a61622..574e74eaf 100755 --- a/packages/omamobile-waydroid/lib/omamobile-waydroid-check +++ b/packages/omamobile-waydroid/lib/omamobile-waydroid-check @@ -77,4 +77,17 @@ if [[ -z ${CONFIG_FILE:-} ]]; then fi fi +# The binder major is assigned at boot and lxc-omamobile.conf allows one: +# compare them. Runs on the live kernel, or against a test DEVICES_FILE and +# LXC_CONF (test/all) so the comparison itself is tested. +if [[ -z ${CONFIG_FILE:-} || -n ${DEVICES_FILE:-} ]]; then + binder_major=$(awk '$2 == "binder" { print $1 }' "${DEVICES_FILE:-/proc/devices}") + lxc_conf=${LXC_CONF:-/usr/share/omamobile-waydroid/lxc-omamobile.conf} + if [[ -n $binder_major ]] && grep -qx "lxc.cgroup2.devices.allow = c $binder_major:\* rwm" "$lxc_conf" 2>/dev/null; then + echo "ok binder major $binder_major is allowed in lxc-omamobile.conf" + else + echo "MISS binder major ${binder_major:-unset} is not allowed in $lxc_conf (Android would not boot)"; missing=1 + fi +fi + exit "$missing" diff --git a/packages/omamobile-waydroid/test/all b/packages/omamobile-waydroid/test/all index d2dd81902..19bb88168 100755 --- a/packages/omamobile-waydroid/test/all +++ b/packages/omamobile-waydroid/test/all @@ -28,6 +28,14 @@ for f in usr/bin/omamobile-waydroid usr/lib/omamobile-waydroid/omamobile-waydroi done grep -q 'lxc-omamobile.conf' lib/omamobile-waydroid-harden || fail "harden does not include lxc-omamobile.conf" grep -qx 'lxc.cgroup2.devices.deny = b \*:\* rwm' lib/lxc-omamobile.conf || fail "block devices not denied" +# LXC 7 allows nothing when there is only a deny rule, so the file carries an +# allow list. Block devices stay out because no rule allows a "b" device; the +# deny line covers an "allow = a" placed before the include. What must never +# appear is a global allow: after the include it would clear every rule above. +grep -q '^lxc.cgroup2.devices.allow = c ' lib/lxc-omamobile.conf || fail "lxc-omamobile.conf: no allow lines (LXC 7 would allow nothing)" +grep -qx 'lxc.cgroup2.devices.allow = c 1:3 rwm' lib/lxc-omamobile.conf || fail "/dev/null not allowed" +if grep -Eq '^[[:space:]]*lxc.cgroup2.devices.allow[[:space:]]*=[[:space:]]*(a|c \*:\*)' lib/lxc-omamobile.conf; then fail "lxc-omamobile.conf opens every device"; fi +if grep -Eq '^[[:space:]]*lxc.cgroup2.devices.allow[[:space:]]*=[[:space:]]*b' lib/lxc-omamobile.conf; then fail "lxc-omamobile.conf allows block devices"; fi # Kernel check: every option it wants, then one missing sed -n 's/^ *want \([A-Z0-9_]*\) \([ym]*\) .*/CONFIG_\1=\2/p' lib/omamobile-waydroid-check | sed 's/=ym$/=m/' > "$t/config" @@ -41,6 +49,23 @@ for o in NETFILTER_XT_MARK NETFILTER_XT_CONNMARK NETFILTER_XT_MATCH_OWNER NETFIL echo "CONFIG_$o=m" >> "$t/config" done CONFIG_FILE=$t/config lib/omamobile-waydroid-check > "$t/ok.log" || { cat "$t/ok.log"; fail "check rejects a complete config"; } +# The binder major comes from /proc/devices at boot and the check compares it +# with the allow line: run that comparison against a test devices file. The +# conf's other "c N:*" lines (5, 136) must not be able to satisfy it. +printf 'Character devices:\n 1 mem\n 5 /dev/tty\n136 pts\n507 binder\n\nBlock devices:\n 8 sd\n' > "$t/devices" +CONFIG_FILE=$t/config DEVICES_FILE=$t/devices LXC_CONF=lib/lxc-omamobile.conf lib/omamobile-waydroid-check > "$t/binder.log" \ + || { cat "$t/binder.log"; fail "check rejects the shipped binder allow line"; } +grep -q '^ok binder major 507 is allowed' "$t/binder.log" || fail "check does not report the binder major" +grep -v '^lxc.cgroup2.devices.allow = c 507:' lib/lxc-omamobile.conf > "$t/no-binder.conf" +if CONFIG_FILE=$t/config DEVICES_FILE=$t/devices LXC_CONF=$t/no-binder.conf lib/omamobile-waydroid-check > "$t/binder.log"; then + fail "check passes with the binder line deleted" +fi +grep -q '^MISS binder major 507 is not allowed' "$t/binder.log" || fail "check does not name the missing binder major" +sed 's/^507 binder/508 binder/' "$t/devices" > "$t/devices-moved" +if CONFIG_FILE=$t/config DEVICES_FILE=$t/devices-moved LXC_CONF=lib/lxc-omamobile.conf lib/omamobile-waydroid-check > "$t/binder.log"; then + fail "check passes when the binder major moved" +fi +grep -q '^MISS binder major 508 is not allowed' "$t/binder.log" || fail "check does not name the moved binder major" grep -v '^CONFIG_NETFILTER_XTABLES_LEGACY=' "$t/config" > "$t/bad" if CONFIG_FILE=$t/bad lib/omamobile-waydroid-check > "$t/bad.log"; then fail "check accepts a config without legacy xtables"; fi grep -q '^MISS NETFILTER_XTABLES_LEGACY=unset' "$t/bad.log" || fail "check does not name the missing option" diff --git a/packages/omamobile-waydroid/version b/packages/omamobile-waydroid/version index 6e8bf73aa..17e51c385 100644 --- a/packages/omamobile-waydroid/version +++ b/packages/omamobile-waydroid/version @@ -1 +1 @@ -0.1.0 +0.1.1 From 1ef208b105c1583461bbc5bb6ddc97615b1fdca8 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 09:37:45 -0600 Subject: [PATCH 26/66] FINGERPRINT-PLAN: F3's laptop mfg_data copy is private from creation (#531) Follow-up to Derek's two optional suggestions on #520. F3's laptop copy of mfg_data was created with the default umask and made private only afterwards by chmod 600, and when the phone's ro=1 check refused (or dd failed) the redirect had already left an empty file behind. The copy is now created under (umask 077; ...) as "$F.part" and renamed to "$F" only when the remote command exits 0; otherwise the .part is removed and the step says so. chmod 600 is dropped: the file is only ever created under umask 077, and mv keeps its mode. The Expect and Stop lines say a refused or failed copy keeps no file. The phone side is unchanged and read-only: PARTNAME lookup, the ro=1 check, dd with no of=. Tested on the laptop with the snippet taken from the plan and a fake phone-ssh running its remote script on a fake sysfs: success leaves one mode-600 file matching the source, and a refused ro=0, an unreadable device, a dd that dies mid-stream and a missing partition each leave no file. The #520 snippet left a 0-byte file on refusal. Docs only; nothing ran on a phone. Co-authored-by: Claude Opus 5.5 --- device/cheetah/FINGERPRINT-PLAN.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/device/cheetah/FINGERPRINT-PLAN.md b/device/cheetah/FINGERPRINT-PLAN.md index 5cfd328fe..99fb84d0d 100644 --- a/device/cheetah/FINGERPRINT-PLAN.md +++ b/device/cheetah/FINGERPRINT-PLAN.md @@ -366,11 +366,15 @@ root has no `/dev/disk/by-partlabel`. F3 passed on 2026-10-13 from an ```sh tools/phone-ssh 'modprobe sg; for d in /sys/class/scsi_generic/sg*; do echo "$d $(basename $(readlink -f $d/device))"; done' # the copies on the phone: F19.3's commands -# the laptop copy of mfg_data (read-only dd, found by PARTNAME) +# the laptop copy of mfg_data (read-only dd, found by PARTNAME): created +# private (umask 077) as $F.part, renamed to $F only if the copy succeeds F=~/android/reference/cheetah-mfg_data-"$(date +%F)".img -tools/phone-ssh 'set -e; M=$(grep -lx "PARTNAME=mfg_data" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) - test "$(cat /sys/class/block/$M/ro)" = 1; dd if=/dev/$M bs=1M status=none' > "$F" -chmod 600 "$F"; sha256sum "$F" | cut -c1-16 +if (umask 077; tools/phone-ssh 'set -e; M=$(grep -lx "PARTNAME=mfg_data" /sys/class/block/*/uevent | head -1 | cut -d/ -f5) + test "$(cat /sys/class/block/$M/ro)" = 1; dd if=/dev/$M bs=1M status=none' > "$F.part") && + mv -T "$F.part" "$F" +then sha256sum "$F" | cut -c1-16 +else rm -f "$F.part"; echo "mfg_data copy refused or failed; no file kept" +fi # the laptop backup of persist and the radio partitions (into a new directory) tools/nv-backup ~/android/reference/cheetah-nv-backup-"$(date +%Y%m%d)" tools/phone-ssh 'modprobe -r sg' @@ -379,11 +383,13 @@ tools/phone-ssh 'modprobe -r sg' Expect one sg node at `0:0:0:49476` (the RPMB well-known LUN), F19.3's output, the laptop copy's hash, then `nv-backup`'s verified copies. `mfg_data` isn't one of `nv-backup`'s partitions, so it gets its own copy. -F19.3 compares the phone's copy with the laptop's 2026-10-13 one; a phone -without that copy compares with this one. Pass: F19.3's Pass, the laptop -copy's hash equal to F19.3's `mfg_data.img` hash, and `nv-backup` exits 0. -**Stop** on F19.3's stops, if the laptop copy is empty or its hash differs, -if `nv-backup` refuses, or if the storage guard complains. Rollback: +A refused or failed copy prints its message and keeps no file (only an +interrupted one leaves a `.part`). F19.3 compares the phone's copy with the +laptop's 2026-10-13 one; a phone without that copy compares with this one. +Pass: F19.3's Pass, the laptop copy's hash equal to F19.3's `mfg_data.img` +hash, and `nv-backup` exits 0. **Stop** on F19.3's stops, if the laptop copy +is refused, fails or is empty, if its hash differs, if `nv-backup` refuses, +or if the storage guard complains. Rollback: `modprobe -r sg`, then remove only what F3 wrote on the phone, never the whole directory (it holds Trusty's TD once storageproxyd has run): `rm -rf /var/lib/omamobile-fp/persist-ss /var/lib/omamobile-fp/mfg_data.img`. From 760ed3d3ac88693303f95028c69f8654d3936ded Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 09:37:49 -0600 Subject: [PATCH 27/66] tools/kernel-pr-check: work the --help range out from the file (#529) --help printed a hard-coded line range of the header comment, so every change to the header had to move the range by hand: #287 and #288 each added a header line and both set it to '3,37p', and with #310 on main the merged ranges became '3,46p' and '3,47p'. Whichever change missed the update cut the header's last line. On #287 the maintainer suggested working the range out from the file instead. --help now prints from line 3 to the first line that isn't a comment, with the awk line tools/nv-backup and tools/phone-provision already use (without their "# " stripping, so the output keeps its current form). On today's header its output is byte for byte what '3,49p' printed. tests/kernel-pr-check gains a check that runs --help on a copy of the tool with one more header line, and compares it with the header up to the line before `set -uo pipefail`. It failed with the old range (the last header line was missing) and passes with this change. Co-authored-by: Claude Opus 5.5 --- tests/kernel-pr-check | 17 ++++++++++++++--- tools/kernel-pr-check | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/kernel-pr-check b/tests/kernel-pr-check index 47457d38c..079588d51 100755 --- a/tests/kernel-pr-check +++ b/tests/kernel-pr-check @@ -3,15 +3,26 @@ # tools/kernel-pr-check's commit checks against a stand-in kernel tree (a # git repository with a fake scripts/checkpatch.pl): sign-offs, prefixes, # checkpatch errors and warnings, and a checker that is missing or doesn't -# run to the end. Its device-tree comparison runs against a second -# stand-in whose make prints the messages each board file asks for; the -# real builds (clang, dtc, dt-validate) need a real tree and are run by hand. +# run to the end, and --help. Its device-tree comparison runs against a +# second stand-in whose make prints the messages each board file asks for; +# the real builds (clang, dtc, dt-validate) need a real tree and are run by hand. set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) t=$(mktemp -d) trap 'rm -rf "$t"' EXIT fail() { echo "not ok - $*" >&2; exit 1; } +# --help prints the whole header comment and no code, from a copy whose +# header has grown by a line: a hard-coded range cut its last line after +# #287, #288 and #310 each edited the header. +h=$t/help/tools/kernel-pr-check +mkdir -p "${h%/*}" +sed '3a\# A line added to the header.' "$here/tools/kernel-pr-check" > "$h" +chmod +x "$h" +diff <("$h" --help) <(sed -n '3,/^set -uo pipefail$/p' "$h" | sed '$d') \ + || fail "--help isn't the header comment, from line 3 to the line before set -uo pipefail" +echo "ok - --help prints the whole header comment, however long it grows, and no code" + k=$t/linux mkdir -p "$k/scripts" "$k/drivers" # checkpatch's stand-in: an ERROR for any added line with "BADSTYLE", a diff --git a/tools/kernel-pr-check b/tools/kernel-pr-check index ae0613c35..47f94a0ac 100755 --- a/tools/kernel-pr-check +++ b/tools/kernel-pr-check @@ -69,7 +69,7 @@ while (($#)); do --merge) merge=1; shift ;; --no-checkpatch) checkpatch=0; shift ;; --strict-trailers) shift ;; # no longer stricter; see above - -h|--help) sed -n '3,49p' "$self"; exit 0 ;; + -h|--help) awk 'NR > 2 && !/^#/ { exit } NR > 2' "$self"; exit 0 ;; -*) echo "kernel-pr-check: unknown option $1" >&2; exit 2 ;; *) break ;; esac From 01f0853e4d0617bffe99960d64418d5b2b1c93af Mon Sep 17 00:00:00 2001 From: "Lefteris @SomniusX" Date: Mon, 9 Nov 2026 17:37:54 +0200 Subject: [PATCH 28/66] device/husky: MODEM-PLAN.md, S1 to S5e with results (#514) * device/husky: MODEM-PLAN.md, S1 to S5e with steps, stop conditions, dated results and uname -r Signed-off-by: Lef * device/husky: MODEM-PLAN.md after derekross's review on #514 Times are now Athens (UTC+2) with the key ones in UTC, and the plan says plainly that S3 to S5e ran after my question on #472 (18:04 UTC) and before any answer, in the status and in Current state. Stock references name Google's s5300 tree and branch, with derekross's line numbers marked as his. The hook description says six AP2CP lines (pda_active is left out on purpose) and the two cpif.ko builds are named by sha256, S5a/S5b without the pda_active file and S5c to S5e with it. The NV check is the first gate and the plan says it ran afterwards. The leftovers on the phone are listed (no modem-test.conf; the test cpif.ko only in the test module trees and /root). The overlays and the S5 scripts that ran are in device/husky/overlays and device/husky/bringup, with two comment lines added to each script. Also: the 92 percent and short-run reason for S5d and S5e, Power + Volume Up for a hung kernel, a sentence on the dead-screen kit, and the Expect, rollback and risk lines for S6. Signed-off-by: Lef --------- Signed-off-by: Lef --- device/husky/MODEM-PLAN.md | 447 ++++++++++++++++++++++ device/husky/bringup/s5b.sh | 18 + device/husky/bringup/s5c-control.sh | 14 + device/husky/bringup/s5c.sh | 37 ++ device/husky/bringup/s5d.sh | 35 ++ device/husky/bringup/s5e.sh | 71 ++++ device/husky/overlays/modem-s1-link.dtso | 21 + device/husky/overlays/modem-s2-lines.dtso | 24 ++ device/husky/overlays/modem-s4-cpif.dtso | 31 ++ 9 files changed, 698 insertions(+) create mode 100644 device/husky/MODEM-PLAN.md create mode 100755 device/husky/bringup/s5b.sh create mode 100755 device/husky/bringup/s5c-control.sh create mode 100755 device/husky/bringup/s5c.sh create mode 100755 device/husky/bringup/s5d.sh create mode 100755 device/husky/bringup/s5e.sh create mode 100644 device/husky/overlays/modem-s1-link.dtso create mode 100644 device/husky/overlays/modem-s2-lines.dtso create mode 100644 device/husky/overlays/modem-s4-cpif.dtso diff --git a/device/husky/MODEM-PLAN.md b/device/husky/MODEM-PLAN.md new file mode 100644 index 000000000..309283d4a --- /dev/null +++ b/device/husky/MODEM-PLAN.md @@ -0,0 +1,447 @@ + +# Pixel 8 Pro modem plan (husky, Samsung S5300) + +Status (2026-11-08): on hold. Stages S1 to S5e have been run; none of them +hung, oopsed or raised a UFS error (S5c stopped on its own current abort, +see below). No modem step and no power-line step has been run since S5e +ended at 2026-11-07 21:21 UTC (23:21 here), and I take none on the 8 Pro +until derekross answers the question on omarchy-mobile#472 +(https://github.com/derekross/omarchy-mobile/pull/472#issuecomment-6711065625; +see "Current state: on hold" below). + +I asked that question on 2026-11-07 at 18:04 UTC and wrote that I would not +run the first hardware step until I heard back. I then ran S3 (19:14:50 UTC) +and after it S4, S5a, S5b, S5c, S5d and S5e, all before any answer. That was +my mistake: I should have waited. S1 and S2 (18:47 and 18:52 UTC) came after +the question too, but they only read: S1 reads the PMU register (the module +probes with `allow_hw=0`) and S2 reads the eleven modem lines as the +bootloader left them, with no direction or level change. + +Times: this file gives Athens time (EET, UTC+2) unless a time is marked UTC. +Subtract 2 h for UTC. +This file is the record of S1 to S5e: what each step does, its gates, its +stop conditions, the dated result with the kernel release, and what the +result does not prove. + +[V] = read in source, stock DT or my captures on the phone. [I] = inferred; +each [I] names the step that would settle it. + +Stock references are Google's tree `kernel/google-modules/radio/samsung/s5300`, +branch `android-gs-shusky-6.1-android16` (the stock CPIF, `modem_ctrl_s5100.c`, +`s5300` node). The line numbers below are the ones derekross checked in that +tree on omarchy-mobile#514; my own copy was the `soc-gs` tree, where the same +functions sit at different lines (`gpio_power_off_cp()` at 874, for example). +The PCIe side is `pcie-gs201-cp` from W4HO's stack in +linux-omarchy-mobile#187. + +## Test kernels + +All steps ran from slot B on a test kernel built from my husky e1 branch +plus the #187 stack and the husky device tree, with the modem nodes +disabled unless the step enables them. + +| Set | `uname -r` | Used for | +| --- | --- | --- | +| images-plain, images-s1, images-s2 | `7.3.0-rc6-omamobile-push1-gc5b6ae8f4dc2` | boot 1 (plain), S1, S2, S3 (images-s1 again) | +| images-s4 | `7.3.0-rc6-omamobile-push1-g6a203e4b8a67` | S4, S5a to S5e | + +Between stages the phone went back to the normal NFC set (release +`...ge98a7`), so a test boot is never the running system for long. +Where a log did not print `uname -r` itself, the table says which image set +was flashed; the lines below say so for each stage. + +## Safety (all stages) + +Gates, all of which must hold before any stage: + +- First of all: `tools/nv-backup --check` matches the 2026-11-01 backup for + `efs`, `efs_backup`, `modem_userdata`, `persist` and `modem_a`/`modem_b` + (read-only; `devinfo` is expected to differ). I did not run this before + S1 to S5e. I ran it afterwards, on 2026-11-08, and every partition matched + (see "Current state"). From now on it is the first gate of every stage. +- I am at the phone with the USB cable in. The charger is in too, except in + S5d and S5e, which are battery-only on purpose: a current reading cannot be + taken with a charger feeding the rail. The battery was at 92 % and each run + lasted a few minutes. On this phone 92 % is "full": the charger chip + finishes at 4350 mV and the gauge stays at 92 %, even after 12 hours plugged + in (`BATTERY-NOTES.md` section 10a, #452). +- Nothing armed or fed a watchdog during S3 to S5. Every step was attended, + with the buttons as the way back. On the 8 Pro a hung kernel needs Power + + Volume Up held for 15 to 30 s; the power button alone is not enough. +- Battery 50 % or more; battery temperature under 40 C at the start; SoC at + or under 62 C (idle SoC is about 53 C). A `THERMAL-PAUSE` file blocks the + step. +- A current backup of the images and the config is on the desktop + (`backup-pre-s3-20261107`, five slot-B images as flashed, `/etc` and user + config, SHA256). +- Retry count read in fastboot: 3 after `set_active b`. Every boot of a + flashed slot B spends a retry (devinfo byte 0x35 went 06 to 04 at the + first flash), and at 0 GrapheneOS wipes userdata, so I count boots and + never run more than two boots of one flash. +- No process holds `/dev/umts_boot0`; no cbd, rfsd or ModemManager runs; no + suspend. +- Each hardware step (S3, S5a, S5b, S5c, S5d, S5e) needs my explicit go in + that turn. + +Never, in any stage: cbd, rfsd, any firmware or ROM image, +`IOCTL_POWER_ON` or the boot ioctls (they write CP DRAM and there is no way +back), writes to `umts_boot0`, `allow_poweroff=1`, the `cp_on`, `cp_off` +and `atu` debugfs files, the SIM, stock slot A (its first boot can wipe +userdata), and the `efs`, `efs_backup`, `modem_userdata`, `persist`, +`modem_a` and `modem_b` partitions (read-only checks only). + +General stop rules: a hang, USB loss, an oops or an rcu stall; any UFS +counter going up or a `ufshcd_err_handler started` line that does not +recover in seconds; a pin or line reading different from what the previous +log said; battery temperature over 45 C. Never reboot with the modem lines +high: `gpio_off` first, reboot only after an all-0 read. A phone that ends +with a dead screen is not woken or rebooted; I run the dead-screen kit +first. The kit is a read-only script for a phone whose screen is off while ssh +still answers (touch and power key dead): it records while I touch and press +power in a 12 s window, and only then do I wake the screen +(`omamobile-remote wake`) and read the uptime, the DRM state and +`hyprctl monitors -j`, and ask whether the panel is lit; the case is +linux-omarchy-mobile#215. + +## S1: PCIe controller and PHY loaded, no hardware access (2026-11-07 20:47) + +What it does: boots the test kernel with `pcie_0` and its PHY enabled in the +device tree and runs `modprobe pcie-gs201-cp` with `allow_hw=0`. The module +probes and registers; it does not touch the link. + +Gates: the general ones; boot 1 of the flash checked first (plain boot up, +Wi-Fi and NFC working, no modem module loaded, 7 fixed regulators, the modem +pins at their baseline: gph1-2 an output at 0, gph1-1 and gph1-7 inputs at +0). + +Stop: the general rules; any modem pin changing. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-gc5b6ae8f4dc2`: PASS. Probe +rc 0, PMU 0x3ec4 = 0xc0 (the same as on the 9a), PHY 0/0, link 0, IRQ +counts 0, pins unchanged. + +Does not prove: that the PHY or the link work (nothing was read from them); +anything about the modem. + +## S2: modem node enabled, driver not loaded (2026-11-07 20:52) + +What it does: the same kernel with the `modem` node enabled in the device +tree. No cpif module loaded. Reads the seven AP2CP and four CP2AP lines. + +Gates and stop: as S1. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-gc5b6ae8f4dc2` (image set +images-s2; I did not copy `uname -r` into the S2 log, the set shares the +S1 build): PASS. All 7 AP2CP and 4 CP2AP lines read 0, pins equal baseline, +PMU 0xc0, clean shutdown. After it the phone went back to the NFC set. + +Does not prove: anything beyond "the node enabled changes nothing on the +pins before a driver loads". + +## S3: one PCIe link attempt with the modem off (2026-11-07 21:15, my go) + +What it does: `allow_hw=1`, PHY trace every 100 ms, exactly one +`link_up 1` try. The stock module tries three times; for this step I +rebuilt the module with `CP_LINK_TRIES` 3 to 1 (same vermagic, test only, +not committed; the original module stayed on the phone as +`/root/pcie-gs201-cp.ko.tries3`). The modem is off, so no endpoint is +expected. + +Gates: the general ones, plus the backup above, plus a review of the S1/S2 +evidence. SoC had peaked at 62 C during backups and builds, so the step +waited for every zone at 62 C or less. + +Stop: a hang; an oops; no progress in the PHY trace. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-gc5b6ae8f4dc2` (image set +images-s1, flashed again for this step; the kernel is in the S3 dmesg log): +no hang. Trace: PMU bit 0 set (SMC), first PMA read, PLL on, PMA and PCS +tables, external PLL lock 1, PLL lock 1, CDR lock 1, offset calibration +done 1, PMU bit 10 set, DBI ID 0xa5a5144d; then `no L0, LTSSM 0x0` and +`link_up 1: -110` (no endpoint). After: PMU 0x3ec4 = 0x4c1, PHY 1/0, link +0, `link_down` rc 0, 53 C, no oops, Wi-Fi up. The PCIe "active" pinctrl +state changed the function of gph0-0 (PERST, now output 0), gph0-1 +(CLKREQ), gpa0-1 (output 0 to input), gpa0-2 (input to output 0), gpa6-5 +and gpa7-0; all DAT 0; gph1-1, gph1-2 and gph1-7 untouched. +It also answered one open question: HSI1 and its PHY/controller are +reachable with only the PMU 0x3ec4 bit 0 SMC before the first access (stock +source does the same). + +Does not prove: that the PCIe link works. The AP side starts, the link +itself has never been tested, because the modem was off. Not settled: who +powers the modem, what gpa0-1 drives, the S2MPU windows for CP memory. + +## S4: cpif loaded, modem stays OFFLINE (2026-11-07 22:10) + +What it does: flashes the S4 set (cpif enabled, overlay `modem-s4-cpif`), +then `modprobe pcie-gs201-cp` (`allow_hw=0`), `modprobe shm_ipc`, +`modprobe cpif`. cpif probe sets the seven AP2CP lines as outputs at 0. +No power-on, no link, no firmware. + +Gates: the general ones, plus before the load: gph1-2 an output at 0, the +six other lines inputs at DAT 0 with PUD 0x1 (pull-down); UFS stats all 0 +and no `ufshcd_err_handler started`; no modem module, no `umts` node; 56 C. + +Stop: the general rules; any `poweron`, `link up` or phone_state line in +dmesg (the two `link up` lines at boot are the Wi-Fi's HSI2 link). + +Result [V], kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67`: PASS. All +seven AP2CP lines are outputs at 0 (CON 0x1), the CP2AP inputs unchanged, +`modem_state` OFFLINE, PMU 0xc0, PHY 0/0, link 0, UFS counters 0 before and +60 s after, no oops, Wi-Fi up, 57 C. `shm_ipc` mapped the three reserved +regions (`cp-rmem@ea400000`, `cp-msi@f6200000`, `cp-rmem1@e8000000`) with +no fault. The probe log matches stock's values: `mif_off_during_volte:1`, +`num_iodevs:54`, `link_attrs:0x000037c8`, `PCIe Channel Number:0`, +`s5300 is created`. `cpif_probe: Failed to register logbuffer!` appears; +it is debug-log registration only and I did not look into it. The reboot +to bootloader ran cpif's shutdown path with the modem OFFLINE. + +Does not prove: who powers the modem or in what order; any way to power it +down (stock cpif has none once the modem is on); anything about firmware or +the SIM. + +## S5: power lines, in five parts + +The hook (test only, not for merge): `modem_ctrl_s5100.c` gets a debugfs +directory `cpif_test/`, created only when cpif is loaded with +`cpif_test_gpio=1`. Files: `lines` (read, the 11 line levels and +`phone_state`), `gpio_off` and `gpio_on` (any write fires them; they call +only the stock `gpio_power_off_cp` and `gpio_power_offon_cp`), and from S5c a +`pda_active` file. `gpio_on` is refused with -EBUSY unless six AP2CP lines +read 0: `cp_pwr`, `nreset`, `wakeup`, `dump_noti`, `cp_wrst_n` and +`pm_wrst_n`. `ap2cp-pda-active` is left out of that check because stock +`power_on_cp` sets it before the power-on, and S5e's E3 needs it high. No +state change, no CP memory write (`clear_boot_stage` and `init_ctrl_msg` are +skipped on purpose), no PCIe, no PMU, no ioctl. cpif has no module_exit, so +it cannot be unloaded. + +Builds: S5a and S5b ran an earlier build of the same code without the +`pda_active` file, the module kept on the phone as `/root/cpif.ko.s5a` +(sha256 `4ee11e7d01764522c5eebca5f6378439d2fc45db4decf17e1e883add0855d972`). +S5c to S5e ran the build that has it (sha256 +`f1e3173f55a07cb70685d611abfa05b004266dbfb23ed1aa0718ed57de7bbe11`). + +Edges [V] (the code is in my `soc-gs` copy; the line numbers are derekross's +from Google's s5300 tree: stock `modem_ctrl_s5100.c`, `gpio_power_off_cp()` +at 906-918 and `gpio_power_offon_cp()` at 921-933, non-`CP_WRESET_WA` branch, +confirmed compiled; `CP_WRESET_WA`, `CP_LCD_NOTIFIER` and +`LINK_DEVICE_PCIE_GPIO_WA` are not set in this build): + +- `gpio_off` from the all-0 state: one 10 ms pulse of `ap2cp-wakeup`; + `nreset`, `cp_wrst`, `cp_pwr` and `pm_wrst` are rewritten to 0 (no + change). +- `gpio_on` from all-0: that pulse, then `pm_wrst` 1, `cp_pwr` 1, `nreset` + 1, `cp_wrst` 1, 10 ms apart, about 130 ms in all. +- `gpio_off` with the lines high: wakeup pulse, `nreset` 0, `cp_wrst` 0, + `cp_pwr` 0 (30 ms), `pm_wrst` 0 (50 ms). + +Setup for each S5 stage: push the new `cpif.ko` (the S4 original kept as +`/root/cpif.ko.s4-original`), write `/etc/modprobe.d/modem-test.conf` (the +blacklist lines), flash images-s4, count 3, stream `dmesg -w` to the desktop, +repeat the S4 pre-checks, then `modprobe pcie-gs201-cp`, `shm_ipc`, +`cpif cpif_test_gpio=1`. + +Extra stop rules for S5b to S5e: `gpio_on` returning -EBUSY or -EINVAL (do +not retry, read `lines`, stop); any `IOCTL_`, `poweron`, `link up` or +`SET GPIO ... not valid` line; the modem lines on for more than 60 s in one +cycle; battery down more than 3 % in the stage; if a CP2AP line stays high +after `gpio_off`: do not write `gpio_off` again, do not write +`pda_active` = 0, do not reboot, read `lines` every 10 s for 2 minutes and +stop. + +### S5-0: read only (2026-11-07 22:25) + +`cat cpif_test/lines`: all 11 lines read 0, `phone_state` 0. No write. +Kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67` (`modem-s5-pre.txt`; this +read did not print `uname -r` again). That checks the read path and the +module parameter. It does not show that a later power-on is safe. + +### S5a: gpio_off from the all-0 state (2026-11-07 22:25:50, my go) + +This is the hook run (one write to `gpio_off` from the all-0 state). The +earlier note that S5a was NO-GO meant the pre-hook plan: cpif has no +software power-off, and `IOCTL_POWER_ON` writes CP DRAM. That plan was not +run. This result is only the hook's `gpio_off`. + +What it does: one write to `gpio_off` with everything at 0, to see whether the +way down runs from the all-0 state and leaves the lines at 0. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67`: PASS. The +log shows the 10 ms wakeup pulse and `nreset`, `cp_wrst`, `cp_pwr` and +`pm_wrst` rewritten to 0 as duplicates; "after" all 0; 60 s later all 0, +OFFLINE, UFS counters 0, no error handler start, no oops, Wi-Fi up, 57 C, +battery 92 %. + +Does not prove: that `gpio_off` is safe with the modem on (that is only +shown in S5b). + +### S5b: first power-on of the lines (2026-11-07 22:34:12, separate go, charger in) + +What it does: `/root/s5b.sh` on the phone: one `gpio_on`, one sample per +second of `lines` for 55 s, then `gpio_off`, then samples. `pda_active` +stays at 0 (the hook cannot set it yet). + +Stop: the general rules and the S5 rules; `gpio_off` at 55 s whatever +happened. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67` (S4 image set; +the S5b log itself does not print `uname -r`): the edges came in stock +order, 10 ms apart. For the 55 s the four AP2CP power lines read 1 and all +four CP2AP lines (`ps_hold`, `wakeup`, `cp_active`, `cp_wrst`) stayed 0; +`phone_state` OFFLINE; UFS 0 before, during and after; battery 92 %, +battery 35.8 to 36.1 C; no oops, no hang. After `gpio_off` all 11 lines 0, +57 C, Wi-Fi up. (My sleeps were shorter than the labels in the script +output; the tail covered about 20 s, and a check at 22:37 read all 0.) + +Does not prove: that the modem has no power. Stock `power_on_cp` sets +`ap2cp-pda-active` to 1 and `dump-noti` to 0 right before the power-on and +clears the shared-memory control blocks (stock `modem_ctrl_s5100.c`: +`clear_boot_stage()` called at 1000, and the `ap2cp-pda-active`/`dump-noti` +pair and the two `init_ctrl_msg()` calls in `power_on_cp()` at 1022-1027); +S5b did neither. Current was not measured. + +### S5c: S5b again with pda_active = 1 and current sampling (2026-11-07 22:44, my go) + +What it does: `/root/s5c.sh` (hook with the `pda_active` file): 30 s +baseline of lines, UFS, battery `current_now`, `current_avg` and voltage; +`pda_active` = 1; one `gpio_on`; 1 s samples; `gpio_off`; `pda_active` = 0 +only if all four CP2AP lines read 0. Built-in aborts to `gpio_off`: any UFS +counter or error handler start, battery over 45 C, `current_now` more than +300 mA below the baseline. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67`: ended by its +own abort after 24 s (one `current_now` sample at -303 mA against a 117 mA +baseline mean); `gpio_off`, `pda_active` = 0. All four CP2AP lines read 0 +in every sample; UFS 0 throughout; no oops; clean end state. A no-write +control run with the same music playing and the charger in showed the same +kind of slide (`current_avg` from +170 mA to about 0, one -377 mA sample), +so the current figures of S5b and S5c are inconclusive. + +Does not prove: anything about the modem's current draw. The charger +(holding 92 %) can feed the rail, and music was playing. From here on the +abort rule uses a median of 5 or more samples and the current runs are +battery-only. + +### S5d: battery-only current around the power-on (2026-11-07 22:58:17, my go) + +What it does: `/root/s5d.sh`, USB cable out, music off, screen off, ssh +over Wi-Fi after an identity check (model and exact test kernel). Phase A +150 s with no writes; phase B `pda_active` = 1 then one `gpio_on` +(23:00:51), 60 s, median-of-5 abort (UFS error, battery over 45 C, or a +5-sample median more than 300 mA below the baseline median); `gpio_off`, +`pda_active` = 0 if the CP2AP lines are 0; phase C 120 s no writes; phase D +120 s no-write control. Battery 92 % at 38.1 C, SoC 59 C. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67` (S4 image set; +the identity check before the run read it, but the S5d log itself does not +print `uname -r`): ran the full 60 s (no abort). Median `current_now` per phase: A -550.6 mA, B -615.9 mA, +C -556.3 mA, D -554.7 mA (negative = discharge). The three no-write phases +agree within about 10 mA; the power-on phase is about 60 to 65 mA deeper (62 against the mean of A, C +and D), with a +sharp start at the `gpio_on` write and a sharp return after `gpio_off`. All +four CP2AP lines 0 in every sample; UFS 0; battery 38.1 to 37.1 C. + +Does not prove: that the load is the modem. `pda_active` = 1 was written +immediately before `gpio_on` (back-to-back writes in the script, no timing +recorded), so the two cannot be split; it is one run; +the CP2AP lines never moved. `s5d.sh` has no signal trap, so a killed +script would not have switched the lines off by itself. + +### S5e: pda_active separated from gpio_on (2026-11-07 23:12:35, battery only) + +What it does: `/root/s5e.sh` (v3, with INT, TERM and HUP trapped into a +safe off, started with `nohup setsid`), USB out, screen off. Phases: A +baseline 90 s | E1 `pda_active` = 1 alone 30 s | B base 60 s | E2 `gpio_on` +with `pda_active` low 60 s | C base | E3 `pda_active` = 1 then `gpio_on` +60 s | D base | E1b replicate of E1 30 s | E base. The script had a +simulated four-case test before the run. + +Result [V], kernel `7.3.0-rc6-omamobile-push1-g6a203e4b8a67` (S4 image +set; the log does not print `uname -r`): no phase hit a stop; UFS 0 and all +four CP2AP lines 0 in every sample; clean end state. Median `current_now` (as printed by the script): +A -556.6 mA, E1 -541.3, B -561.3, E2 -607.2, C -550.9, E3 -611.6, D -560.6, +E1b -546.9, E -548.1. `pda_active` alone does not change the current (E1 +is about 18 mA less discharge than the mean of A and B and E1b about 8 mA +less than the mean of D and E: noise). `gpio_on` draws about 51 mA extra with `pda_active` low (E2 against +the mean of B and C) and about 56 mA with it high (E3 against C and D); S5d +measured about 60 to 65 mA. The step starts one sample after each `gpio_on` write +and ends one sample after `gpio_off`, all three times. Medians only: the +screen woke during two baseline phases (about 9 s in B, about 11 s in D right +after the E3 `gpio_off`; S5d had the same shape once in C), which makes the +means unreliable but sits against the effect, not for it. + +Does not prove: that the load is the S5300. It could be another load on the +same rail, a power stage or level shifters with no modem core behind them, +or the ROM idling. The CP ROM gave no sign of life on any CP2AP line. +Two battery-only runs, three power-on phases, one phone and one gauge. + +## Current state: on hold + +- S3, S4, S5a, S5b, S5c, S5d and S5e ran after my question on + omarchy-mobile#472 (2026-11-07 18:04 UTC) and before any answer to it. + So the hold now covers S6 and any repeat, but it came too late for S3 to + S5e, which should have waited as well. +- No further modem step and no power-line step on the 8 Pro until derekross + answers the question on omarchy-mobile#472 + (https://github.com/derekross/omarchy-mobile/pull/472#issuecomment-6711065625); + his instruction to wait is on linux-omarchy-mobile#187. +- The hook is on the branch `husky-modem-cpif-test-hook` of + Somnius/linux-omarchy-mobile (commit 058a439b3). It is test only and not + for merge. +- `tools/nv-backup --check` on 2026-11-08: `efs`, `efs_backup`, + `modem_userdata`, `persist`, `modem_a`, `modem_b`, `trusty_persist` and + `trusty_userdata` are SAME as the 2026-11-01 10:01 backup. `devinfo` is + different, as expected (the retry bit and boot counts change with every + flash). +- Leftovers on the phone (checked 2026-11-08 at 21:40 local): `/etc/modprobe.d/` + has no `modem-test.conf`; the folder holds only `hid_apple.conf` and + `omamobile-aoc-blacklist.conf`, neither from the modem tests (the AoC one + is dated 2026-11-05 and does not shadow a packaged file). The test + `cpif.ko` is still inside the two test module trees (`...gc5b6ae8f4dc2` + and `...g6a203e4b8a67`) and as `/root/cpif.ko.s5a` and + `/root/cpif.ko.s4-original`; the normal NFC set's tree has none, so a + normal boot loads none of it. +- What ran is in this folder: the overlays `overlays/modem-s1-link.dtso` + (`pcie_0` and `pcie_0_phy` on), `overlays/modem-s2-lines.dtso` (S1 plus the + `modem` child of `pcie_0`) and `overlays/modem-s4-cpif.dtso` (the controller + on, its `modem` child off, and `/cp-shmem` and `/cpif` on), and the scripts + `bringup/s5b.sh`, `s5c.sh`, `s5c-control.sh`, `s5d.sh` and `s5e.sh`, as they + ran (two comment lines were added at the top of each: an SPDX line and a note). The headers of the overlays now point at this file; nothing else in them changed. `bringup/s5e.sh` is the version the S5e result + above describes, with INT, TERM and HUP trapped into a safe off (its own + header still says v2). The S3 module change was one line: `CP_LINK_TRIES` from 3 + to 1 in `pcie-gs201-cp`, test only, not committed. +- The phone is on the normal NFC image set. The first revert boot on + 2026-11-07 had no drivers because a clean-up timer had deleted the + module folder; I fixed it by hand between 23:26 and 23:35 and checked the module + tree before every revert since. +- Not run, and not to be run before the answer: S6 (the same power-on plus + one `link_up` try with the modem powered), a PMIC power-meter reading of + the modem channel, repeats of the S5 power-ons for more statistics. +- When S6 comes, each step gets an Expect line, a rollback and a risk level + as well as its stop rules, and the NV check runs first. + +## Unknowns + +- Whether the 50 to 65 mA is the modem [I]. A control that would split it: + not available without a way to see the CP side (S6 or the power meter). +- Which rail the lines switch. The stock husky DT has no regulator or + consumer named cp, modem, rfic, rf, lte, 5g, sub6, vdd_cp or qlink [V]; + `cp_pwr_on` and `pm_wrst_n` are plain pinctrl there, so the rail is + unknown. The only modem-named items are PMIC power-meter sense channels + (`VSYS_PWR_MODEM`, `VSYS_PWR_RFFE`, `VSYS_PWR_MMWAVE`), which suggests the + modem runs from VSYS [I, from the DT only]. The PCIe0 rails are S2MPG14 + LDO16M and LDO18M, which our driver does not cover. +- Whether the CP ROM waits for the shared-memory control blocks or for the + PCIe link before any CP2AP line moves [I]. Stock `power_on_cp` writes + `clear_boot_stage` and `init_ctrl_msg` before the lines; the hook skips + that on purpose. `cp2ap_cp_wrst_n` (gpa0-1) is high while the CP is alive + in stock logic and stayed 0 here; whether it rises before PCIe training + is unknown. Source reading, then S6, would settle it. +- What the bootloader does with the modem lines on a forced reboot or a + hang. Nothing in my notes covers it. A hung kernel needs Power + Volume Up + held for 15 to 30 s, and the debugfs hook exists only while the test + module is loaded. +- Whether a power-off edge triggers the UFS error pass on husky (it did on + cheetah). S5b, S5c, S5d and S5e saw none. +- The husky modem image and partition mapping, the BAR and doorbell layout, + and who sets up the S2MPU windows for CP memory. diff --git a/device/husky/bringup/s5b.sh b/device/husky/bringup/s5b.sh new file mode 100755 index 000000000..25bc84de6 --- /dev/null +++ b/device/husky/bringup/s5b.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Test only, as run on the 8 Pro on 2026-11-07 (see device/husky/MODEM-PLAN.md); this note and the SPDX line are the only changes. +L=/sys/kernel/debug/cpif_test; U=/sys/kernel/debug/ufshcd/13200000.ufs/stats; O=/root/s5b.log +: > $O +snap() { echo "$(date +%T.%N | cut -c1-12) $1 $(awk '{printf "%s=%s ",$1,$2}' $L/lines) ufs=$(grep -vc ': 0$' $U) errh=$(dmesg | grep -c 'ufshcd_err_handler started') bat=$(cat /sys/class/power_supply/*battery*/capacity)% bt=$(cat /sys/class/power_supply/*battery*/temp)" >> $O; } +snap pre +echo 1 > $L/gpio_on; echo "gpio_on rc=$?" >> $O +i=0 +while [ $i -lt 55 ]; do + sleep 1; i=$((i+1)); snap "on+$i" + if [ "$(grep -vc ': 0$' $U)" != 0 ]; then echo "STOP-UFS-COUNTER" >> $O; break; fi +done +echo 1 > $L/gpio_off; echo "gpio_off rc=$?" >> $O +for t in 1 5 10 30 60; do + sleep $([ $t = 1 ] && echo 1 || echo 5); snap "off+$t" +done +echo DONE >> $O diff --git a/device/husky/bringup/s5c-control.sh b/device/husky/bringup/s5c-control.sh new file mode 100755 index 000000000..272b973fc --- /dev/null +++ b/device/husky/bringup/s5c-control.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Test only, as run on the 8 Pro on 2026-11-07 (see device/husky/MODEM-PLAN.md); this note and the SPDX line are the only changes. +# CONTROL for S5c: the same 30 s + 55 s + 30 s sampling, NO writes to any modem line. Log: /root/s5c-control.log +L=/sys/kernel/debug/cpif_test; U=/sys/kernel/debug/ufshcd/13200000.ufs/stats; O=/root/s5c-control.log +B=/sys/class/power_supply/max170xx_battery +: > $O +snap() { echo "$(date +%T.%N | cut -c1-12) $1 cur=$(cat $B/current_now) avg=$(cat $B/current_avg) v=$(cat $B/voltage_now) bat=$(cat $B/capacity)% bt=$(cat $B/temp) ufs=$(grep -vc ': 0$' $U) lines=$(awk '{s+=$2} END {print s+0}' $L/lines)" >> $O; } +i=0; while [ $i -lt 30 ]; do snap "base-$i"; sleep 1; i=$((i+1)); done +snap "pda1(none)" +i=0; while [ $i -lt 55 ]; do sleep 1; i=$((i+1)); snap "on+$i(none)"; done +sleep 2; snap "off+2(none)" +for t in 3 8 13 18 23 28; do sleep 5; snap "post+$t(none)"; done +echo DONE >> $O diff --git a/device/husky/bringup/s5c.sh b/device/husky/bringup/s5c.sh new file mode 100755 index 000000000..fd15e7eee --- /dev/null +++ b/device/husky/bringup/s5c.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Test only, as run on the 8 Pro on 2026-11-07 (see device/husky/MODEM-PLAN.md); this note and the SPDX line are the only changes. +# S5c (TEST ONLY): pda_active=1, then gpio_on once, 55 s of 1 s samples, gpio_off, pda_active=0 only if the CP side is quiet. +# Runs ON the phone so the power-off happens even if ssh drops. Log: /root/s5c.log +L=/sys/kernel/debug/cpif_test; U=/sys/kernel/debug/ufshcd/13200000.ufs/stats; O=/root/s5c.log +B=$(ls -d /sys/class/power_supply/*battery* | head -1) +: > $O +cp2ap() { awk '/^CP2AP_/ {s+=$2} END {print s+0}' $L/lines; } +ufsbad() { [ "$(grep -vc ': 0$' $U)" != 0 ] || [ "$(dmesg | grep -c 'ufshcd_err_handler started')" != 0 ]; } +snap() { echo "$(date +%T.%N | cut -c1-12) $1 $(awk '{printf "%s=%s ",$1,$2}' $L/lines | sed 's/AP2CP_//g;s/CP2AP_/c2a_/g') ufs=$(grep -vc ': 0$' $U) cur=$(cat $B/current_now) avg=$(cat $B/current_avg 2>/dev/null) v=$(cat $B/voltage_now) bat=$(cat $B/capacity)% bt=$(cat $B/temp)" >> $O; } +# 30 s baseline at the same cadence +i=0; while [ $i -lt 30 ]; do snap "base-$i"; sleep 1; i=$((i+1)); done +BASE=$(awk '/ base-/ {for(i=1;i<=NF;i++) if ($i ~ /^cur=/) {sub("cur=","",$i); s+=$i; n++}} END {printf "%d", s/n}' $O) +echo "baseline cur=$BASE uA" >> $O +echo 1 > $L/pda_active; echo "pda_active=1 rc=$?" >> $O; snap "pda1" +echo 1 > $L/gpio_on; RC=$?; echo "gpio_on rc=$RC" >> $O +STOP="" +if [ $RC = 0 ]; then + i=0 + while [ $i -lt 55 ]; do + sleep 1; i=$((i+1)); snap "on+$i" + ufsbad && { STOP="UFS"; break; } + BT=$(cat $B/temp); [ "$BT" -gt 450 ] && { STOP="BATTEMP"; break; } + CUR=$(cat $B/current_now); [ $((BASE - CUR)) -gt 300000 ] && { STOP="CURRENT"; break; } + done +fi +echo "STOPREASON=${STOP:-none-at-55s}" >> $O +echo 1 > $L/gpio_off; echo "gpio_off rc=$?" >> $O +sleep 2; snap "off+2" +if [ "$(cp2ap)" = 0 ]; then + echo 0 > $L/pda_active; echo "pda_active=0 rc=$?" >> $O +else + echo "CP2AP STILL HIGH after gpio_off: pda_active NOT lowered, do not reboot" >> $O +fi +for t in 3 8 13 18 23 28; do sleep 5; snap "post+$t"; done +echo DONE >> $O diff --git a/device/husky/bringup/s5d.sh b/device/husky/bringup/s5d.sh new file mode 100755 index 000000000..f7ff5759c --- /dev/null +++ b/device/husky/bringup/s5d.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Test only, as run on the 8 Pro on 2026-11-07 (see device/husky/MODEM-PLAN.md); this note and the SPDX line are the only changes. +# S5d (TEST ONLY): battery-only current measurement around the modem power-on. Runs ON the phone; log /root/s5d.log. +# Phases: A baseline 150 s (no writes) -> B pda_active=1 + gpio_on, 60 s (median-of-5 abort) -> gpio_off, pda_active=0 if CP2AP quiet +# -> C post 120 s -> D control 120 s (no writes). 1 s samples of current_now/current_avg/voltage. +L=/sys/kernel/debug/cpif_test; U=/sys/kernel/debug/ufshcd/13200000.ufs/stats; O=/root/s5d.log; B=/sys/class/power_supply/max170xx_battery +: > $O +cp2ap() { awk '/^CP2AP_/ {s+=$2} END {print s+0}' $L/lines; } +ufsbad() { [ "$(grep -vc ': 0$' $U)" != 0 ] || [ "$(dmesg | grep -c 'ufshcd_err_handler started')" != 0 ]; } +snap() { echo "$(date +%T) $1 cur=$(cat $B/current_now) avg=$(cat $B/current_avg) v=$(cat $B/voltage_now) bt=$(cat $B/temp) c2a=$(cp2ap) ufs=$(grep -vc ': 0$' $U)" >> $O; } +med5() { tail -5 $O | sed 's/.* cur=\([-0-9]*\) .*/\1/' | sort -n | sed -n 3p; } +phase() { n=$1; tag=$2; i=0; while [ $i -lt $n ]; do snap "$tag-$i"; sleep 1; i=$((i+1)); done; } +phase 150 A +BASEMED=$(sed -n '/ A-/p' $O | tail -60 | sed 's/.* cur=\([-0-9]*\) .*/\1/' | sort -n | awk '{a[NR]=$1} END {print a[int((NR+1)/2)]}') +echo "BASELINE_MEDIAN_cur=$BASEMED uA" >> $O +echo 1 > $L/pda_active; echo "pda_active=1 rc=$?" >> $O +echo 1 > $L/gpio_on; RC=$?; echo "gpio_on rc=$RC" >> $O +STOP="" +if [ $RC = 0 ]; then + i=0 + while [ $i -lt 60 ]; do + sleep 1; i=$((i+1)); snap "B-$i" + ufsbad && { STOP="UFS"; break; } + [ "$(cat $B/temp)" -gt 450 ] && { STOP="BATTEMP"; break; } + if [ $i -ge 5 ]; then M=$(med5); [ $((BASEMED - M)) -gt 300000 ] && { STOP="CURRENT_MEDIAN"; break; }; fi + done +fi +echo "STOPREASON=${STOP:-none-at-60s}" >> $O +echo 1 > $L/gpio_off; echo "gpio_off rc=$?" >> $O +sleep 2; snap "off+2" +if [ "$(cp2ap)" = 0 ]; then echo 0 > $L/pda_active; echo "pda_active=0 rc=$?" >> $O; else echo "CP2AP STILL HIGH: pda_active NOT lowered, do not reboot" >> $O; fi +phase 120 C +phase 120 D +echo DONE >> $O diff --git a/device/husky/bringup/s5e.sh b/device/husky/bringup/s5e.sh new file mode 100755 index 000000000..70c82cb2c --- /dev/null +++ b/device/husky/bringup/s5e.sh @@ -0,0 +1,71 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Test only, as run on the 8 Pro on 2026-11-07 (see device/husky/MODEM-PLAN.md); this note and the SPDX line are the only changes. +# S5e v2 (TEST ONLY): battery-only current, isolating pda_active from gpio_on. Run as: nohup setsid sh /root/s5e.sh & Log: /root/s5e.log +# A 90 s base | E1 pda_active ALONE 30 s | B 60 s | E2 gpio_on, pda LOW 60 s | C 60 s | E3 pda=1 then gpio_on 60 s | D 60 s | E1b (replicate) 30 s | E 60 s +# Fixes after review: trap (safe_off on INT/TERM/HUP), abort ends the run, CP2AP-high stops, pda verified low before powered steps, +# UFS error count compared to the count at start, tighter E1 rule (150 mA), screen state in every sample, per-phase medians at the end. +L=/sys/kernel/debug/cpif_test; U=/sys/kernel/debug/ufshcd/13200000.ufs/stats; O=/root/s5e.log; B=/sys/class/power_supply/max170xx_battery +: > $O +N0=$(dmesg | grep -c 'ufshcd_err_handler started') +ABORT="" +hw() { echo "$2" > $L/$1; } +cp2ap() { awk '/^CP2AP_/ {s+=$2} END {print s+0}' $L/lines; } +ap2cp() { awk '/^AP2CP_/ {s+=$2} END {print s+0}' $L/lines; } +pda() { awk '/^AP2CP_AP_ACTIVE/ {print $2}' $L/lines; } +ufsbad() { [ "$(grep -vc ': 0$' $U)" != 0 ] || [ "$(dmesg | grep -c 'ufshcd_err_handler started')" != "$N0" ]; } +snap() { echo "$(date +%T) $1 cur=$(cat $B/current_now) avg=$(cat $B/current_avg) v=$(cat $B/voltage_now) bt=$(cat $B/temp) c2a=$(cp2ap) a2c=$(ap2cp) pda=$(pda) ufs=$(grep -vc ': 0$' $U) bl=$(cat /sys/class/backlight/*/bl_power | head -1)" >> $O; } +med5() { tail -5 $O | sed 's/.* cur=\([-0-9]*\) .*/\1/' | sort -n | sed -n 3p; } +phase() { n=$1; tag=$2; i=0; while [ $i -lt $n ]; do snap "$tag-$i"; sleep 1; i=$((i+1)); done; } +safe_off() { + hw gpio_off 1; echo "gpio_off rc=$?" >> $O; sleep 2; snap "off+2" + if [ "$(cp2ap)" = 0 ]; then hw pda_active 0; echo "pda_active=0 rc=$?" >> $O + else echo "CP2AP STILL HIGH: pda_active NOT lowered, do not reboot" >> $O; ABORT="CP2AP_HIGH"; fi + [ "$(pda)" = 0 ] || [ "$ABORT" = "CP2AP_HIGH" ] || ABORT="PDA_NOT_LOW" +} +trap 'echo TRAP >> $O; safe_off; echo ABORTED-BY-SIGNAL >> $O; exit 1' INT TERM HUP +# powered TAG SECONDS THRESHOLD_uA : the enabling write(s) were done by the caller +powered() { tag=$1; n=$2; th=$3; STOP=""; i=0 + while [ $i -lt $n ]; do sleep 1; i=$((i+1)); snap "$tag-$i" + ufsbad && { STOP=UFS; break; } + [ "$(cat $B/temp)" -gt 450 ] && { STOP=BATTEMP; break; } + if [ $i -ge 5 ]; then M=$(med5); [ $((BASEMED - M)) -gt $th ] && { STOP=CURRENT_MEDIAN; break; }; fi + done + echo "STOPREASON($tag)=${STOP:-none-at-${n}s}" >> $O; [ -n "$STOP" ] && ABORT="$tag:$STOP"; } +finish() { phase 30 Z; echo "ABORTED=$ABORT" >> $O; summary; echo DONE >> $O; exit 1; } +summary() { echo "--- per-phase median cur (uA) and n" >> $O + for ph in A E1 B E2 C E3 D E1b E; do grep -E "^[0-9:]+ $ph-[0-9]+ " $O | sed 's/.* cur=\([-0-9]*\) .*/\1/' | sort -n | awk -v ph=$ph '{a[NR]=$1} END { if (NR) printf "%s median=%d n=%d\n", ph, a[int((NR+1)/2)], NR }' >> $O; done; } +echo "start: bl=$(cat /sys/class/backlight/*/bl_power | head -1) N0=$N0 status=$(cat $B/status)" >> $O +[ "$(cat $B/status)" = "Discharging" ] || { echo "NOT DISCHARGING: refusing" >> $O; ABORT=START_STATUS; finish; } +[ "$(cat $B/temp)" -le 450 ] || { echo "BATTERY HOT: refusing" >> $O; ABORT=START_TEMP; finish; } +[ "$(ap2cp)$(cp2ap)" = "00" ] || { echo "LINES NOT ALL 0: refusing" >> $O; ABORT=START_LINES; finish; } +ufsbad && { echo "UFS NOT CLEAN: refusing" >> $O; ABORT=START_UFS; finish; } +phase 90 A +BASEMED=$(sed -n '/ A-/p' $O | tail -60 | sed 's/.* cur=\([-0-9]*\) .*/\1/' | sort -n | awk '{a[NR]=$1} END {print a[int((NR+1)/2)]}') +echo "BASELINE_MEDIAN_cur=$BASEMED uA" >> $O +[ "$(pda)" = 0 ] || { echo "pda not low at start" >> $O; ABORT=START; finish; } +# E1: pda_active alone (tight rule 150 mA) +hw pda_active 1; echo "E1 pda_active=1 rc=$?" >> $O +if [ "$(pda)" = 1 ] && [ "$(ap2cp)" = 1 ]; then powered E1 30 150000; else echo "E1 READBACK MISMATCH" >> $O; ABORT="E1:READBACK"; fi +hw pda_active 0; echo "E1 pda_active=0 rc=$?" >> $O; [ -z "$ABORT" ] || finish +[ "$(pda)" = 0 ] || { ABORT="PDA_NOT_LOW_AFTER_E1"; finish; } +phase 60 B +# E2: gpio_on with pda low +[ "$(pda)" = 0 ] || { ABORT="PDA_NOT_LOW_BEFORE_E2"; finish; } +hw gpio_on 1; RC=$?; echo "E2 gpio_on(pda low) rc=$RC" >> $O +if [ "$(ap2cp)" = 4 ] && [ "$(pda)" = 0 ]; then powered E2 60 400000; else echo "E2 READBACK MISMATCH (ap2cp=$(ap2cp) pda=$(pda))" >> $O; ABORT="E2:READBACK"; fi +safe_off; [ -z "$ABORT" ] || finish +phase 60 C +# E3: pda_active then gpio_on (the S5d order) +hw pda_active 1; echo "E3 pda_active=1 rc=$?" >> $O +hw gpio_on 1; RC=$?; echo "E3 gpio_on rc=$RC" >> $O +if [ "$(ap2cp)" = 5 ] && [ "$(pda)" = 1 ]; then powered E3 60 400000; else echo "E3 READBACK MISMATCH (ap2cp=$(ap2cp) pda=$(pda))" >> $O; ABORT="E3:READBACK"; fi +safe_off; [ -z "$ABORT" ] || finish +phase 60 D +# E1b: replicate of E1 +hw pda_active 1; echo "E1b pda_active=1 rc=$?" >> $O +if [ "$(pda)" = 1 ] && [ "$(ap2cp)" = 1 ]; then powered E1b 30 150000; else echo "E1b READBACK MISMATCH" >> $O; ABORT="E1b:READBACK"; fi +hw pda_active 0; echo "E1b pda_active=0 rc=$?" >> $O; [ -z "$ABORT" ] || finish +phase 60 E +summary +echo DONE >> $O diff --git a/device/husky/overlays/modem-s1-link.dtso b/device/husky/overlays/modem-s1-link.dtso new file mode 100644 index 000000000..52ddf557e --- /dev/null +++ b/device/husky/overlays/modem-s1-link.dtso @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Modem link bring-up, stage S1, never default (device/husky/ + * MODEM-PLAN.md): turns on the modem PCIe controller node + * (pcie_0, ch0) and its PHY (pcie_0_phy) and nothing else. The `modem` + * child stays disabled, so the controller driver takes no modem line, and + * the pins are not touched (pcie_0 has only an "active" pinctrl state, which + * only link_up selects). Both drivers only map their registers at probe. + * The controller module is blacklisted and loaded by hand after the boot. + * The modem power lines are not described as enabled anywhere in this file. + */ +/dts-v1/; +/plugin/; + +&pcie_0_phy { + status = "okay"; +}; + +&pcie_0 { + status = "okay"; +}; diff --git a/device/husky/overlays/modem-s2-lines.dtso b/device/husky/overlays/modem-s2-lines.dtso new file mode 100644 index 000000000..d91aa0586 --- /dev/null +++ b/device/husky/overlays/modem-s2-lines.dtso @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Modem link bring-up, stage S2, never default (device/husky/ + * MODEM-PLAN.md): S1 (pcie_0 and pcie_0_phy) plus the `modem` + * child of pcie_0, so the controller driver requests the eleven modem lines + * as the bootloader left them (GPIOD_ASIS: no direction or level change at + * probe). Only the debugfs `status` file reads them. There is no cpif node + * (samsung,exynos-cp) in the tree, so cpif and shm_ipc cannot bind and must + * not be loaded. No pin state is selected and no line is driven by hand. + */ +/dts-v1/; +/plugin/; + +&pcie_0_phy { + status = "okay"; +}; + +&pcie_0 { + status = "okay"; + + modem { + status = "okay"; + }; +}; diff --git a/device/husky/overlays/modem-s4-cpif.dtso b/device/husky/overlays/modem-s4-cpif.dtso new file mode 100644 index 000000000..9e0581d3d --- /dev/null +++ b/device/husky/overlays/modem-s4-cpif.dtso @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Modem link test, stage S4, never default (device/husky/ + * MODEM-PLAN.md): the controller (pcie_0_phy, pcie_0) + * is on, but its `modem` child is OFF so the lines are free for CPIF, and + * /cp-shmem and /cpif (disabled in the base dtb, kernel branch + * husky-e1-modem-cpif) are switched on. cpif probe forces the seven AP2CP + * outputs low; nothing powers the modem or starts PCIe. + */ +/dts-v1/; +/plugin/; + +&pcie_0_phy { + status = "okay"; +}; + +&pcie_0 { + status = "okay"; + + modem { + status = "disabled"; + }; +}; + +&{/cp-shmem} { + status = "okay"; +}; + +&{/cpif} { + status = "okay"; +}; From 278abad4168903e73630c9746ba980a7c2e02653 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 09:38:51 -0600 Subject: [PATCH 29/66] bin/omamobile, tools/dodge-chain: stop when alpine-fetch.py fails (#535) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every caller of tools/alpine-fetch.py walked its output with `for apk in $(…)`, which drops the command's exit status: a failed fetch left the loop to unpack whatever had been printed, and the build stopped only at a later check (the initramfs's e2fsck, i2cget, the sysroot's libc.a, dodge-chain's busybox.static). Each caller now reads the list whole, dies with a message naming the step when alpine-fetch.py fails, and only then unpacks it. i2c-tools removes its scratch directory before dying, as the next check does. A successful fetch is unpacked exactly as before: the list is still split on whitespace. The maintainer suggested `mapfile -t apks < <(…) || die` on #290. That form can't stop: the `||` tests mapfile's status, which is 0, and the process substitution's status is lost. On today's main, alpine-fetch.py exits 1 on a network or size failure, possibly after printing the packages it already downloaded, which the old loop unpacked. It skips a missing package or dependency with exit 0, so the stop for that case takes effect once #290 lands. tests/alpine-fetch-callers runs each caller (no network) with a stand-in alpine-fetch.py that prints one package, then fails: the caller must stop with the message, before unpacking it. It failed on main's callers, each one alone, and passes with this change; a successful fetch is still unpacked. Co-authored-by: Claude Opus 5.5 --- bin/omamobile | 18 +++-- tests/all | 7 +- tests/alpine-fetch-callers | 135 +++++++++++++++++++++++++++++++++++++ tools/dodge-chain | 9 ++- 4 files changed, 158 insertions(+), 11 deletions(-) create mode 100755 tests/alpine-fetch-callers diff --git a/bin/omamobile b/bin/omamobile index 7dfcc4561..752c2b144 100755 --- a/bin/omamobile +++ b/bin/omamobile @@ -629,10 +629,14 @@ cmd_initramfs() { say "Staging initramfs in $stage" rm -rf "$stage" && mkdir -p "$stage" tar -xzf "$dl/$tarball" -C "$stage" - local apk + # Each package list is read whole before it is used: `for apk in $(…)` + # loses alpine-fetch.py's exit status and unpacks what it printed + local apk apks # e2fsprogs-extra: resize2fs and dumpe2fs, to grow a freshly flashed root # to the whole userdata partition on its first boot (init, boot_arch) - for apk in $(python3 -I "$ROOT/tools/alpine-fetch.py" "$ver" "$dl/apks" dropbear kexec-tools e2fsprogs e2fsprogs-extra); do + apks=$(python3 -I "$ROOT/tools/alpine-fetch.py" "$ver" "$dl/apks" dropbear kexec-tools e2fsprogs e2fsprogs-extra) || + die "tools/alpine-fetch.py failed for the initramfs's packages" + for apk in $apks; do tar -xzf "$apk" -C "$stage" --exclude='.PKGINFO' --exclude='.SIGN.*' --exclude='.*.sh' 2>/dev/null || true done # INITRAMFS_I2C_TOOLS=1: i2cget and i2cset (and their libi2c) for a device @@ -641,7 +645,9 @@ cmd_initramfs() { if [[ ${DEV_INITRAMFS_I2C_TOOLS:-} == 1 ]]; then local i2c f i2c=$(mktemp -d) - for apk in $(python3 -I "$ROOT/tools/alpine-fetch.py" "$ver" "$dl/apks" i2c-tools); do + apks=$(python3 -I "$ROOT/tools/alpine-fetch.py" "$ver" "$dl/apks" i2c-tools) || + { rm -rf "$i2c"; die "INITRAMFS_I2C_TOOLS: tools/alpine-fetch.py failed for i2c-tools"; } + for apk in $apks; do tar -xzf "$apk" -C "$i2c" --exclude='.PKGINFO' --exclude='.SIGN.*' --exclude='.*.sh' 2>/dev/null || true done for f in usr/sbin/i2cget usr/sbin/i2cset; do @@ -704,11 +710,13 @@ cmd_initramfs() { # sysroot is already in use, otherwise the host clang against the same # musl sysroot. A first-light device has no bootctl. alpine_sysroot() { - local sysroot="$WORK/downloads/alpine/sysroot" apk + local sysroot="$WORK/downloads/alpine/sysroot" apk apks if [[ ! -f $sysroot/usr/lib/crt1.o ]]; then mkdir -p "$sysroot" tar -xzf "$dl/$tarball" -C "$sysroot" - for apk in $(python3 -I "$ROOT/tools/alpine-fetch.py" "$ver" "$dl/apks" musl-dev); do + apks=$(python3 -I "$ROOT/tools/alpine-fetch.py" "$ver" "$dl/apks" musl-dev) || + die "tools/alpine-fetch.py failed for the musl sysroot's musl-dev" + for apk in $apks; do tar -xzf "$apk" -C "$sysroot" 2>/dev/null || true done fi diff --git a/tests/all b/tests/all index 0f79edbb2..e6b3102ed 100755 --- a/tests/all +++ b/tests/all @@ -22,8 +22,9 @@ # report's differences on the host, bin/lineage-ref sync's branch handling # against stand-ins for docker and repo, tools/repo-publish --from-main's # copy of the prebuilt binaries into a fixture's publish tree, -# tools/repo-publish's staging, and tools/extract-vendor-firmware's output -# generations (made-up files, no factory image). +# tools/repo-publish's staging, tools/extract-vendor-firmware's output +# generations (made-up files, no factory image), and the callers of +# tools/alpine-fetch.py stopping when it fails. set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." for f in tools/install-phone tools/phone-provision tools/nv-backup tools/build-rootfs tools/build-packages tools/make-bundle \ @@ -40,7 +41,7 @@ sh -n device/flame/initramfs/build bash -n tools/build-flame-probe echo "ok - scripts parse" python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers; do echo "# $t" "$t" done diff --git a/tests/alpine-fetch-callers b/tests/alpine-fetch-callers new file mode 100755 index 000000000..a9ad70930 --- /dev/null +++ b/tests/alpine-fetch-callers @@ -0,0 +1,135 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Every caller of tools/alpine-fetch.py stops when it fails, before it uses +# any of the list (no network): bin/omamobile initramfs's packages, its +# INITRAMFS_I2C_TOOLS i2c-tools and its musl sysroot's musl-dev, and +# tools/dodge-chain pack's busybox-static. A stand-in for alpine-fetch.py +# prints one package it "fetched" (an .apk holding marker-), then +# exits 1 when asked for FETCH_FAIL_ON. A `for apk in $(…)` loop ignores that +# status and unpacks what was printed; a caller must not. A stand-in +# minirootfs (sha256sum accepts it) holds the files the initramfs checks for. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +t=$(mktemp -d); trap 'rm -rf "$t"' EXIT +fail() { echo "not ok - $*" >&2; cat "$t/log" >&2; exit 1; } +pass() { echo "ok - $*"; } + +mkdir -p "$t/bin" "$t/home" "$t/clang" "$t/root/sbin" "$t/root/usr/sbin" "$t/root/usr/lib" "$t/apks" +for f in sbin/e2fsck usr/sbin/resize2fs usr/sbin/dumpe2fs; do + printf '#!/bin/sh\n' > "$t/root/$f"; chmod 755 "$t/root/$f" +done +tar -czf "$t/minirootfs.tar.gz" -C "$t/root" . +for p in dropbear musl-dev busybox-static; do + mkdir -p "$t/apk-src/$p"; : > "$t/apk-src/$p/marker-$p" + tar -czf "$t/apks/$p.apk" -C "$t/apk-src/$p" "marker-$p" +done +# What the initramfs installs from i2c-tools +mkdir -p "$t/apk-src/i2c/usr/sbin" "$t/apk-src/i2c/usr/lib" +: > "$t/apk-src/i2c/usr/sbin/i2cget"; : > "$t/apk-src/i2c/usr/sbin/i2cset"; : > "$t/apk-src/i2c/usr/lib/libi2c.so.0" +tar -czf "$t/apks/i2c-tools.apk" -C "$t/apk-src/i2c" usr + +cat > "$t/bin/python3" <<'EOF' +#!/bin/bash +# tools/alpine-fetch.py's stand-in; any other python3 run is the real one +if [[ ${1:-} == -I && ${2:-} == */tools/alpine-fetch.py ]]; then + echo "${*:5}" >> "$FETCH_LOG" + echo "$FETCH_APKS/$5.apk" + for p in "${@:5}"; do + if [[ $p == "${FETCH_FAIL_ON:-}" ]]; then + echo "alpine-fetch: no package or provider in the index for $p (stand-in)" >&2 + exit 1 + fi + done + exit 0 +fi +exec "$REAL_PYTHON" "$@" +EOF +printf '#!/bin/sh\ncat >/dev/null\n' > "$t/bin/sha256sum" # the stand-in minirootfs passes +printf '#!/bin/sh\nexit 97\n' > "$t/bin/curl" # no network +printf '#!/bin/sh\n' > "$t/bin/magick" # no splash rendering +printf '#!/bin/sh\n' > "$t/bin/mkbootimg" +# The live DTB's memory node, for dodge-chain's stage-1 memory check +cat > "$t/bin/dtc" <<'EOF' +#!/bin/sh +printf '/ {\n\tmemory {\n\t\treg = <0x0 0x80000000 0x0 0x1000>;\n\t};\n};\n' +EOF +chmod 755 "$t/bin"/* +REAL_PYTHON=$(command -v python3) +export REAL_PYTHON FETCH_APKS="$t/apks" FETCH_LOG="$t/fetched" HOME="$t/home" CLANG_DIR="$t/clang" PATH="$t/bin:$PATH" +unset KERNEL_DIR KERNEL_BASE KERNEL_OUT WORK SPLASH_BGRA_GZ FETCH_FAIL_ON || true + +ver=$(sed -n 's/.* ver=\([0-9.]*\)$/\1/p' bin/omamobile) +[[ -n $ver ]] || fail "bin/omamobile names its Alpine version" +stage=$t/out/initramfs sysroot=$t/work/downloads/alpine/sysroot +# DEVICE [FETCH_FAIL_ON]: bin/omamobile initramfs from nothing; the status in $status +initramfs() { + rm -rf "$t/work" "$t/out" "$t/tmp" + mkdir -p "$t/work/downloads/alpine" "$t/tmp" + cp "$t/minirootfs.tar.gz" "$t/work/downloads/alpine/alpine-minirootfs-$ver-aarch64.tar.gz" + : > "$t/fetched" + status=0 + DEVICE=$1 FETCH_FAIL_ON=${2:-} WORK=$t/work KERNEL_OUT=$t/out TMPDIR=$t/tmp \ + bin/omamobile initramfs > "$t/log" 2>&1 || status=$? +} +stopped() { # what, the package the stand-in failed on + [[ $status != 0 ]] || fail "$1: the build went on" + grep -c -w -F -- "$2" "$t/fetched" >/dev/null || fail "$1: the build never reached alpine-fetch.py for $2" + grep -c -F "tools/alpine-fetch.py failed" "$t/log" >/dev/null || fail "$1: no message that alpine-fetch.py failed" +} + +# The callers still unpack what alpine-fetch.py prints when it succeeds +initramfs cheetah +[[ -e $stage/marker-dropbear && -e $sysroot/marker-musl-dev ]] || fail "cheetah: a successful fetch is unpacked" +grep -c -F "alpine musl sysroot has no libc.a" "$t/log" >/dev/null || fail "cheetah: the stand-in build stops at the sysroot's libc.a" +pass "bin/omamobile initramfs unpacks the packages a successful fetch lists" + +initramfs cheetah dropbear +stopped "initramfs packages" dropbear +[[ ! -e $stage/marker-dropbear ]] || fail "initramfs packages: unpacked a list from a failed fetch" +grep -c -F musl-dev "$t/fetched" >/dev/null && fail "initramfs packages: went on to the sysroot" +pass "bin/omamobile initramfs stops when the initramfs's packages fail, before unpacking any" + +initramfs raven +[[ -e $stage/usr/sbin/i2cget && -e $stage/usr/sbin/i2cset && -e $stage/usr/lib/libi2c.so.0 ]] || fail "raven: a successful i2c-tools fetch is installed" +grep -c -F "INITRAMFS_MODULES needs a kernel build" "$t/log" >/dev/null || fail "raven: the stand-in build stops at INITRAMFS_MODULES" +pass "bin/omamobile initramfs installs i2c-tools from a successful fetch" + +initramfs raven i2c-tools +stopped "INITRAMFS_I2C_TOOLS" i2c-tools +[[ -z $(ls -A "$t/tmp") ]] || fail "INITRAMFS_I2C_TOOLS: left its scratch directory ($(ls -A "$t/tmp"))" +[[ ! -e $stage/usr/sbin/i2cget ]] || fail "INITRAMFS_I2C_TOOLS: installed i2cget" +pass "bin/omamobile initramfs stops when i2c-tools fails, before unpacking it, and removes its scratch directory" + +initramfs cheetah musl-dev +stopped "musl sysroot" musl-dev +[[ ! -e $sysroot/marker-musl-dev ]] || fail "musl sysroot: unpacked a list from a failed fetch" +grep -c -F "no libc.a" "$t/log" >/dev/null && fail "musl sysroot: went on to check the sysroot" +pass "bin/omamobile initramfs stops when the sysroot's musl-dev fails, before unpacking it" + +# tools/dodge-chain pack, with stand-in stage 2 inputs +d=$t/dodge +dodge() { # [FETCH_FAIL_ON]: dodge-chain pack; the status in $status + rm -rf "$d" + mkdir -p "$d/chainload" "$d/kernel/scripts" "$d/stage2/arch/arm64/boot" "$d/dl" "$d/src" + printf '#!/bin/sh\n' > "$d/chainload/init" + : > "$d/chainload/stage2-dtb.py" + printf '#!/bin/sh\n' > "$d/kernel/scripts/config"; chmod 755 "$d/kernel/scripts/config" + echo stage2 > "$d/stage2/arch/arm64/boot/Image" + : > "$d/stage2/.config"; : > "$d/stage2.dtb"; : > "$d/initrd"; : > "$d/live.dtb" + cp "$t/minirootfs.tar.gz" "$d/dl/alpine-minirootfs-$(sed -n 's/^ALPINE_VER=//p' tools/dodge-chain)-aarch64.tar.gz" + : > "$t/fetched" + status=0 + FETCH_FAIL_ON=${1:-} CHAINLOAD_DIR=$d/chainload KERNEL_DIR=$d/kernel STAGE2_OUT=$d/stage2 \ + STAGE2_DTB_IN=$d/stage2.dtb STAGE2_INITRD=$d/initrd LIVE_DTB=$d/live.dtb ALPINE_DL=$d/dl SRC_DIR=$d/src \ + tools/dodge-chain pack > "$t/log" 2>&1 || status=$? +} +dodge +[[ -e $d/stage2/chain/chain/x/marker-busybox-static ]] || fail "dodge-chain: a successful fetch is unpacked" +grep -c -F "Alpine packages incomplete" "$t/log" >/dev/null || fail "dodge-chain: the stand-in pack stops at its package check" +pass "tools/dodge-chain pack unpacks the packages a successful fetch lists" + +dodge busybox-static +stopped "dodge-chain" busybox-static +[[ ! -e $d/stage2/chain/chain/x/marker-busybox-static ]] || fail "dodge-chain: unpacked a list from a failed fetch" +grep -c -F "Alpine packages incomplete" "$t/log" >/dev/null && fail "dodge-chain: went on to check the packages" +pass "tools/dodge-chain pack stops when busybox-static fails, before unpacking any" diff --git a/tools/dodge-chain b/tools/dodge-chain index c7d2c94d5..15c3c1ac7 100755 --- a/tools/dodge-chain +++ b/tools/dodge-chain @@ -187,7 +187,7 @@ cmd_pack() { if [[ -z $MKBOOTIMG_PY ]]; then command -v mkbootimg >/dev/null || die "no mkbootimg.py under $ROOT/system/tools/mkbootimg or $SRC_DIR/system/tools/mkbootimg, and no mkbootimg on PATH" fi - local work="$CHAIN_OUT/chain" dl="${ALPINE_DL:-$HOME/android/downloads/alpine}" apk + local work="$CHAIN_OUT/chain" dl="${ALPINE_DL:-$HOME/android/downloads/alpine}" apk apks mkdir -p "$work/x" "$CHAIN_OUT/images" "$dl" say "Stage 2 DTB (options: ${DTB_OPTS:-none})" @@ -208,8 +208,11 @@ cmd_pack() { || die "checksum mismatch for $tarball" rm -rf "$work/x" && mkdir -p "$work/x" tar -xzf "$dl/$tarball" -C "$work/x" - for apk in $(python3 -I "$ROOT/tools/alpine-fetch.py" "$ALPINE_VER" "$dl/apks" \ - busybox-static kexec-tools); do + # Read whole before it is used: `for apk in $(…)` loses alpine-fetch.py's + # exit status and unpacks what it printed + apks=$(python3 -I "$ROOT/tools/alpine-fetch.py" "$ALPINE_VER" "$dl/apks" busybox-static kexec-tools) || + die "tools/alpine-fetch.py failed for busybox-static and kexec-tools" + for apk in $apks; do tar -xzf "$apk" -C "$work/x" --exclude='.PKGINFO' --exclude='.SIGN.*' --exclude='.*.sh' \ 2>/dev/null || true done From 05a8b6638cc3b088b423ef5f2c0e0bc21f6ca1c2 Mon Sep 17 00:00:00 2001 From: Colin Lundholm <265166644+gitColinX@users.noreply.github.com> Date: Mon, 9 Nov 2026 08:52:04 -0700 Subject: [PATCH 30/66] device/husky: NOTES, a third phone (Samsung 128 GB, UFS 3.1, locked) (#552) * device/husky: NOTES, a third phone (Samsung 128 GB, UFS 3.1, locked) A third Pixel 8 Pro, offered in #1, recorded as Brett suggested for the second one: the read-only facts so far (getprop while booted and a locked fastboot getvar all), before any unlock. Same SKU, storage vendor and size and partition sizes as the first phone; bootloader, baseband and starting point (GrapheneOS, one slot unbootable) as on the second. Also noted: GrapheneOS cuts USB data while the phone is locked, so a reboot into it needs an unlock before adb comes back. No serial, IMEI or MACs. Co-Authored-By: Claude Opus 5.5 * device/husky: NOTES, third phone: the update inference marked, patch level From the review on #552: the clause about what a GrapheneOS update leaves behind is an inference, so it is marked [I] now, and it says which update (2026-11-06). And a line on the patch level: GrapheneOS's 2026-11-01 is newer than the 2026-10-05 our husky images carry, which the second phone (at 2026-10-05) never met; whether that matters once unlocked is not known. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- device/husky/NOTES.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/device/husky/NOTES.md b/device/husky/NOTES.md index 36010a1fa..24e28abff 100644 --- a/device/husky/NOTES.md +++ b/device/husky/NOTES.md @@ -10,6 +10,20 @@ Sources: - `P/`: postmarketOS pmaports `device/testing` (2026-10-21). - `G/`: Google's GPL kernel for this phone, `android-gs-shusky-6.1-android16` ([source.android.com: Build Pixel kernels](https://source.android.com/docs/setup/build/building-pixel-kernels)). +## 2026-11-08: a third phone: Samsung 128 GB, UFS 3.1, still locked + +A third retail Pixel 8 Pro, offered in [#1](https://github.com/derekross/omarchy-mobile/issues/1). `R3/` below means read-only queries of this phone (`adb shell getprop` while booted, `fastboot getvar all` on the locked bootloader), facts only, no serial, IMEI or MACs. Nothing has been unlocked, flashed or booted on it yet. + +- **Identity** [V] (R3/): `husky`, `hw-revision` `MP1.0`, SKU G1MNW, `ro.boot.dtbo_idx` 8, `secure-boot:PRODUCTION`. The SKU and the storage vendor and size are the first phone's. +- **Storage** [V] (R3/ getvar): `storage-vendor:SAMSUNG`, `storage-model:KLUDG4UHGC-B0E1`, `storage-capacity:128 GB`, `storage-protocol:3.1`, `storage-rev:3203`, `storage-power-mode:lanes=2 gear=4 mode=FAST hs_series=SERIES_B`. +- **Starting state** [V] (R3/): GrapheneOS `2026110201`, the security preview of `2026110200` (`CP3A.261005.005`, security patch 2026-11-01), bootloader locked with its own verified boot key (`verifiedbootstate` yellow). Current slot a with `slot-successful:a:yes`, and `slot-unbootable:b:yes`, `slot-fastboot-ok:b:no`, retry count 2 on both: the second phone's starting state with the slots swapped. That is probably what GrapheneOS's 2026-11-06 update left behind (Virtual A/B, once the update merged) [I]. Its updater reported "Device is up-to-date" before the reboot to the bootloader. +- **Patch level** [V] (R3/, `device.conf`): GrapheneOS's security patch, 2026-11-01, is newer than the 2026-10-05 our husky images carry (`AVB_SECURITY_PATCH=2026-10-05`, `OS_PATCH_LEVEL=2026-10`). The second phone started at 2026-10-05, the same as our images, so it didn't meet this. Whether booting the older patch level on slot B matters to the bootloader or Trusty once unlocked is not known [I]. +- **Bootloader and modem** [V] (R3/ getvar): `ripcurrent-17.0-15681527` and baseband `g5300i-260604-260807-B-16036236`, both as on the second phone; anti-rollback `ap-ar-ns`, `ap-ar-s`, `gsa-bl1-ar` and `gsa-fw-ar` all 3; `unlocked:no`, `off-mode-charge:1`. +- **Partitions** [V] (R3/ getvar): `boot`, `vendor_boot` and `vendor_kernel_boot` 64 MiB, `init_boot` 8 MiB, `dtbo` 16 MiB, `modem` 200 MiB, `efs` 64 MiB, `persist` 128 MiB, `super` 7.95 GiB and `userdata` 117,744,685,056 bytes, all as on the first phone. +- **OEM unlocking** [V]: allowed in Developer options (switched on, not greyed out). No SIM (`gsm.sim.state` `ABSENT`). +- **GrapheneOS cuts USB data while the phone is locked** [V]: after `fastboot reboot`, no USB device showed up on the host until the phone was unlocked with its PIN; adb was back at once after that. Expect to unlock it after each reboot into GrapheneOS. Which of its USB-C port settings does this was not checked [I]. +- **fastbootd** [V]: `fastboot reboot fastboot` on the locked phone reached fastbootd (`is-userspace:yes`), and `fastboot reboot` from there went back to GrapheneOS on slot a. + ## 2026-11-05: idle-state and power-domain overlays that reboot-looped the phone Lef's phone (Kioxia unit), slot B, while looking for the cause of a ~520 mA idle draw with the screen off. I tested two bring-up overlays; every kernel flashed with either of them reset the phone hard about 8 to 40 s after boot (no pstore, no panic text). My first note called the idle-state boot stable; it was not (the temperature log stopped after a minute and I had already flashed the next build). From 54a316ee1650b4c8f6ab535cbc015ecd068461b5 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 10:00:07 -0600 Subject: [PATCH 31/66] alpine-fetch: fail when a package or dependency isn't in the index (#290) alpine-fetch.py skipped any name it couldn't find in main or community with the same `continue` that skips the minirootfs packages, so a typo on the command line, or a dependency neither index provides, gave a partial package set and exit 0. It now collects every such name with the package that needs it and exits before downloading or printing anything. Two dependency forms the old parser got wrong would now fail or mislead, so they change with it: a `~` constraint (`d~2`) kept its suffix and was never found, and a conflict (`!x`) had its `!` stripped and was fetched as a requirement. The constraint is cut at any of `<>=~`, and conflicts are dropped from the requirements (enforcing them is not this change). tests/alpine-fetch runs the script against two synthetic APKINDEX archives through a stand-in urlopen that refuses every other URL: so: and /bin/sh providers, `>=` and `~` constraints and the second index resolve, conflicts and minirootfs packages are not downloaded, and a missing package, dependency or so: provider fails with nothing downloaded or printed. Against the old script the resolving case and all four refusals fail. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Derek Ross --- tests/all | 7 ++-- tests/alpine-fetch | 95 +++++++++++++++++++++++++++++++++++++++++++ tools/alpine-fetch.py | 26 ++++++++---- 3 files changed, 118 insertions(+), 10 deletions(-) create mode 100755 tests/alpine-fetch diff --git a/tests/all b/tests/all index e6b3102ed..fa3efaac9 100755 --- a/tests/all +++ b/tests/all @@ -23,8 +23,9 @@ # against stand-ins for docker and repo, tools/repo-publish --from-main's # copy of the prebuilt binaries into a fixture's publish tree, # tools/repo-publish's staging, tools/extract-vendor-firmware's output -# generations (made-up files, no factory image), and the callers of -# tools/alpine-fetch.py stopping when it fails. +# generations (made-up files, no factory image), the callers of +# tools/alpine-fetch.py stopping when it fails, and its dependency +# resolution against synthetic indexes. set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." for f in tools/install-phone tools/phone-provision tools/nv-backup tools/build-rootfs tools/build-packages tools/make-bundle \ @@ -41,7 +42,7 @@ sh -n device/flame/initramfs/build bash -n tools/build-flame-probe echo "ok - scripts parse" python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch; do echo "# $t" "$t" done diff --git a/tests/alpine-fetch b/tests/alpine-fetch new file mode 100755 index 000000000..32698cc13 --- /dev/null +++ b/tests/alpine-fetch @@ -0,0 +1,95 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# tools/alpine-fetch.py's dependency resolution (no network): the script runs +# against two synthetic APKINDEX archives served by a stand-in for urlopen +# that refuses any other URL. A package or dependency with no package or +# provider in either index must stop it before it downloads or prints +# anything; minirootfs packages, providers (so:, /bin/sh), version +# constraints and conflicts (!name) must not. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; } +pass() { printf 'ok - %s\n' "$1"; } +t=$(mktemp -d); trap '[[ -n ${KEEP:-} ]] || rm -rf "$t"' EXIT + +cat > "$t/run.py" <<'EOF' +import io, runpy, sys, tarfile, urllib.request + +script, log = sys.argv[1], sys.argv[2] +cdn = "https://dl-cdn.alpinelinux.org/alpine/v3.22" +index = { + "main": [ + dict(P="a", V="1-r0", D="so:libb.so.1 c>=1.0 d~2 musl /bin/sh !x !y e"), + dict(P="b", V="2-r0", p="so:libb.so.1=2"), + dict(P="c", V="1.1-r0"), + dict(P="d", V="2.3-r0"), + dict(P="x", V="1-r0"), + dict(P="busybox-binsh", V="1-r0", p="/bin/sh cmd:sh=1"), + dict(P="musl", V="1-r0"), + dict(P="needs-ghost", V="1-r0", D="c ghost"), + dict(P="needs-ghost-lib", V="1-r0", D="so:libghost.so.1"), + ], + "community": [dict(P="e", V="5-r0")], +} +urls = {} +for repo, entries in index.items(): + for e in entries: + size = len(e["P"]) + 100 + e["S"] = str(size) + urls[f"{cdn}/{repo}/aarch64/{e['P']}-{e['V']}.apk"] = b"\0" * size + data = ("\n\n".join("\n".join(f"{k}:{v}" for k, v in e.items()) for e in entries) + "\n").encode() + buf = io.BytesIO() + with tarfile.open(fileobj=buf, mode="w:gz") as tar: + info = tarfile.TarInfo("APKINDEX") + info.size = len(data) + tar.addfile(info, io.BytesIO(data)) + urls[f"{cdn}/{repo}/aarch64/APKINDEX.tar.gz"] = buf.getvalue() + +def urlopen(url): + with open(log, "a") as f: + print(url, file=f) + if url not in urls: + raise OSError(f"test: no network ({url})") + return io.BytesIO(urls[url]) + +urllib.request.urlopen = urlopen +sys.argv = [script, "3.22.1", *sys.argv[3:]] +runpy.run_path(script, run_name="__main__") +EOF + +# The packages; leaves stdout, stderr, the URLs and the status in $t +fetch() { + rm -rf "$t/apks"; : > "$t/urls" + status=0 + python3 -I "$t/run.py" tools/alpine-fetch.py "$t/urls" "$t/apks" "$@" > "$t/out" 2> "$t/err" || status=$? +} +downloads() { { grep -v APKINDEX "$t/urls" || true; } | sed 's,.*/,,' | sort | tr '\n' ' '; } + +fetch a +[[ $status == 0 ]] || { cat "$t/err"; fail "a resolves"; } +want="$t/apks/a-1-r0.apk $t/apks/b-2-r0.apk $t/apks/c-1.1-r0.apk $t/apks/d-2.3-r0.apk $t/apks/e-5-r0.apk" +what="a pulls b (so: provider), c (>=), d (~) and e (community)" +[[ $(tr '\n' ' ' < "$t/out") == "$want " ]] || { cat "$t/out"; fail "$what"; } +pass "$what" +[[ $(downloads) == "a-1-r0.apk b-2-r0.apk c-1.1-r0.apk d-2.3-r0.apk e-5-r0.apk " ]] || fail "a downloads exactly what it prints" +[[ $(stat -c %s "$t/apks/e-5-r0.apk") == 101 ]] || fail "e is written whole" +pass "minirootfs packages (musl, /bin/sh's busybox-binsh) are skipped, not downloaded" +pass "conflicts are not requirements: !x (in the index) is not downloaded, !y (not in it) does not fail" + +fetch musl +[[ $status == 0 && ! -s $t/out && -z $(downloads) ]] || { cat "$t/err"; fail "a minirootfs package resolves to nothing"; } +pass "a minirootfs package on the command line resolves to nothing" + +refuses() { # $1: what, $2: the message, then the packages + local what=$1 msg=$2; shift 2 + fetch "$@" + [[ $status != 0 ]] || fail "refuses $what" + grep -c -F -- "$msg" "$t/err" >/dev/null || { cat "$t/err"; fail "names what is missing for $what"; } + [[ ! -s $t/out ]] || { cat "$t/out"; fail "prints no paths for $what"; } + [[ -z $(downloads) ]] || fail "downloads nothing for $what ($(downloads))" + pass "refuses $what before downloading or printing anything" +} +refuses "a package no index has" "nope (needed by the command line)" a nope +refuses "a dependency no index has" "ghost (needed by needs-ghost)" needs-ghost +refuses "a so: dependency nothing provides" "so:libghost.so.1 (needed by needs-ghost-lib)" needs-ghost-lib +refuses "a conflict asked for on the command line" "!x (needed by the command line)" '!x' diff --git a/tools/alpine-fetch.py b/tools/alpine-fetch.py index 653696eee..15e965ef5 100644 --- a/tools/alpine-fetch.py +++ b/tools/alpine-fetch.py @@ -3,9 +3,11 @@ """Download Alpine aarch64 packages plus their dependencies, verifying checksums. Usage: alpine-fetch.py ... -Prints the paths of the downloaded .apk files. +Prints the paths of the downloaded .apk files. Exits, before downloading or +printing anything, if a package or a dependency has no package or provider in +either index. """ -import base64, hashlib, io, sys, tarfile, urllib.request +import base64, hashlib, io, re, sys, tarfile, urllib.request from pathlib import Path version, dest, wanted = sys.argv[1], Path(sys.argv[2]), sys.argv[3:] @@ -29,14 +31,24 @@ base = {"musl", "busybox", "busybox-binsh", "alpine-baselayout", "alpine-baselayout-data", "alpine-keys", "apk-tools", "ca-certificates-bundle", "libcrypto3", "libssl3", "ssl_client", "zlib", "scanelf", "musl-utils", "libc-utils", "alpine-release"} -todo, seen = list(wanted), set() + +def requirement(dep): + """The name a D: entry needs (version constraint dropped), or None for a conflict (!name).""" + return None if dep.startswith("!") else re.split(r"[<>=~]", dep, maxsplit=1)[0] + +todo, seen, missing = [(w, "the command line") for w in wanted], set(), set() while todo: - name = todo.pop() - name = provides.get(name, name).lstrip("!") - if name in seen or name in base or name not in pkgs: + name, needed_by = todo.pop() + name = provides.get(name, name) + if name in seen or name in base: + continue + if name not in pkgs: + missing.add(f"{name} (needed by {needed_by})") continue seen.add(name) - todo += [d.split("=")[0].split(">")[0].split("<")[0] for d in pkgs[name].get("D", "").split()] + todo += [(d, name) for d in map(requirement, pkgs[name].get("D", "").split()) if d] +if missing: + sys.exit("alpine-fetch: no package or provider in the index for " + ", ".join(sorted(missing))) for name in sorted(seen): p = pkgs[name] From 7494b8dbcf7a909a947e8961da5d0f1c13b699e5 Mon Sep 17 00:00:00 2001 From: Jeremy Joplin Date: Mon, 9 Nov 2026 09:01:15 -0700 Subject: [PATCH 32/66] omamobile-shell 0.2.108: Grok Bot fits the phone's screen (#542) * omamobile-shell 0.2.107: Grok Bot fits the phone's screen Grok Bot (grok-bot from [omarchy], x.ai's agent, an Electron app) sets a minimum window size of 512x520 (SAND_MIN_WINDOW_SIZE in its main process). The Pixel 7 Pro is 480 px wide in logical pixels, so the app laid itself out 512 px wide inside a 480 px window and ran off the right edge: the ends of messages, the header buttons and the composer's microphone were cut off. Chromium had the same problem and setup-user gives it --force-device-scale-factor=0.83. setup-user now does the same for Grok Bot, whose launcher reads ~/.config/grok-bot-flags.conf. The factor comes from the panel's mode (the DSI connector in /sys/class/drm) and the monitor scale setup-user seeds, so the layout gets about the 578 px Chromium gets on the 7 Pro: 0.83 on the 7 Pro (480 px), 0.70 on the 9a (405 px), 0.62 for a 1080 px panel at scale 3 (360 px), where 0.83 would leave 434 px, still under 512. With no readable mode it falls back to 0.83. Once, and a factor the user's file already has stays theirs. Tested on a Pixel 7 Pro (Omarchy 4.5.0-3, omamobile-shell 0.2.100): the factor by hand made the window fit (screenshots before and after); the new step, run alone on the phone against a scratch home, read 1440x3120 and wrote 0.83. test/setup-user.sh covers the 7 Pro, the 9a, a 1080x2400 panel, no mode, a user's own factor and two logins; its first new check fails against the old script. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TTVicoVA5YdXzobkXGujF9 * omamobile-shell 0.2.108: renumber above main's 0.2.107 (#420) --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: Derek Ross --- AGENTS.md | 1 + .../omamobile-shell/bin/omamobile-setup-user | 25 ++++++++++++ packages/omamobile-shell/test/setup-user.sh | 38 +++++++++++++++++-- packages/omamobile-shell/version | 2 +- 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 498c43883..8174b5699 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -207,6 +207,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - **`grep -q` under `set -o pipefail`:** `grep -q` exits early, SIGPIPEs the writer, and the pipeline fails on large input. Use `grep -c … >/dev/null`. - **Omarchy's Chromium launcher splits each line of `chromium-flags.conf` on spaces:** quote a flag whose value has spaces (`"--user-agent=…"`). - **Chromium needs `--force-device-scale-factor` on the phone,** even with the mobile user agent: its window layout won't go below about 500 px and the panel is 480 px wide in logical pixels, so without it the window runs off the right edge. Sites get phone layouts from the user agent. +- **Grok Bot needs it too** (`~/.config/grok-bot-flags.conf`, read by its launcher): it won't lay out narrower than 512 px. `omamobile-setup-user` picks the factor from the panel's mode so the layout is about 578 px wide (0.83 on the 7 Pro, 0.70 on the 9a). - **The screensaver runs in a terminal, so focusing it pops up the on-screen keyboard:** `patches/omarchy/0006-*` turns `org.gnome.desktop.a11y.applications screen-keyboard-enabled` off for the screensaver and back on afterwards (from an EXIT trap in the launcher, since omamobile-omarchy 0.1.9), and `omamobile-osk-guard` (omamobile-shell 0.2.19) turns it back on whenever it is off with no screensaver running. If the keyboard stops appearing, check that key first. - **Vendor chroots:** bootstrap binaries such as `servicemanager` use `/system/bin/bootstrap/linker64` as their interpreter. `extract-vendor-chroot` links it to the runtime APEX linker. Run the chroot by path, without `env chroot`. - **If a shell change doesn't show on a phone, check that `omamobile-setup-user.service` runs at login and that its marker exists.** The user unit re-links every `omamobile.*` plugin into `~/.config/omarchy/plugins/` at each login, so a package update reaches the user; it runs only if `~/.local/state/omarchy/done/omamobile-shell-profile` exists, which firstboot creates. On the 9a, whose user was set up during bring-up, the marker was missing, so the unit was skipped at every login, and two plugin links still pointed at hand copies (`omamobile.quicksettings` at a 2026-10-17 copy with no notification shade, `omamobile.switcher` at a 2026-10-22 copy) while four plugins weren't linked at all. Check with `systemctl --user status omamobile-setup-user` and `ls ~/.local/state/omarchy/done/`. Relink with the script's loop (`for p in /usr/share/omamobile/shell/plugins/omamobile.*; do ln -sfn "$p" ~/.config/omarchy/plugins/"${p##*/}"; done`), not the script: without its markers it would copy the package's `shell.json` over the user's and repeat every other once-only step, such as appending the cursor and keyboard lines to the Hyprland files again. [tegu NOTES](device/tegu/NOTES.md#2026-10-31-and-11-01-leftovers-on-the-palmtop-from-bring-up) diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 6d8bc308b..9d3b09421 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -337,6 +337,31 @@ if omarchy-done ensure omamobile-chromium-wayland-ime; then done fi +# Grok Bot, Omarchy's x.ai agent (Electron), won't lay out narrower than 512 +# px (SAND_MIN_WINDOW_SIZE in its main process), wider than a phone's logical +# width, so its window ran off the right edge as Chromium's did. Its launcher +# reads ~/.config/grok-bot-flags.conf. The scale factor there gives the 578 px +# of layout width Chromium gets on the 7 Pro (480 / 0.83): 0.83 there, 0.70 +# on the 9a (405 px), 0.62 at 360 px (a 1080 px panel at scale 3), and 0.83 +# when no panel mode can be read. Once; a factor the user's file already has +# stays theirs. +if omarchy-done ensure omamobile-grok-bot-fit; then + flags=~/.config/grok-bot-flags.conf + factor=0.83 mode= width=0 + for m in "${OMAMOBILE_DRM:-/sys/class/drm}"/card*-DSI-*/modes; do + if [[ -r $m ]]; then mode=$(sed -n 1p "$m"); break; fi + done + if [[ $mode =~ ^([0-9]+)x ]]; then + width=$((BASH_REMATCH[1] / 3)) # $scale, from the monitor step above + [[ $scale == '8 \/ 3' ]] && width=$((BASH_REMATCH[1] * 3 / 8)) + fi + if ((width > 0)); then + factor=$(awk -v w="$width" 'BEGIN { f = int(100 * w / 578) / 100; printf "%.2f", (f < 0.83 ? f : 0.83) }') + fi + grep -c -- '^--force-device-scale-factor=' "$flags" >/dev/null 2>&1 || + echo "--force-device-scale-factor=$factor" >>"$flags" +fi + # Style > Unlock picks the look of the disk-encryption unlock screen. The phone # has no encrypted disk, and the early boot logo follows the default theme, so # hide it through Omarchy's menu extension file (reused id + failing "when"). diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index f3d7748bb..86e93ed51 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -53,6 +53,14 @@ printf '[Desktop Entry]\nType=Application\nName=Papers\nExec=papers\n' >"$A/org. for b in gs201-cheetah:gs201 zumapro-tegu:zumapro; do mkdir -p "$t/dt-${b%%:*}"; printf 'google,%s\0google,%s\0' "${b%%:*}" "${b#*:}" >"$t/dt-${b%%:*}/compatible" done +# The panel's modes, from a fake /sys/class/drm: the 7 Pro's by default, the +# 9a's, a 1080x2400 panel, and none at all +for p in 1440x3120 1080x2424 1080x2400; do + mkdir -p "$t/drm-$p/card2-DSI-1" "$t/drm-$p/card2-DP-1" + printf '%s\n%s\n' "$p" "${p%x*}x$((${p#*x} / 2))" >"$t/drm-$p/card2-DSI-1/modes" + echo 3840x2160 >"$t/drm-$p/card2-DP-1/modes" # an external display isn't the panel +done +mkdir -p "$t/drm-none" # Omarchy's default-keyring step, as Omarchy ships it (only what's missing) mkdir -p "$t/omarchy/install/user" cat >"$t/omarchy/install/user/default-keyring.sh" <<'KR' @@ -61,7 +69,8 @@ d="$HOME/.local/share/keyrings"; mkdir -p "$d" KR run() { env -i HOME="${RUN_HOME:-$H}" PATH="$F:/usr/bin:/bin" XDG_RUNTIME_DIR="$t" OMAMOBILE_SHELL_SHARE="$pkg" OMAMOBILE_SYSTEM_APPLICATIONS="$A" \ - OMAMOBILE_DT="${RUN_DT:-$t/dt-gs201-cheetah}" OMAMOBILE_SQUEEKBOARD_SHARE="$pkg/squeekboard/keyboards" \ + OMAMOBILE_DT="${RUN_DT:-$t/dt-gs201-cheetah}" OMAMOBILE_DRM="${RUN_DRM:-$t/drm-1440x3120}" \ + OMAMOBILE_SQUEEKBOARD_SHARE="$pkg/squeekboard/keyboards" \ GSETTINGS_NO_CLICK_POLICY="${GSETTINGS_NO_CLICK_POLICY:-}" \ OMAMOBILE_VOICE_MODELS="${RUN_VOICE_MODELS:-$t/no-voice-models}" OMAMOBILE_VOXTYPE="${RUN_VOXTYPE:-voxtype}" \ OMARCHY_PATH="${RUN_OMARCHY_PATH:-$t/omarchy}" \ @@ -188,6 +197,10 @@ for flag in --enable-wayland-ime --wayland-text-input-version=3 --force-device-s [[ $(grep -cx -- "$flag" "$flags") == 1 ]] || fail "chromium-flags.conf has $flag once" done grep -c '^"--user-agent=.*Mobile Safari/537.36"$' "$flags" >/dev/null || fail "the mobile user agent stays quoted on its line" +# Grok Bot's flags: the 7 Pro's factor, once, after two logins +gflags=$H/.config/grok-bot-flags.conf +[[ $(grep -cx -- --force-device-scale-factor=0.83 "$gflags") == 1 ]] || fail "grok-bot-flags.conf has the 7 Pro's factor once" +[[ $(wc -l <"$gflags") == 1 ]] || fail "grok-bot-flags.conf holds only that" # An earlier user with their own values: a monitor scale of 2, their own # foot padding, multiplier and long press, and one of the flags already; @@ -197,6 +210,7 @@ cp "$H"/.config/hypr/{looknfeel,autostart}.lua "$h/.config/hypr/" printf 'local omarchy_gdk_scale = 2\nlocal omarchy_monitor_scale = 2\n' >"$h/.config/hypr/monitors.lua" touch "$h/.local/state/omarchy/done/omamobile-monitor-scale" printf -- '--enable-wayland-ime\n' >"$h/.config/chromium-flags.conf" +printf -- '--force-device-scale-factor=1\n--disable-gpu\n' >"$h/.config/grok-bot-flags.conf" RUN_HOME=$h run [[ ! -e $h/.local/state/omarchy/done/omamobile-foot-touch ]] || fail "the foot step waits for a foot.ini" mkdir -p "$h/.config/foot" @@ -208,17 +222,33 @@ cmp -s "$h/.config/foot/foot.ini" "$t/custom-foot.ini" || fail "a user's own foo [[ -e $h/.local/state/omarchy/done/omamobile-foot-touch ]] || fail "the foot step runs once foot.ini is there" [[ $(grep -cx -- --enable-wayland-ime "$h/.config/chromium-flags.conf") == 1 ]] || fail "a flag the user has isn't added twice" grep -cx -- --wayland-text-input-version=3 "$h/.config/chromium-flags.conf" >/dev/null || fail "the missing flag is added" -pass "GDK scale, foot and Chromium's input method, once each, and a user's own values are kept" +g=$h/.config/grok-bot-flags.conf +[[ $(grep -c -- '^--force-device-scale-factor=' "$g") == 1 ]] && grep -cx -- --force-device-scale-factor=1 "$g" >/dev/null \ + || fail "a user's own Grok Bot scale factor stays theirs" +[[ $(wc -l <"$g") == 2 ]] && grep -cx -- --disable-gpu "$g" >/dev/null || fail "Grok Bot's file keeps the user's other flags, unchanged" +pass "GDK scale, foot, Chromium's and Grok Bot's flags, once each, and a user's own values are kept" # The Pixel 9a: a new user gets 8 / 3 (405x909 logical), and GDK_SCALE stays # Omarchy's 2 (its step only follows a monitor scale of exactly 3) h9=$t/tegu; mkdir -p "$h9/.config/hypr" "$h9/.config/omarchy/extensions" cp "$H"/.config/hypr/{looknfeel,autostart}.lua "$h9/.config/hypr/" printf 'local omarchy_gdk_scale = 2\nlocal omarchy_monitor_scale = "auto"\n' >"$h9/.config/hypr/monitors.lua" -RUN_HOME=$h9 RUN_DT=$t/dt-zumapro-tegu run +RUN_HOME=$h9 RUN_DT=$t/dt-zumapro-tegu RUN_DRM=$t/drm-1080x2424 run grep -cx 'local omarchy_monitor_scale = 8 / 3' "$h9/.config/hypr/monitors.lua" >/dev/null || fail "the 9a's monitor scale is 8 / 3" grep -cx 'local omarchy_gdk_scale = 2' "$h9/.config/hypr/monitors.lua" >/dev/null || fail "the 9a's GDK_SCALE step is skipped" -pass "the Pixel 9a's scale: 8 / 3, GDK_SCALE left at 2" +grep -cx -- --force-device-scale-factor=0.70 "$h9/.config/grok-bot-flags.conf" >/dev/null || fail "Grok Bot's factor on the 9a (405 px) is 0.70" +pass "the Pixel 9a's scale: 8 / 3, GDK_SCALE left at 2, Grok Bot at 0.70" + +# Grok Bot's factor follows the panel: 0.62 for a 1080 px panel at scale 3 +# (360 px), and 0.83 when no panel mode can be read +for c in 1080x2400:0.62 none:0.83; do + hg=$t/grok-${c%%:*}; mkdir -p "$hg/.config/hypr" "$hg/.config/omarchy/extensions" + cp "$H"/.config/hypr/{looknfeel,autostart,monitors}.lua "$hg/.config/hypr/" + RUN_HOME=$hg RUN_DRM=$t/drm-${c%%:*} run + grep -cx -- "--force-device-scale-factor=${c#*:}" "$hg/.config/grok-bot-flags.conf" >/dev/null \ + || fail "Grok Bot's factor with panel ${c%%:*} is ${c#*:}" +done +pass "Grok Bot's scale factor gives about 578 px of layout width on any panel" # Voxtype (phase 3): base.en stays the model, and Whisper's context is cut to # the clip (context_window_optimization) once; 0.2.58-0.2.62's tiny.en is diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 924e96608..aa7ceeb16 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.107 +0.2.108 From 9e9ae703c10517286a42f0c81d2d6d8d24c5d39b Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Mon, 9 Nov 2026 09:15:30 -0700 Subject: [PATCH 33/66] omamobile-telephony-tegu 0.1.0: Phone and Messages on the Pixel 9a through omamobile-mmd (#371) * tegu: plan Phone and Messages integration through mmd Trace the existing app, session agent, ModemManager-compatible bridge and sitd path. Record the tegu installation and unit prerequisites still missing on main, and an attended bridge-only test that preserves the running modem stack. Document the passing offline bridge and apps package suites, activation and audio limits, and the eventual board-specific image integration. * tegu: attach Phone and Messages to an attended running sitd Keep sitd's canonical name while moving the modem dependency into device-owned policy drop-ins. Tegu checks an already running modem and CP ONLINE; cheetah and raven retain their existing starter relationship. Require the device policy capability during RIL upgrades. Add an opt-in telephony package with a bridge policy and attended helper. It checks live sitd readiness, refuses legacy unit shadows and competing managers, and starts only mmd and the graphical user's agent. The service recovery check permits live calls and registration loss; no helper enables or recovers the modem. Remove mmd's service-level conflict so a bridge start cannot stop another modem manager. Package exclusion and D-Bus name ownership remain. Retain the previously developed SIM, safe-release and audio changes in this stack. Validate the helper, dependency policies and composed units offline; run all seven affected/dependency package suites and build the new architecture-independent package without installing dependencies. * device/tegu TELEPHONY-APPS-PLAN: the 2026-11-02 run, the two ways to start the bridge, and a plan that reads as one Record the palmtop run of Phone and Messages (kernel, versions, what passed, and that opening an app didn't start the agent), say which start fits which case, cite #363 instead of a branch, and drop the lines that read like a task report. * TELEPHONY-APPS-PLAN, omamobile-telephony-tegu: mmd's Conflicts= goes in 0.1.3, with this pull request The plan and the README dated the removal of the unit's Conflicts=ModemManager.service to mmd 0.1.1, and the bullet above still listed it as built; this pull request is what removes it, in 0.1.3. * omamobile-telephony-tegu: the bridge's service check accepts its own WantedBy and tmp.mount, and a refusal isn't retried With #372's boot unit on and this package installed, the bridge's ExecStartPre refused every start: sitd wanted omamobile-mmd.service (the bridge's own WantedBy, once enabled) and both units wanted tmp.mount (systemd adds it). Neither pulls the RIL or the CP into a start, so both are allowed now. A refusal of --service-check exits 3, which the drop-in names in RestartPreventExitStatus=, so a refused bridge stays down instead of retrying every five seconds. * omamobile-telephony-tegu: the bridge's service check is an ExecCondition RestartPreventExitStatus= applies only to the main process, so an ExecStartPre= that refused with exit 3 was still restarted every RestartSec under Restart=on-failure. As an ExecCondition=, a refusal (any exit from 1 to 254) skips the start without a retry and without marking the bridge failed. Checked on systemd 262: ExecStartPre exiting 3 with RestartPreventExitStatus=3 restarted five times, ExecCondition exiting 3 skipped the start once. * omamobile-device-cheetah 0.1.48, device-tegu 0.2.10, modem-sit 0.3.32: versions past main after the rebase The rebase onto main dropped the two commits main already had and left these three packages changed without a version above main's. * omamobile-telephony-tegu: depend on the device-tegu that lands with it (0.2.10) * omamobile-telephony-tegu: the dependency test reads device-tegu>=0.2.10 too --------- Co-authored-by: Derek Ross --- device/tegu/TELEPHONY-APPS-PLAN.md | 202 ++++++++++++ docs/TELEPHONY-APPS-PLAN.md | 5 +- packages/omamobile-device-cheetah/PKGBUILD | 2 +- packages/omamobile-device-cheetah/test/all | 6 + .../10-device-modem.conf | 5 + packages/omamobile-device-cheetah/version | 2 +- packages/omamobile-device-raven/PKGBUILD | 2 +- packages/omamobile-device-raven/test/all | 4 + .../10-device-modem.conf | 5 + packages/omamobile-device-raven/version | 2 +- packages/omamobile-device-tegu/PKGBUILD | 3 +- packages/omamobile-device-tegu/README.md | 15 + packages/omamobile-device-tegu/test/all | 4 + .../10-tegu-no-start.conf | 4 + .../10-device-modem.conf | 10 + packages/omamobile-device-tegu/version | 2 +- .../systemd/omamobile-mmd.service | 3 +- packages/omamobile-mmd/test/all | 3 +- packages/omamobile-mmd/version | 2 +- packages/omamobile-modem-sit/PKGBUILD | 2 +- .../systemd/omamobile-sitd.service | 5 +- packages/omamobile-modem-sit/test/all | 3 + packages/omamobile-modem-sit/version | 2 +- packages/omamobile-telephony-tegu/LICENSE | 21 ++ packages/omamobile-telephony-tegu/PKGBUILD | 19 ++ packages/omamobile-telephony-tegu/README.md | 127 +++++++ .../bin/omamobile-tegu-mmd-attach | 207 ++++++++++++ packages/omamobile-telephony-tegu/install | 12 + .../omamobile-telephony-tegu.install | 11 + .../systemd/10-tegu-attach.conf | 9 + packages/omamobile-telephony-tegu/test/all | 30 ++ .../test/test_attach.py | 312 ++++++++++++++++++ .../test/test_units.py | 51 +++ packages/omamobile-telephony-tegu/version | 1 + 34 files changed, 1078 insertions(+), 15 deletions(-) create mode 100644 device/tegu/TELEPHONY-APPS-PLAN.md create mode 100644 packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf create mode 100644 packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf create mode 100644 packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf create mode 100644 packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf create mode 100644 packages/omamobile-telephony-tegu/LICENSE create mode 100644 packages/omamobile-telephony-tegu/PKGBUILD create mode 100644 packages/omamobile-telephony-tegu/README.md create mode 100755 packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach create mode 100755 packages/omamobile-telephony-tegu/install create mode 100644 packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install create mode 100644 packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf create mode 100755 packages/omamobile-telephony-tegu/test/all create mode 100644 packages/omamobile-telephony-tegu/test/test_attach.py create mode 100644 packages/omamobile-telephony-tegu/test/test_units.py create mode 100644 packages/omamobile-telephony-tegu/version diff --git a/device/tegu/TELEPHONY-APPS-PLAN.md b/device/tegu/TELEPHONY-APPS-PLAN.md new file mode 100644 index 000000000..074335381 --- /dev/null +++ b/device/tegu/TELEPHONY-APPS-PLAN.md @@ -0,0 +1,202 @@ + +# Pixel 9a: connect Phone and Messages to sitd + +Status (2026-11-03): Phone and Messages ran on the palmtop on 2026-11-02 +through this path (results at the end). The optional +`omamobile-telephony-tegu` package installs mmd, the agent, an active-RIL +bridge policy and `omamobile-tegu-mmd-attach --check|--attach`, and enables +nothing. sitd's unit gets its modem dependency from a device-owned drop-in: +tegu uses Requisite on its already running starter, while cheetah and raven +keep Requires on their modem unit, and the virtual `omamobile-sitd-policy` +makes the drop-ins come along with a RIL upgrade. It builds on #363 (the +device modem policy). [Package/runbook](../../packages/omamobile-telephony-tegu/README.md). + +Two ways start the bridge, each for its own case: at boot, #372's opt-in +`omamobile-tegu-modem-boot` starts the modem, sitd and mmd once the CP is +ONLINE (daily use); and `omamobile-tegu-mmd-attach --attach` attaches mmd +and the agent to a modem and sitd already started by hand (bring-up and +tests, where nothing should start the modem for you). The helper refuses +when sitd isn't running and never starts the modem itself. + +Offline: the seven affected package suites pass, the attach package has 21 +tests (including systemd verification of all three device policies), and +the architecture-independent package builds with makepkg. One bridge API +comparison skips when ModemManager's reference XML is missing. + +The sections below are the investigation this started from, on `origin/main` +at `31fbcf9`, before #363 and the attach package. The owner then had texts +both ways and calls through `omamobile-sit`; this was the plan for the apps +on top. + +The app protocol already exists. The immediate missing layer in the +recorded tegu setup is `omamobile-mmd`, installed and running. A normal +package install is blocked by the cheetah-only dependency still on main; +sitd's packaged modem-unit dependency also needs the tegu startup work. +Those are existing, separate changes. Do not duplicate them or install +with dependency checks disabled. The first app test can use an already +running, attended sitd; it need not wait for modem startup at boot. + +## The existing path + +```text +Phone / Messages + | session bus: org.omamobile.Phone1, org.omamobile.Messages1 +omatel-agent (the logged-in user's service) + | system bus: org.freedesktop.ModemManager1 +omamobile-mmd (root, ModemManager-compatible API) + | /run/omamobile-sit/socket: JSON requests and status subscription +omamobile-sitd (the only owner of the modem channels) + | SIT / AT +modem +``` + +| Layer | What the repository already supplies | +| --- | --- | +| Apps | `omamobile-apps` depends on `omaphone` and `omamessages`; both pull in `omatel-agent`. Contacts is supplied with Phone and does not need a modem. #361 puts all three packages in the image. | +| Agent | `packages/omatel` packages the agent, its user unit and both session-bus activation files. Its session-bus activation files are meant to start it when an app opens; on the palmtop that didn't happen (results below), and the user unit had to be started and enabled. The disabled user unit is intentional; no root agent and no generic enablement change are needed. | +| Bridge | `packages/omamobile-mmd` owns the system-bus name normally used by ModemManager, exports modem/call/SMS objects, and checks polkit for operations. It conflicts with the real `modemmanager`; installing both is not the solution. | +| Commands | `Voice.CreateCall` plus `Call.Start` maps to sitd `dial`; `Accept`, `Hangup` and `SendDtmf` map to sitd requests. `Messaging.Create` plus `Sms.Send` maps to `sms-send` with a durable request ID. | +| Incoming events | The bridge subscribes to sitd, exports calls, reads `sms-list`, and maps deletion to `sms-delete`. The agent stores SMS before deleting them from the bridge and handles notifications and call history. | +| Privileges | Apps and agent use D-Bus. Only the bridge needs sitd's private socket. Keep socket permissions and the current polkit policy; no wheel-group workaround is needed for app access. | + +Sources: [app package](../../packages/omamobile-apps/PKGBUILD), +[agent packaging and activation](../../packages/omatel/README.md), +[bridge mappings](../../packages/omamobile-mmd/lib/bridge.py), +[socket subscription](../../packages/omamobile-mmd/lib/sitd_link.py), and +[the shared telephony plan](../../docs/TELEPHONY-APPS-PLAN.md), especially +sections 1.5 and 10.1b. + +Contacts uses the shared local vCard address book; it does not need a modem +or an additional cellular service. + +## What tegu is missing + +1. **A dependency-correct install.** `omamobile-mmd` depends on + `omamobile-modem-sit`, which depends on `omamobile-modem`, which still + depends on `omamobile-device-cheetah`. That conflicts with tegu's device + package. #363 (merged) replaces that last dependency with the virtual + `omamobile-modem-policy` and adds tegu's provider. +2. **The bridge package and its start.** The common rootfs list deliberately + omits mmd and modem-sit. Tegu's `ROOTFS_PACKAGES` does not include them. + `omamobile-mmd.service` ships disabled, has no D-Bus activation file, + and its installer creates no wants link. Merely opening an app cannot + start it. The recorded SIM runbook says mmd was not installed; current + hardware state must be checked by the human rather than inferred here. +3. **The right modem service for later automatic integration.** The shipped + `omamobile-sitd.service` requires `omamobile-modem.service`; the recorded + tegu run uses its own starter and an `/etc` copy of sitd's unit that + removes this dependency. A bridge-only test must retain the already + qualified, running stack. Do not start or restart the stock sitd unit + to attach the bridge. Package tegu's starter/order separately before + making this an image default. +4. **The tested tegu RIL and release safety.** Main still carries the older + RIL; use the independently reviewed tegu SIM fixes and safe unconfirmed + call-release behavior. Do not replace a running test RIL as part of + installing the bridge. An unconfirmed hang-up must not stop the tegu + modem in place. Call audio remains its separate route/qualification. + +There is no evidence that SMS needs an mmd APN, a tegu-specific socket +path, an extra bridge SMS transport, or a second modem daemon. The bridge +forwards SMS through sitd; sitd chooses the transport. Its modem state is +based on SIM/radio/registration and can be REGISTERED without a data bearer. +The hard-coded MM model string `Exynos Modem 5300` is misleading on tegu, +but is display metadata, not a routing selector or a reason to block SMS. + +## The smallest durable changes after the prerequisites + +- Keep `omamobile-apps` modem-independent, as #361 intends. Do not make all + images depend on the modem stack to get Phone or Contacts. +- After tegu's packaged modem start is qualified, add mmd and modem-sit to + tegu's board package list (and its packaged descriptor copy), with a + test that the descriptors agree and resolve against tegu's policy + provider without installing the cheetah device package. +- Enable only the bridge's existing relationship to sitd: + `systemctl enable omamobile-mmd.service` creates + `omamobile-sitd.service.wants/omamobile-mmd.service`. This follows a sitd + start without enabling sitd or starting the CP. Tegu's setup can do this + conditionally when mmd is installed; it need not use `--now`. +- Preserve mmd's one-way relationship: `After=omamobile-sitd.service`, no + `Requires=`, `Wants=` or activation path from the bridge to sitd or the + CP. An app opening or a bridge restart must never power the modem on. +- Test the conditional enablement with a fake systemctl, absent-package + handling, and a scratch unit root. Starting the bridge alone must not + request a CP start; starting qualified sitd must pull in the bridge. + +For the already running palmtop, the manual steps below are enough once +package dependencies are correct. The durable boot/image changes are not +prerequisites for that test. + +## Attended first test (ran on 2026-11-02) + +Keep the existing modem sleep inhibitor throughout; suspend with the CP on +is not qualified by this work. Keep the existing once-per-boot start and +NV checks. No step below starts, stops or restarts the CP or sitd. +Run user commands in the existing graphical user's terminal, root commands +in the attended administrative session. + +| Step / risk | Commands or action | Expect / pass | Stop condition | Rollback | +| --- | --- | --- | --- | --- | +| 1. Read-only / none | `uname -r`; `pacman -Q omaphone omamessages omatel-agent omamobile-mmd omamobile-modem-sit omamobile-modem`; `systemctl is-active omamobile-sitd omamobile-mmd ModemManager`; `systemctl cat omamobile-sitd`; `systemd-inhibit --list` | Record kernel/package versions, actual sitd unit, active inhibitor and existing running sitd. Missing bridge is expected initially. | No confirmed running sitd, wrong starter, competing ModemManager, or no inhibitor. | None; end this session without starting the modem. | +| 2. Install bridge / low | First review `pacman -Sp --print-format '%n %v' omamobile-mmd`. After the dependency fix is available, `pacman -S omamobile-mmd`, only if the transaction adds the bridge/dependencies without changing the running RIL, modem or device package. | No cheetah package, no tegu removal, no modem/RIL upgrade, and nothing starts the CP. | Resolver conflict or any unexpected upgrade/removal. Never use `-dd`. | Cancel before accepting the transaction; if installed, remove only the bridge after stopping it. | +| 3. Start bridge / low | Root: `systemctl start omamobile-mmd.service`; `busctl --system list --no-pager org.freedesktop.ModemManager1`; use `packages/omamobile-mmd/test/libmm-status.py` for states only. | Bus name owned by mmd, a modem object with SIM ready and expected registration; sitd/CP remain the same running instances. | Bridge cannot own the name/connect; sitd exits; hardware warning. | `systemctl stop omamobile-mmd.service`. Do not restart sitd or stop the modem. | +| 4. Agent and apps / low, screen changes | Announce first, then open Phone and Messages as the session user. `systemctl --user is-active omatel-agent`; `busctl --user list --no-pager org.omamobile.Phone1 org.omamobile.Messages1`. | Agent activates, apps see the modem instead of no-modem; Contacts opens without requiring a live modem. | Activation or authorization error. Do not weaken polkit/socket permissions. | Close apps; stop the user agent if it was started only for this test; stop mmd. | +| 5. SMS / carrier charge possible | Human sends one agreed test text in Messages, then sends one back from the other device; reopen the conversation. | One send, one received message, preserved after closing/reopening; no duplicate send on retry/reconnect. | Duplicate, uncertain delivery, or missing inbound text. Do not retry an uncertain send automatically. | Stop testing and stop the bridge; keep private message stores for diagnosis. | +| 6. Calls / medium, screen and sound | Only after the separate safe-release and call-audio checks: announce, place one ordinary agreed call from Phone, receive one, answer/decline and hang up. | UI state follows the call, release is confirmed, and the approved audio route behaves as qualified separately. | Unconfirmed release, unexpected audio level, CP/AoC/UFS fault. No emergency-number test. | Follow the attended safe-release runbook; no modem stop or second start. A reboot needs separate approval. | +| 7. Optional persistence / low | After passing, root: `systemctl enable omamobile-mmd.service` without `--now`. Inspect the resulting sitd wants link. | Bridge follows future *approved* sitd starts; sitd and modem remain disabled at boot. | Any change enabling the modem or sitd itself. | Disable only mmd if this step enabled it, then stop mmd if ending the test. | + +SMS/call numbers, contents, operator identities and object dumps remain +private. Record only states, counts, errors and test outcomes in this plan. +The read-only libmm status helper deliberately prints states and counts. + +A session that has never opened either app needs an additional activation +check before claiming always-on incoming notifications. The shell's call +watcher checks whether the agent owns its name and does not itself start +it. For this first test, open an app before arranging incoming traffic. +Keep #361's app-triggered activation policy until cold-session reception +has a separate test and an explicit decision about login activation. + +App mute/speaker controls are also separate: the shared plan records that +the agent uses callaudiod for those, while sitd owns its own voice PCMs. +A successful dial through mmd does not prove those controls affect tegu's +route. MMS and mobile-data control through ModemManager are outside this +SMS/basic-call integration; keep the existing sitd data ownership. + +## Offline evidence + +`packages/omamobile-mmd/test/all` passed on this base with private D-Bus +and local simulator sockets. This covers API/bridge/libmm clients, the +real sitd-to-sit-sim call and SMS chain, and staged unit checks. One test +was skipped because ModemManager's reference introspection XML is absent. +The suite verifies that the bridge has no unit dependency that pulls in +the modem and no system-bus activation file. + +`packages/omamobile-apps/test/all` also passed all 12 checks, including +Phone/Messages dependencies and the absence of a common modem dependency. + +This does not run the packaged Rust agent or either GUI, does not test +tegu hardware or the current private carrier configuration, and does not +qualify polkit for the actual graphical session. The earlier full agent +chain result is recorded in the shared plan; it was not rerun here. + +## Results on the palmtop, 2026-11-02 + +The daily kernel (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`), +the modem started by hand and sitd running (built from this stack, 0.3.12 +at the time), `omamobile-mmd` 0.1.0 started with `systemctl start`. + +- Steps 1 to 3 passed: the bridge owned `org.freedesktop.ModemManager1` + and exported the modem with the SIM ready; sitd and the CP stayed the + same running instances. +- Step 4: opening Messages did *not* start the agent, and it showed + "service isn't running" until `systemctl --user enable --now + omatel-agent`. After that both apps saw the modem. Cold-session + activation stays open, as above. +- Step 5: texts both ways from Messages, with no duplicate. +- Step 6: calls out from Phone and in, with speakerphone audio (#367), + released cleanly. +- The status bar showed airplane mode until sitd mapped radio state 10 to + on (now on main with #381). + +A `tools/phone-smoke` report from the palmtop is still to come, with the +next run. + diff --git a/docs/TELEPHONY-APPS-PLAN.md b/docs/TELEPHONY-APPS-PLAN.md index 164c0305d..1e4011606 100644 --- a/docs/TELEPHONY-APPS-PLAN.md +++ b/docs/TELEPHONY-APPS-PLAN.md @@ -134,7 +134,7 @@ shell status / quick settings ──────────────── └─ AoC voice PCMs (EP5/EP4), rmnet0 ``` -- **Why a separate process.** `omamobile-sitd` holds the safety model: the allow-list, the do-not-send list, durable SMS sends that never repeat, and power-off when a hangup isn't confirmed. Keeping D-Bus out of it keeps that code small and keeps its tests (`tools/sit-sim`) as they are. A crash in the bridge can't drop a call, and the bridge can restart freely, which the RIL can't (a second start-up on the same CP isn't supported). +- **Why a separate process.** `omamobile-sitd` holds the safety model: the allow-list, the do-not-send list, durable SMS sends that never repeat, and radio-off recovery for unconfirmed call release. Keeping D-Bus out of it keeps that code small and keeps its tests (`tools/sit-sim`) as they are. A crash in the bridge can't drop a call, and the bridge can restart freely, which the RIL can't (a second start-up on the same CP isn't supported). - **Why Python, with dbus-fast.** This differs from the apps, and it is Q3. The RIL is Python, and ofono2mm shows that Python with dbus-fast carries MM's whole API. The bridge is a translation layer with no performance load, and the same team reads both sides. Read Droidian's BSD-3-Clause original for structure (compatible with our MIT tree), and FuriLabs' GPL-2.0 fork for reference only. Rust with zbus is the alternative if the owner wants one language for everything new. It would add a toolchain to the system side, and the apps wouldn't share code with it anyway, since they use MM's public API. - **Changes to `omamobile-sitd`'s socket API** (T0, offline, against `tools/sit-sim`): - `subscribe`: a long-lived connection that receives one JSON event per change, with call, SMS, registration, signal and SIM events. The bridge then doesn't poll `state.json`. @@ -143,7 +143,8 @@ shell status / quick settings ──────────────── - Received SMS handed over by ID: the bridge exports each one as an `Sms` object, and a client's `Messaging.Delete` deletes it in sitd's store. That is Chatty's pattern: it copies each message into its own database and deletes it from the modem. - **Packaging, as built (T1, `packages/omamobile-mmd` 0.1.0; [MODEM-PLAN](../device/cheetah/MODEM-PLAN.md) "T0/T1: the ModemManager bridge"):** - Its own package, `omamobile-mmd`, with `conflicts=(modemmanager)` and **no `provides=`**: nothing in Arch or Arch Linux ARM hard-depends on `modemmanager` (gnome-calls, chatty, networkmanager and geoclue need only libmm-glib; mmsd-tng is AUR-only and also needs only libmm-glib). - - It ships `omamobile-mmd.service`, not `ModemManager.service`, with no `dbus-org.freedesktop.ModemManager1.service` alias: `Type=dbus`, `BusName=org.freedesktop.ModemManager1`, `Conflicts=ModemManager.service`, `WantedBy=omamobile-sitd.service`, and not enabled by the package. It also ships the D-Bus bus policy (only root owns the name) and MM's polkit actions. + - It ships `omamobile-mmd.service`, not `ModemManager.service`, with no `dbus-org.freedesktop.ModemManager1.service` alias: `Type=dbus`, `BusName=org.freedesktop.ModemManager1`, `WantedBy=omamobile-sitd.service`, and not enabled by the package (up to mmd 0.1.2 it also had `Conflicts=ModemManager.service`). It also ships the D-Bus bus policy (only root owns the name) and MM's polkit actions. + - From mmd 0.1.3 (#371), the unit has no `Conflicts=ModemManager.service`: starting the bridge must not stop another modem daemon. Package conflicts and exclusive D-Bus name ownership still provide exclusion. The optional tegu integration adds Requisite on an already active sitd, a read-only service check, and an attended attachment helper; it enables neither modem nor RIL. - **No D-Bus activation file**, so no client can start the bridge. Enabled, it starts with `omamobile-sitd`. - No `mmcli` and no CLI of our own. Phone runbooks read the modem through libmm-glib with `test/libmm-status.py`; mmcli runs only in the conformance container (`test/conformance`). - **Packaging, superseded (the design before T1, kept for history; not built):** a package named `omamobile-mm` with `provides=(modemmanager)` and `conflicts=(modemmanager)`, shipping `ModemManager.service` aliased `dbus-org.freedesktop.ModemManager1.service`, the bus policy, a D-Bus activation file, and `mmcli` or a small `omamobile-mm-cli`. T1 dropped `provides=` (no package needs it), the activation file (so no client can start the bridge) and the takeover of ModemManager's unit name. diff --git a/packages/omamobile-device-cheetah/PKGBUILD b/packages/omamobile-device-cheetah/PKGBUILD index 932d52227..1c8f5d065 100644 --- a/packages/omamobile-device-cheetah/PKGBUILD +++ b/packages/omamobile-device-cheetah/PKGBUILD @@ -9,7 +9,7 @@ url="https://github.com/derekross/omarchy-mobile" license=(MIT Apache-2.0) depends=(bash systemd util-linux omamobile-keyring i2c-tools) # Keep CPIF and its link driver behind the modem's guarded startup. -provides=(omamobile-modem-policy) +provides=(omamobile-modem-policy omamobile-sitd-policy) backup=(etc/pacman.d/omamobile-mirrorlist) install=omamobile-device-cheetah.install optdepends=('omamobile-boot-update: writes kernel package updates to slot B from the boot files this package ships') diff --git a/packages/omamobile-device-cheetah/test/all b/packages/omamobile-device-cheetah/test/all index fba7eb760..12cd88a82 100755 --- a/packages/omamobile-device-cheetah/test/all +++ b/packages/omamobile-device-cheetah/test/all @@ -182,3 +182,9 @@ if [[ -f ../omamobile-modem/systemd/omamobile-modem-boot.target ]]; then || fail "the modem unit the link turns on is skipped on a phone that isn't provisioned" fi pass "sitd waits for the CP; the modem stack is on by default through the target's vendor link; sit-data needs the modem's port" + +# The canonical sitd unit gets its modem dependency from this device policy. +[[ -f $tmp/root/usr/lib/systemd/system/omamobile-sitd.service.d/10-device-modem.conf ]] \ + || fail "the device sitd policy is staged" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the package provides its sitd policy capability" +pass "the device sitd policy is staged and provided" diff --git a/packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf b/packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf new file mode 100644 index 000000000..bfa4628f3 --- /dev/null +++ b/packages/omamobile-device-cheetah/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Preserve this device's modem-start dependency for the canonical sitd unit. +[Unit] +Requires=omamobile-modem.service +After=omamobile-modem.service diff --git a/packages/omamobile-device-cheetah/version b/packages/omamobile-device-cheetah/version index 9506d143f..5946febf1 100644 --- a/packages/omamobile-device-cheetah/version +++ b/packages/omamobile-device-cheetah/version @@ -1 +1 @@ -0.1.47 +0.1.48 diff --git a/packages/omamobile-device-raven/PKGBUILD b/packages/omamobile-device-raven/PKGBUILD index 5f698f0b0..0153bf58d 100644 --- a/packages/omamobile-device-raven/PKGBUILD +++ b/packages/omamobile-device-raven/PKGBUILD @@ -8,7 +8,7 @@ url="https://github.com/derekross/omarchy-mobile" license=(MIT Apache-2.0) depends=(bash iproute2 jq systemd util-linux i2c-tools 'omamobile-audio>=0.5.15') # The modem's drivers stay blacklisted until its runtime loads them -provides=(omamobile-modem-policy) +provides=(omamobile-modem-policy omamobile-sitd-policy) # The [omamobile] entry in pacman.conf and its mirror list, as cheetah's # package does (rootfs/pacman.conf includes the mirror list). backup=(etc/pacman.d/omamobile-mirrorlist) diff --git a/packages/omamobile-device-raven/test/all b/packages/omamobile-device-raven/test/all index 0f3332569..07cb77cf1 100755 --- a/packages/omamobile-device-raven/test/all +++ b/packages/omamobile-device-raven/test/all @@ -69,6 +69,10 @@ done [[ $(readlink "$tmp/root/usr/lib/systemd/system-sleep/omamobile") == /usr/bin/omamobile-sleep ]] \ || fail "the sleep hook is linked into system-sleep" [ ! -e "$tmp/root/usr/bin/omamobile-sleepd" ] || fail "the sleep watcher is omamobile-shell's, not this package's" +# The canonical sitd unit gets its modem dependency from this device policy. +[[ -f $tmp/root/usr/lib/systemd/system/omamobile-sitd.service.d/10-device-modem.conf ]] \ + || fail "the device sitd policy is staged" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the package provides its sitd policy capability" pass "install stages the package" # omamobile-wlan-mac only ever sets a unicast, globally administered address diff --git a/packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf b/packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf new file mode 100644 index 000000000..bfa4628f3 --- /dev/null +++ b/packages/omamobile-device-raven/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT +# Preserve this device's modem-start dependency for the canonical sitd unit. +[Unit] +Requires=omamobile-modem.service +After=omamobile-modem.service diff --git a/packages/omamobile-device-raven/version b/packages/omamobile-device-raven/version index 28d007539..50140e353 100644 --- a/packages/omamobile-device-raven/version +++ b/packages/omamobile-device-raven/version @@ -1 +1 @@ -0.1.32 +0.1.33 diff --git a/packages/omamobile-device-tegu/PKGBUILD b/packages/omamobile-device-tegu/PKGBUILD index da1e2b777..2732b538d 100644 --- a/packages/omamobile-device-tegu/PKGBUILD +++ b/packages/omamobile-device-tegu/PKGBUILD @@ -8,7 +8,8 @@ arch=(aarch64) url="https://github.com/derekross/omarchy-mobile" license=(MIT) depends=(bash systemd kmod bluez-utils omamobile-keyring) -provides=(omamobile-device omamobile-modem-policy) +optdepends=('omamobile-telephony-tegu: attach Phone and Messages to an attended running sitd') +provides=(omamobile-device omamobile-modem-policy omamobile-sitd-policy) conflicts=(omamobile-device) backup=(etc/pacman.d/omamobile-mirrorlist) install=omamobile-device-tegu.install diff --git a/packages/omamobile-device-tegu/README.md b/packages/omamobile-device-tegu/README.md index 5d9dafe74..604697628 100644 --- a/packages/omamobile-device-tegu/README.md +++ b/packages/omamobile-device-tegu/README.md @@ -149,3 +149,18 @@ that loaded them, from its own staged copies, not the package: the package blacklists both and starts neither. Licence: MIT. + +## Optional Phone and Messages attachment + +`omamobile-telephony-tegu` is an opt-in companion package; it installs the +ModemManager-compatible bridge and session agent without enabling or +starting the radio. Its attended helper attaches only to a running tegu +modem and sitd. See its [runbook](../omamobile-telephony-tegu/README.md). + +This device package supplies sitd's modem-unit policy under +`omamobile-sitd.service.d/10-device-modem.conf`: Requisite and ordering on +`omamobile-tegu-modem.service`, with a CP ONLINE check before any future +sitd start. It supplies no CP starter and enables neither service. It +also prevents the generic modem runtime unit from starting on tegu. +Remove any old full sitd unit copy in `/etc` using the runbook's attended +migration; the package does not delete human overrides. diff --git a/packages/omamobile-device-tegu/test/all b/packages/omamobile-device-tegu/test/all index 3a55ebd03..121d36bc5 100755 --- a/packages/omamobile-device-tegu/test/all +++ b/packages/omamobile-device-tegu/test/all @@ -147,6 +147,10 @@ for absent in usr/bin/omamobile-boot-success usr/bin/omamobile-bootctl \ usr/lib/udev/rules.d/20-omamobile-gpu-always-on.rules; do [[ ! -e $tmp/root/$absent ]] || fail "install includes $absent" done +# The canonical sitd unit gets its modem dependency from this device policy. +[[ -f $tmp/root/usr/lib/systemd/system/omamobile-sitd.service.d/10-device-modem.conf ]] \ + || fail "the device sitd policy is staged" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the package provides its sitd policy capability" pass "install stages the package, enables only the guards, and nothing that marks a slot" for m in cpif shm_ipc pcie_gs201_cp; do diff --git a/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf new file mode 100644 index 000000000..67efa018a --- /dev/null +++ b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-modem.service.d/10-tegu-no-start.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MIT +# The tegu starter is attended and separate. Never run the generic profile. +[Unit] +ConditionPathExists=!/usr/share/omamobile/device-tegu/version diff --git a/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf new file mode 100644 index 000000000..719317df9 --- /dev/null +++ b/packages/omamobile-device-tegu/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: MIT +# Requisite checks the attended starter without pulling it into a start job. +# A missing/inactive tegu modem must fail, never start cheetah's modem unit. +[Unit] +Requisite=omamobile-tegu-modem.service +After=omamobile-tegu-modem.service omamobile-tegu-aoc.service + +[Service] +# Active alone is insufficient: the CP must already report ONLINE. +ExecStartPre=/usr/lib/omamobile-vendor/omamobile-modem-cp state diff --git a/packages/omamobile-device-tegu/version b/packages/omamobile-device-tegu/version index 1866a362b..13dead7eb 100644 --- a/packages/omamobile-device-tegu/version +++ b/packages/omamobile-device-tegu/version @@ -1 +1 @@ -0.2.9 +0.2.10 diff --git a/packages/omamobile-mmd/systemd/omamobile-mmd.service b/packages/omamobile-mmd/systemd/omamobile-mmd.service index 6b41f159a..81fccf220 100644 --- a/packages/omamobile-mmd/systemd/omamobile-mmd.service +++ b/packages/omamobile-mmd/systemd/omamobile-mmd.service @@ -7,7 +7,8 @@ [Unit] Description=Omarchy Mobile ModemManager-compatible bridge (omamobile-sitd on D-Bus) After=dbus.service omamobile-sitd.service -Conflicts=ModemManager.service +# Bus-name ownership and package conflicts provide exclusion. Do not stop +# another modem daemon as a side effect of starting this bridge. [Service] Type=dbus diff --git a/packages/omamobile-mmd/test/all b/packages/omamobile-mmd/test/all index 3b555a4bb..f53ffa2c2 100755 --- a/packages/omamobile-mmd/test/all +++ b/packages/omamobile-mmd/test/all @@ -38,7 +38,8 @@ python3 "$stage/usr/bin/omamobile-mmd" --help >/dev/null || fail "the staged dae # the modem side, no D-Bus activation file. grep -E '^(Requires|Wants|BindsTo|Requisite)=' systemd/omamobile-mmd.service && fail "the unit pulls something in" [[ -z $(find "$stage" -path '*dbus-1/system-services*' -print -quit) ]] || fail "no D-Bus activation file" -grep -qx 'Conflicts=ModemManager.service' systemd/omamobile-mmd.service || fail "the unit conflicts with ModemManager" +! grep -qx 'Conflicts=ModemManager.service' systemd/omamobile-mmd.service \ + || fail "starting the bridge must not stop another modem daemon" if command -v systemd-analyze >/dev/null; then systemd-analyze verify --man=no "$stage/usr/lib/systemd/system/omamobile-mmd.service" 2>&1 | grep -v -e 'not executable' -e 'No such file' -e 'omamobile-sitd.service' -e '^$' && fail "unit verify" || true diff --git a/packages/omamobile-mmd/version b/packages/omamobile-mmd/version index d917d3e26..b1e80bb24 100644 --- a/packages/omamobile-mmd/version +++ b/packages/omamobile-mmd/version @@ -1 +1 @@ -0.1.2 +0.1.3 diff --git a/packages/omamobile-modem-sit/PKGBUILD b/packages/omamobile-modem-sit/PKGBUILD index c73e40211..dbf3a6726 100644 --- a/packages/omamobile-modem-sit/PKGBUILD +++ b/packages/omamobile-modem-sit/PKGBUILD @@ -10,7 +10,7 @@ license=(MIT) # mobile-broadband-provider-info: the carrier database the automatic APN # reads (GNOME, CC-PDDC; arch "any", NetworkManager already pulls it in). # polkit: the Mobile network page's helper runs through pkexec. -depends=(python iproute2 iputils systemd alsa-lib alsa-utils omamobile-modem +depends=(python iproute2 iputils systemd alsa-lib alsa-utils 'omamobile-modem>=0.1.11' omamobile-sitd-policy mobile-broadband-provider-info polkit) backup=(etc/omamobile/modem-sit.conf) install=omamobile-modem-sit.install diff --git a/packages/omamobile-modem-sit/systemd/omamobile-sitd.service b/packages/omamobile-modem-sit/systemd/omamobile-sitd.service index 83879c44e..f235d22a7 100644 --- a/packages/omamobile-modem-sit/systemd/omamobile-sitd.service +++ b/packages/omamobile-modem-sit/systemd/omamobile-sitd.service @@ -6,8 +6,9 @@ # own: a second start-up on the same CP is not supported (reboot instead). [Unit] Description=Omarchy Mobile SIT RIL (S5300 calls, SMS, registration) -Requires=omamobile-modem.service -After=omamobile-modem.service omamobile-audio.service +# The device modem-policy package supplies its modem dependency as a drop-in. +# Tegu checks an already running modem; cheetah/raven retain their starter. +After=omamobile-audio.service ConditionPathExists=/dev/umts_ipc0 [Service] diff --git a/packages/omamobile-modem-sit/test/all b/packages/omamobile-modem-sit/test/all index bba38d704..231ef6a10 100755 --- a/packages/omamobile-modem-sit/test/all +++ b/packages/omamobile-modem-sit/test/all @@ -48,4 +48,7 @@ if command -v systemd-analyze >/dev/null; then -e 'omamobile-sitd.service' -e '^$' && fail "$u verify" || true done fi +! grep -qx 'Requires=omamobile-modem.service' systemd/omamobile-sitd.service \ + || fail "the base unit must use the device's sitd policy" +grep -q 'omamobile-sitd-policy' PKGBUILD || fail "the RIL needs an installed device sitd policy" pass "staged layout, config and units" diff --git a/packages/omamobile-modem-sit/version b/packages/omamobile-modem-sit/version index f18b7fb98..cd906cd5e 100644 --- a/packages/omamobile-modem-sit/version +++ b/packages/omamobile-modem-sit/version @@ -1 +1 @@ -0.3.31 +0.3.32 diff --git a/packages/omamobile-telephony-tegu/LICENSE b/packages/omamobile-telephony-tegu/LICENSE new file mode 100644 index 000000000..aecd59624 --- /dev/null +++ b/packages/omamobile-telephony-tegu/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Derek Ross + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/omamobile-telephony-tegu/PKGBUILD b/packages/omamobile-telephony-tegu/PKGBUILD new file mode 100644 index 000000000..0da8e53cb --- /dev/null +++ b/packages/omamobile-telephony-tegu/PKGBUILD @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: MIT +pkgname=omamobile-telephony-tegu +pkgver=$(cat "${startdir:-.}/version") +pkgrel=1 +pkgdesc="Opt-in Pixel 9a Phone/Messages bridge attachment to an already running sitd" +arch=(any) +url="https://github.com/derekross/omarchy-mobile" +license=(MIT) +depends=(python systemd sudo 'omamobile-device-tegu>=0.2.10' + 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4') +install=omamobile-telephony-tegu.install + +check() { + "$startdir/test/all" +} + +package() { + "$startdir/install" "$pkgdir" +} diff --git a/packages/omamobile-telephony-tegu/README.md b/packages/omamobile-telephony-tegu/README.md new file mode 100644 index 000000000..78331f18b --- /dev/null +++ b/packages/omamobile-telephony-tegu/README.md @@ -0,0 +1,127 @@ + +# Pixel 9a: attach Phone and Messages to a running sitd + +This opt-in package installs `omamobile-mmd`, `omatel-agent`, and the tegu +bridge policy. It enables and starts no services. It does not package a +modem starter: the attended tegu modem and RIL must already be running. +Apps speak to the session agent, the agent speaks ModemManager's system +D-Bus API, and mmd forwards requests to sitd's private socket. + +Install the built `omamobile-telephony-tegu` package with ordinary pacman +dependency checking. Inspect the transaction first. Its device/RIL minima +carry the packaged unit policies, the dependency fix, the tegu SIM fixes, +safe unconfirmed-release handling and the opt-in tegu audio route. Prepare +those upgrades before a modem session; never replace a running test RIL +with older code. No firmware or private provisioning comes in this package. + +The common `omamobile-sitd.service` name is preserved for the CLI, bridge +and data helper. Its modem dependency now comes from the device package: + +- Cheetah and raven retain `Requires=omamobile-modem.service` and its order. +- Tegu uses `Requisite=omamobile-tegu-modem.service` plus ordering, and + checks CP ONLINE with the existing state helper before starting sitd. + Requisite fails if that starter is inactive; it never starts it. +- The device packages provide `omamobile-sitd-policy`, which the RIL now + requires, so an upgrade cannot silently omit its device unit dependency. +- The opt-in bridge uses `Requisite=omamobile-sitd.service` and a read-only + service preflight. Starting the bridge cannot pull in sitd or either modem unit. + +## Migrate the old sitd unit (attended preparation) + +The old `/etc/systemd/system/omamobile-sitd.service` copy overrides the +packaged base unit. The attach script refuses it. The package never deletes +or rewrites a human's unit. Prefer migration with the modem off, before +starting the next approved session. For an already running session, only +continue after checking the versions, active tegu starter and unchanged +process IDs; `daemon-reload` changes definitions without restarting them. + +1. Read-only: `systemctl cat omamobile-sitd.service` and + `systemctl show omamobile-sitd.service omamobile-tegu-modem.service -p ActiveState -p MainPID`. + Save those PIDs privately. Stop if the service/starter differs from the + approved tegu setup, or if a call is in progress. Risk: none; rollback: + none. +2. After the new packages are installed, inspect + `/usr/lib/systemd/system/omamobile-sitd.service` and its + `omamobile-sitd.service.d/10-device-modem.conf`. Expect tegu Requisite, + no cheetah Requires, CP ONLINE precheck, and `Restart=no`. Stop on a + mismatch. Risk: none; rollback: none. +3. Only for the legacy full copy, root: + `install -d -m700 /var/lib/omamobile-telephony-tegu`, then + `mv -n /etc/systemd/system/omamobile-sitd.service /var/lib/omamobile-telephony-tegu/omamobile-sitd.service.before-attach`. + Verify the source is gone (an existing backup makes `mv -n` skip; do + not overwrite it), then `systemctl daemon-reload`. Do not use restart, + enable or `--now`. Risk: low (unit definitions). Expect the same PIDs + and `FragmentPath=/usr/lib/systemd/system/omamobile-sitd.service`. + Stop if a PID changes or a service leaves active. Rollback: restore + the saved file and daemon-reload, without restarting the modem or RIL. + +The attach script also refuses pending daemon-reload, unexpected start +relationships, an inactive tegu starter/RIL, another ModemManager, a +non-ready SIM, an unregistered radio, and a live call. It obtains a live +status RPC; it never trusts the public state.json as proof of readiness. +It reads no modem device and sends no radio-control request. IMS or a +mobile-data bearer is not required just to attach. The unit's separate +`--service-check` permits an existing call or registration loss, so the +bridge can recover without dropping call visibility. The attended initial +attachment keeps the stricter no-live-call and registered-SIM checks. + +Mmd 0.1.3 (#371) removes the service-level `Conflicts=ModemManager.service`: a +bridge start must not stop another modem daemon. Package conflicts and +exclusive D-Bus name ownership still prevent two managers from serving the +same API; tegu's preflight refuses another owner before starting mmd. + +## Attach (human in the graphical user's terminal) + +Keep the existing, approved sleep inhibitor for the modem session. This +package does not qualify CP-on suspend or change auto-sleep. Confirm the +NV checks and once-per-boot rule from the modem startup runbook; nothing +here repeats the modem start or accesses NV partitions. + +Read-only preflight: + +```sh +omamobile-tegu-mmd-attach --check +``` + +Expect existing running tegu modem and sitd, a registered SIM and no live +calls. This uses sudo for read-only system checks and the private sitd +socket. Stop on any failure; it never attempts recovery. Risk: low; no +rollback is needed because no service is changed. + +Attach, after announcing that incoming calls and message notifications may +now appear on the screen and sound: + +```sh +omamobile-tegu-mmd-attach --attach +``` + +Run as the existing graphical user, not root, in a terminal. Type `ATTACH` +at its prompt. The complete set of service-start commands is: + +```sh +sudo -- systemctl start omamobile-mmd.service +systemctl --user start omatel-agent.service +``` + +The script rechecks the modem/RIL PIDs immediately before the bridge start, +after it, and after the agent start. Repeating it starts already active +services without restarting them. It never enables services or starts, +restarts or stops the modem/RIL. Risk: low (apps begin importing SMS into +the user's store and observing incoming calls). Expect both services +active and unchanged modem/RIL PIDs. Stop on any failure and inspect; +there is no automatic retry or modem recovery. + +Open Messages, then do one agreed SMS each way. Record only outcomes and +counts; number, text and network identities stay private. Stop on duplicate +or uncertain delivery; do not resend automatically. Calls follow the +separate safe-release/audio qualification. This package does not qualify +speech, mute/speaker controls, MMS, emergency calls or suspend. + +Rollback for services started by this test, once there is no live call: +close the apps, `systemctl --user stop omatel-agent.service`, then +`sudo systemctl stop omamobile-mmd.service`. Leave either service running +if it was already active before the test. A partial failure intentionally +leaves a started bridge in place for inspection. Never stop the modem or +restart sitd to recover an app failure. Any reboot is separately attended +and approved. Removing this package also requires stopping the bridge +first; it removes only the opt-in policy/helper, not private message data. diff --git a/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach new file mode 100755 index 000000000..3ee8f2806 --- /dev/null +++ b/packages/omamobile-telephony-tegu/bin/omamobile-tegu-mmd-attach @@ -0,0 +1,207 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Attended attachment of the bridge and session agent to an existing RIL. + +--check: read-only preflight (sudo is used for the private sitd socket). +--attach: preflight, an explicit terminal confirmation, then start only + omamobile-mmd.service and this user's omatel-agent.service. +--system-check: root preflight for the attended script. +--service-check: root unit preflight; permits an existing call or registration loss. +No modem/RIL start, restart, stop, enable, radio request or device ioctl. +""" +import json +import os +from pathlib import Path +import socket +import subprocess +import sys + +SITD = 'omamobile-sitd.service' +MODEM = 'omamobile-tegu-modem.service' +BRIDGE = 'omamobile-mmd.service' +AGENT = 'omatel-agent.service' +BUS = 'org.freedesktop.ModemManager1' +# Only systemd's basic implicit dependencies may start with the bridge. +# tmp.mount: systemd adds it to any unit that uses /tmp. Neither it nor +# these pull the CP or the RIL into a start transaction. +BASIC = {'sysinit.target', 'basic.target', 'system.slice', 'dbus.socket', 'dbus.service', 'tmp.mount'} +# A service-check refusal exits with this code. The bridge's ExecCondition +# treats it as a skipped start, without repeatedly restarting the service. +REFUSED_SERVICE = 3 + + +class Refused(RuntimeError): + pass + + +def run(args, *, safe_error=False): + try: + result = subprocess.run(args, check=True, capture_output=True, text=True, timeout=30) + return result.stdout.strip() + except subprocess.CalledProcessError as error: + if safe_error and error.stderr.startswith('Attach refused: '): + raise Refused(error.stderr.removeprefix('Attach refused: ').strip()) from None + raise Refused('a required service/bus check failed; no modem recovery attempted') from None + except (OSError, subprocess.SubprocessError): + raise Refused('a required service/bus check failed; no modem recovery attempted') from None + + +def properties(unit): + result = run(['systemctl', 'show', unit, '--property=ActiveState,MainPID,FragmentPath,Requires,Wants,BindsTo,Requisite,Conflicts,NeedDaemonReload']) + return dict(line.split('=', 1) for line in result.splitlines() if '=' in line) + + +def require_active(unit): + props = properties(unit) + if props.get('ActiveState') != 'active' or not props.get('MainPID', '').isdigit() or int(props['MainPID']) <= 0: + raise Refused(f'{unit} must already be active with a running process; start nothing here') + return props + + +def socket_status(path): + # A live read-only RPC, never the potentially stale public state.json. + try: + with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: + client.settimeout(5) + client.connect(str(path)) + client.sendall(b'{"action":"status"}\n') + with client.makefile('rb') as stream: + line = stream.readline((1 << 20) + 1) + if len(line) > 1 << 20 or not line.endswith(b'\n'): + raise ValueError + reply = json.loads(line) + if reply.get('ok') is not True: + raise ValueError + return reply['result'] + except (OSError, ValueError, KeyError, TypeError, AttributeError): + raise Refused('cannot read a live sitd status; no modem recovery attempted') from None + + +def system_check(*, require_ready=True): + if os.geteuid() != 0: + raise Refused('--system-check requires root') + root = Path(os.environ.get('OMAMOBILE_TEGU_ROOT', '/')) + if not root.is_absolute() or not root.is_dir(): + raise Refused('invalid preflight root') + descriptor = root / 'usr/share/omamobile/device.conf' + try: + tegu = 'CODENAME=tegu' in descriptor.read_text().splitlines() + installed = (root / 'usr/share/omamobile/device-tegu/version').is_file() + except OSError: + tegu = installed = False + if not tegu or not installed: + raise Refused('requires the tegu device package and descriptor') + ril = require_active(SITD) + modem = require_active(MODEM) + if ril.get('FragmentPath') != '/usr/lib/systemd/system/' + SITD: + raise Refused('migrate the legacy /etc sitd unit to the packaged unit first; see the README') + bridge = properties(BRIDGE) + if any(p.get('NeedDaemonReload') != 'no' for p in (ril, bridge)): + raise Refused('unit files need daemon-reload; inspect them before attaching') + if bridge.get('FragmentPath') != '/usr/lib/systemd/system/' + BRIDGE: + raise Refused('requires the packaged bridge unit') + if MODEM not in ril.get('Requisite', '').split() or SITD not in bridge.get('Requisite', '').split(): + raise Refused('tegu attach policy is not loaded; inspect the packaged drop-ins') + for unit in (ril, bridge): + for key in ('Requires', 'Wants', 'BindsTo'): + allowed = BASIC + # sitd wanting the bridge comes from the bridge's own + # WantedBy=omamobile-sitd.service once it is enabled: it starts + # the bridge after the RIL, never the RIL or the CP. + if unit is ril and key == 'Wants': + allowed = BASIC | {BRIDGE} + if set(unit.get(key, '').split()) - allowed: + raise Refused('bridge or sitd has an unexpected start dependency; inspect its unit before attaching') + if set(bridge.get('Conflicts', '').split()) - {'shutdown.target'}: + raise Refused('bridge has an unexpected stop dependency; inspect its unit before attaching') + # Neither the script nor a direct unit start may stop a real modem daemon. + owner = run(['busctl', '--system', 'call', 'org.freedesktop.DBus', '/org/freedesktop/DBus', + 'org.freedesktop.DBus', 'NameHasOwner', 's', BUS]) + if owner == 'b true' and bridge.get('ActiveState') != 'active': + raise Refused('ModemManager bus name is already owned by another service') + if owner not in ('b true', 'b false'): + raise Refused('cannot determine the ModemManager bus owner') + competing = properties('ModemManager.service') + if competing.get('ActiveState') in ('active', 'activating', 'reloading'): + raise Refused('another ModemManager service is running; it will not be stopped here') + status = socket_status(root / 'run/omamobile-sit/socket') + try: + m = status['modem'] + ready = (m.get('present') is True and m.get('sim', {}).get('state') == 'ready' + and m.get('radio') == 'on' and m.get('registration') in ('home', 'roaming')) + calls = status['calls'] + if not isinstance(calls, list): + raise TypeError + live = any(c.get('state') != 'terminated' for c in calls) + except (AttributeError, KeyError, TypeError): + raise Refused('invalid live sitd status') from None + if require_ready and (not ready or live): + raise Refused('sitd must have a ready SIM, registered radio and no live calls') + # PIDs are used only to detect an unexpected RIL/CP service replacement. + # Never return the private RPC's numbers, network identities or messages. + return {'sitd_pid': ril['MainPID'], 'modem_pid': modem['MainPID']} + + +def user_check(): + if os.geteuid() == 0: + raise Refused('run --check/--attach as the graphical user, not root') + state = run(['systemctl', '--user', 'show', AGENT, '--property=LoadState', '--value']) + if state != 'loaded': + raise Refused('omatel-agent user unit is not installed') + + +def root_check(): + reply = run(['sudo', '--', str(Path(__file__).resolve()), '--system-check'], safe_error=True) + try: + result = json.loads(reply) + if set(result) != {'sitd_pid', 'modem_pid'}: + raise ValueError + return result + except (TypeError, ValueError): + raise Refused('root preflight returned an invalid result') from None + + +def main(argv=None): + argv = sys.argv[1:] if argv is None else argv + if argv in ([], ['--help'], ['-h']): + print(__doc__) + return 0 + try: + if argv in (['--system-check'], ['--service-check']): + try: + print(json.dumps(system_check(require_ready=argv == ['--system-check']))) + except Refused as error: + print(f'Attach refused: {error}', file=sys.stderr) + return REFUSED_SERVICE if argv == ['--service-check'] else 1 + return 0 + if argv not in (['--check'], ['--attach']): + raise Refused('use --check or --attach') + if argv == ['--attach'] and not (sys.stdin.isatty() and sys.stdout.isatty()): + raise Refused('--attach needs an attended terminal') + user_check() + before = root_check() + print('Preflight passed: existing tegu modem and sitd, registered SIM, no live calls.') + if argv == ['--check']: + return 0 + print('This starts only the ModemManager bridge and your Phone/Messages agent.') + if input('Type ATTACH to continue: ') != 'ATTACH': + raise Refused('attachment cancelled') + if root_check() != before: + raise Refused('modem or sitd changed during confirmation; no services started') + run(['sudo', '--', 'systemctl', 'start', BRIDGE]) + if root_check() != before: + raise Refused('modem or sitd changed while attaching; stop testing and inspect') + run(['systemctl', '--user', 'start', AGENT]) + run(['systemctl', '--user', 'is-active', '--quiet', AGENT]) + run(['systemctl', 'is-active', '--quiet', BRIDGE]) + if root_check() != before: + raise Refused('modem or sitd changed while attaching; stop testing and inspect') + print('Bridge and session agent active. Open Phone or Messages for the attended test.') + return 0 + except (Refused, EOFError, KeyboardInterrupt) as error: + print(f'Attach refused: {error}', file=sys.stderr) + return 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/packages/omamobile-telephony-tegu/install b/packages/omamobile-telephony-tegu/install new file mode 100755 index 000000000..df5c69d86 --- /dev/null +++ b/packages/omamobile-telephony-tegu/install @@ -0,0 +1,12 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Stage the opt-in bridge integration. No service activation or wants links. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" +d=${1:?Usage: ./install DESTDIR} +[[ $d == /* && $d != / ]] || { echo "Use an absolute staging directory" >&2; exit 1; } +install -Dm755 bin/omamobile-tegu-mmd-attach "$d/usr/bin/omamobile-tegu-mmd-attach" +install -Dm644 systemd/10-tegu-attach.conf "$d/usr/lib/systemd/system/omamobile-mmd.service.d/10-tegu-attach.conf" +install -Dm644 README.md "$d/usr/share/doc/omamobile-telephony-tegu/README.md" +install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-telephony-tegu/LICENSE" +install -Dm644 version "$d/usr/share/omamobile/telephony-tegu/version" diff --git a/packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install b/packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install new file mode 100644 index 000000000..095527446 --- /dev/null +++ b/packages/omamobile-telephony-tegu/omamobile-telephony-tegu.install @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: MIT +post_install() { + systemctl daemon-reload 2>/dev/null || true + echo "omamobile-telephony-tegu: installed; no services enabled or started." + echo " From the graphical user's terminal, with sitd already running:" + echo " omamobile-tegu-mmd-attach --check, then --attach (attended)." + echo " Migrate any /etc copy of omamobile-sitd.service first; see the README." +} +post_upgrade() { + post_install +} diff --git a/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf new file mode 100644 index 000000000..56960ff72 --- /dev/null +++ b/packages/omamobile-telephony-tegu/systemd/10-tegu-attach.conf @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: MIT +# Check the existing RIL, never pull it or the CP into a start transaction. +[Unit] +Requisite=omamobile-sitd.service +After=omamobile-sitd.service + +[Service] +# A refused service check skips this start without retrying every RestartSec. +ExecCondition=/usr/bin/omamobile-tegu-mmd-attach --service-check diff --git a/packages/omamobile-telephony-tegu/test/all b/packages/omamobile-telephony-tegu/test/all new file mode 100755 index 000000000..d91ec5010 --- /dev/null +++ b/packages/omamobile-telephony-tegu/test/all @@ -0,0 +1,30 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Package and attended attachment tests: fixtures only, no phone or system bus. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +for f in PKGBUILD install omamobile-telephony-tegu.install test/all; do bash -n "$f"; done +python3 -B -m unittest discover -s test -p 'test_*.py' +t=$(mktemp -d); trap 'rm -rf "$t"' EXIT +./install "$t/root" +for f in usr/bin/omamobile-tegu-mmd-attach usr/lib/systemd/system/omamobile-mmd.service.d/10-tegu-attach.conf \ + usr/share/doc/omamobile-telephony-tegu/README.md usr/share/omamobile/telephony-tegu/version; do + [[ -f $t/root/$f ]] || { echo "not ok - missing $f"; exit 1; } +done +[[ -z $(find "$t/root" -type l -print) ]] || { echo 'not ok - package enables a unit'; exit 1; } +[[ ! -d $t/root/etc ]] || { echo 'not ok - package copies or overrides /etc'; exit 1; } +[[ -x $t/root/usr/bin/omamobile-tegu-mmd-attach ]] +"$t/root/usr/bin/omamobile-tegu-mmd-attach" --help >/dev/null +python3 -I -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' bin/omamobile-tegu-mmd-attach +# Read the dependency declarations, not a grep that can match an optdepend. +deps=$(startdir=$PWD bash -c 'source PKGBUILD; printf "%s\n" "${depends[@]}"') +for dep in 'omamobile-device-tegu>=0.2.10' 'omamobile-modem-sit>=0.3.12' 'omamobile-mmd>=0.1.1' 'omatel-agent>=0.2.4'; do + grep -qxF "$dep" <<<"$deps" +done +! grep -qx omamobile-device-cheetah <<<"$deps" +# Requisite is an active-state check, not a start request. No Wants/Requires +# or multi-user target links may be added by this package. +grep -qx 'Requisite=omamobile-sitd.service' systemd/10-tegu-attach.conf +! grep -E '^(Requires|Wants|BindsTo)=' systemd/10-tegu-attach.conf +! grep -E 'systemctl .*\b(start|restart|enable)\b' omamobile-telephony-tegu.install +echo 'ok - opt-in package stages the attended helper and non-pulling bridge policy' diff --git a/packages/omamobile-telephony-tegu/test/test_attach.py b/packages/omamobile-telephony-tegu/test/test_attach.py new file mode 100644 index 000000000..23ab8cc74 --- /dev/null +++ b/packages/omamobile-telephony-tegu/test/test_attach.py @@ -0,0 +1,312 @@ +# SPDX-License-Identifier: MIT +"""The attended script with fake service/bus calls and private socket data.""" +import contextlib +import copy +import importlib.machinery +import importlib.util +import io +import json +from pathlib import Path +import subprocess +import tempfile +import unittest +from unittest.mock import Mock, patch + +SCRIPT = Path(__file__).resolve().parents[1] / 'bin/omamobile-tegu-mmd-attach' +loader = importlib.machinery.SourceFileLoader('attach', str(SCRIPT)) +spec = importlib.util.spec_from_loader(loader.name, loader) +a = importlib.util.module_from_spec(spec) +loader.exec_module(a) + + +class SystemCheck(unittest.TestCase): + def setUp(self): + self.scratch = tempfile.TemporaryDirectory() + self.addCleanup(self.scratch.cleanup) + self.root = Path(self.scratch.name) + desc = self.root / 'usr/share/omamobile/device.conf' + desc.parent.mkdir(parents=True) + desc.write_text('CODENAME=tegu\n') + ver = self.root / 'usr/share/omamobile/device-tegu/version' + ver.parent.mkdir() + ver.write_text('0.2.9\n') + self.status = dict(modem=dict(present=True, sim=dict(state='ready'), radio='on', + registration='home', ims='unregistered', data=False, + operator='PRIVATE NETWORK'), calls=[], sms={'received': []}) + self.units = { + a.SITD: dict(ActiveState='active', MainPID='123', FragmentPath='/usr/lib/systemd/system/' + a.SITD, + Requisite=a.MODEM, Requires='sysinit.target', Wants='', BindsTo='', NeedDaemonReload='no'), + a.MODEM: dict(ActiveState='active', MainPID='122'), + a.BRIDGE: dict(ActiveState='inactive', MainPID='0', FragmentPath='/usr/lib/systemd/system/' + a.BRIDGE, + Requisite=a.SITD, Requires='dbus.socket sysinit.target', Wants='', BindsTo='', NeedDaemonReload='no'), + 'ModemManager.service': dict(ActiveState='inactive', MainPID='0'), + } + self.owner = 'b false' + self.commands = [] + for target, value in [('os.geteuid', lambda: 0), ('properties', lambda name: self.units[name]), + ('run', self.command), ('socket_status', lambda path: self.status)]: + helper = patch.object(a.os, 'geteuid', value) if target == 'os.geteuid' else patch.object(a, target, value) + helper.start() + self.addCleanup(helper.stop) + helper = patch.dict(a.os.environ, OMAMOBILE_TEGU_ROOT=str(self.root)) + helper.start() + self.addCleanup(helper.stop) + + def command(self, args): + self.commands.append(args) + self.assertEqual(args[:3], ['busctl', '--system', 'call']) + self.assertIn('NameHasOwner', args) + return self.owner + + def refused(self): + with self.assertRaises(a.Refused): + a.system_check() + + def test_live_no_ims_no_bearer_passes_without_radio_actions(self): + self.assertEqual(a.system_check(), {'sitd_pid': '123', 'modem_pid': '122'}) + self.assertEqual(len(self.commands), 1) + self.assertNotIn('PRIVATE', json.dumps(a.system_check())) + + def test_wrong_board_and_non_root_refused(self): + with patch.object(a.os, 'geteuid', return_value=1000): + self.refused() + (self.root / 'usr/share/omamobile/device.conf').write_text('CODENAME=cheetah\n') + self.refused() + + def test_missing_or_inactive_ril_or_modem_refused(self): + for unit in (a.SITD, a.MODEM): + for field, value in [('ActiveState', 'inactive'), ('MainPID', '0')]: + with self.subTest(unit=unit, field=field): + old = self.units[unit][field] + self.units[unit][field] = value + self.refused() + self.units[unit][field] = old + + def test_shadow_units_and_reload_pending_refused(self): + for unit in (a.SITD, a.BRIDGE): + for field, value in [('FragmentPath', '/etc/systemd/system/' + unit), ('NeedDaemonReload', 'yes')]: + with self.subTest(unit=unit, field=field): + old = self.units[unit][field] + self.units[unit][field] = value + self.refused() + self.units[unit][field] = old + + def test_missing_policy_or_pulling_dependency_refused(self): + for unit in (a.SITD, a.BRIDGE): + for field, value in [('Requisite', ''), ('Requires', a.MODEM), ('Wants', a.SITD), ('BindsTo', a.MODEM)]: + with self.subTest(unit=unit, field=field): + old = self.units[unit][field] + self.units[unit][field] = value + self.refused() + self.units[unit][field] = old + + def test_enabled_bridge_and_implicit_tmp_mount_pass(self): + # As on the palmtop once the bridge is enabled: sitd wants it (its + # WantedBy=), and systemd adds tmp.mount to both units. + self.units[a.SITD]['Wants'] = a.BRIDGE + ' tmp.mount' + self.units[a.BRIDGE]['Wants'] = 'tmp.mount' + self.assertEqual(a.system_check()['sitd_pid'], '123') + # sitd wanting anything else, or the bridge wanting itself, still refuses + self.units[a.SITD]['Wants'] = a.BRIDGE + ' ' + a.MODEM + self.refused() + self.units[a.SITD]['Wants'] = '' + self.units[a.BRIDGE]['Wants'] = a.BRIDGE + self.refused() + + def test_service_check_refusal_has_its_own_exit_code(self): + self.units[a.SITD]['Wants'] = a.MODEM + self.assertEqual(a.main(['--service-check']), a.REFUSED_SERVICE) + self.assertEqual(a.main(['--system-check']), 1) + + def test_competing_bus_owner_or_real_manager_refused(self): + self.owner = 'b true' + self.refused() + self.units[a.BRIDGE]['ActiveState'] = 'active' + self.assertEqual(a.system_check()['sitd_pid'], '123') + self.units['ModemManager.service']['ActiveState'] = 'activating' + self.refused() + + def test_unready_registration_or_live_call_refused(self): + good = copy.deepcopy(self.status) + for key, value in [('sim', {'state': 'absent'}), ('radio', 'off'), ('registration', 'searching')]: + self.status = copy.deepcopy(good) + self.status['modem'][key] = value + self.refused() + self.status = copy.deepcopy(good) + self.status['calls'] = [dict(state='active', number='PRIVATE NUMBER')] + self.refused() + + def test_service_recovery_allows_live_calls_and_registration_loss(self): + self.status['calls'] = [dict(state='active')] + self.status['modem']['radio'] = 'off' + self.status['modem']['registration'] = 'searching' + self.status['modem']['sim'] = dict(state='absent') + self.refused() + self.assertEqual(a.system_check(require_ready=False)['sitd_pid'], '123') + + def test_stop_dependency_is_refused(self): + self.units[a.BRIDGE]['Conflicts'] = 'ModemManager.service shutdown.target' + self.refused() + + def test_malformed_rpc_is_refused_without_private_output(self): + self.status = {'modem': None, 'calls': ['PRIVATE']} + self.refused() + self.status = dict(modem=dict(present=True, sim=None)) + self.refused() + + +class SocketRead(unittest.TestCase): + def test_only_status_sent_and_refused_payload_hidden(self): + fake = Mock() + fake.__enter__ = Mock(return_value=fake) + fake.__exit__ = Mock(return_value=False) + fake.makefile.return_value = io.BytesIO(b'{"ok":true,"result":{"calls":[]}}\n') + with patch.object(a.socket, 'socket', return_value=fake): + self.assertEqual(a.socket_status('/private/socket'), {'calls': []}) + fake.sendall.assert_called_once_with(b'{"action":"status"}\n') + for response in [b'{"ok":false,"error":"PRIVATE NUMBER"}\n', b'bad PRIVATE JSON\n', b'{}']: + fake.makefile.return_value = io.BytesIO(response) + with patch.object(a.socket, 'socket', return_value=fake), self.assertRaises(a.Refused) as error: + a.socket_status('/private/socket') + self.assertNotIn('PRIVATE', str(error.exception)) + + +class Attended(unittest.TestCase): + def setUp(self): + self.commands = [] + self.identity = {'sitd_pid': '123', 'modem_pid': '122'} + self.output = io.StringIO() + self.output.isatty = lambda: True + self.input = Mock() + self.input.isatty.return_value = True + helpers = [patch.object(a.os, 'geteuid', return_value=1000), + patch.object(a, 'root_check', return_value=self.identity), + patch.object(a, 'run', side_effect=self.command), + patch.object(a.sys, 'stdin', self.input), patch.object(a.sys, 'stdout', self.output), + patch.object(a.sys, 'stderr', new=io.StringIO()), patch('builtins.input', return_value='ATTACH')] + for helper in helpers: + helper.start() + self.addCleanup(helper.stop) + + def command(self, args, **kwargs): + self.commands.append(args) + return 'loaded' if '--property=LoadState' in args else '' + + def mutations(self): + return [cmd for cmd in self.commands if 'start' in cmd] + + def test_check_changes_nothing(self): + self.assertEqual(a.main(['--check']), 0) + self.assertFalse(self.mutations()) + + def test_attach_starts_exactly_bridge_and_user_agent(self): + for _ in range(2): + self.assertEqual(a.main(['--attach']), 0) + self.assertEqual(self.mutations(), [ + ['sudo', '--', 'systemctl', 'start', a.BRIDGE], ['systemctl', '--user', 'start', a.AGENT]] * 2) + self.assertNotIn('restart', str(self.commands)) + self.assertNotIn('enable', str(self.commands)) + self.assertNotIn(a.MODEM, str(self.commands)) + self.assertNotIn(a.SITD, str(self.commands)) + + def test_requires_terminal_and_explicit_confirmation(self): + self.input.isatty.return_value = False + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.commands) + self.input.isatty.return_value = True + with patch('builtins.input', return_value='yes'): + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.mutations()) + + def test_ril_change_or_preflight_failure_never_starts_services(self): + with patch.object(a, 'root_check', side_effect=[self.identity, {'sitd_pid': '124', 'modem_pid': '122'}]): + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.mutations()) + with patch.object(a, 'root_check', side_effect=a.Refused('inactive')): + self.assertEqual(a.main(['--attach']), 1) + self.assertFalse(self.mutations()) + + def test_agent_failure_never_recovers_modem_or_ril(self): + def command(args, **kwargs): + value = self.command(args, **kwargs) + if args == ['systemctl', '--user', 'start', a.AGENT]: + raise a.Refused('agent failed') + return value + with patch.object(a, 'run', side_effect=command): + self.assertEqual(a.main(['--attach']), 1) + self.assertEqual(self.mutations(), [['sudo', '--', 'systemctl', 'start', a.BRIDGE], + ['systemctl', '--user', 'start', a.AGENT]]) + + def test_refuses_root_and_missing_user_unit(self): + with patch.object(a.os, 'geteuid', return_value=0): + self.assertEqual(a.main(['--check']), 1) + with patch.object(a, 'run', return_value='not-found'): + self.assertEqual(a.main(['--check']), 1) + self.assertFalse(self.mutations()) + + +class UnitPolicy(unittest.TestCase): + repo = Path(__file__).resolve().parents[3] + + def unit(self, path): + fields = {} + for line in path.read_text().splitlines(): + if '=' in line and not line.startswith('#'): + key, value = line.split('=', 1) + fields.setdefault(key, []).extend(value.split()) + return fields + + def test_effective_device_dependencies_and_readiness(self): + base_path = self.repo / 'packages/omamobile-modem-sit/systemd/omamobile-sitd.service' + if not base_path.exists(): + self.skipTest('device unit integration needs the repository') + base = self.unit(base_path) + self.assertNotIn('Requires', base) + self.assertIn('omamobile-audio.service', base['After']) + for dev in ('tegu', 'cheetah', 'raven'): + policy = self.unit(self.repo / f'packages/omamobile-device-{dev}/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf') + if dev == 'tegu': + self.assertEqual(policy['Requisite'], [a.MODEM]) + for field in ('Requires', 'Wants', 'BindsTo'): + self.assertNotIn(field, policy) + self.assertEqual(policy['ExecStartPre'], ['/usr/lib/omamobile-vendor/omamobile-modem-cp', 'state']) + self.assertIn(a.MODEM, policy['After']) + else: + self.assertEqual(policy['Requires'], ['omamobile-modem.service']) + self.assertEqual(policy['After'], ['omamobile-modem.service']) + + def test_bridge_dependency_cannot_start_ril_or_cp(self): + base_path = self.repo / 'packages/omamobile-mmd/systemd/omamobile-mmd.service' + if not base_path.exists(): + self.skipTest('bridge unit integration needs the repository') + policy = self.unit(Path(__file__).resolve().parents[1] / 'systemd/10-tegu-attach.conf') + base = self.unit(base_path) + for fields in (base, policy): + for key in ('Requires', 'Wants', 'BindsTo'): + self.assertNotIn(key, fields) + self.assertNotIn('Conflicts', base) + self.assertEqual(policy['Requisite'], [a.SITD]) + self.assertEqual(policy['ExecCondition'], ['/usr/bin/omamobile-tegu-mmd-attach', '--service-check']) + self.assertNotIn('ExecStartPre', policy) + self.assertNotIn('RestartPreventExitStatus', policy) + + def test_ril_requires_device_policy_and_dependency_fix(self): + pkg = self.repo / 'packages/omamobile-modem-sit/PKGBUILD' + if not pkg.exists(): + self.skipTest('package closure needs the repository') + def array(path, name): + return subprocess.run(['bash', '-c', + 'startdir=$(dirname "$1"); source "$1"; declare -p "$2"', '_', str(path), name], + check=True, capture_output=True, text=True).stdout + self.assertIn('omamobile-sitd-policy', array(pkg, 'depends')) + modem = self.repo / 'packages/omamobile-modem/PKGBUILD' + self.assertIn('omamobile-modem-policy', array(modem, 'depends')) + self.assertNotIn('omamobile-device-cheetah', array(modem, 'depends')) + for device in ('cheetah', 'raven', 'tegu'): + provides = array(self.repo / f'packages/omamobile-device-{device}/PKGBUILD', 'provides') + self.assertIn('omamobile-sitd-policy', provides) + self.assertIn('omamobile-modem-policy', provides) + + +if __name__ == '__main__': + unittest.main() diff --git a/packages/omamobile-telephony-tegu/test/test_units.py b/packages/omamobile-telephony-tegu/test/test_units.py new file mode 100644 index 000000000..74d4e8640 --- /dev/null +++ b/packages/omamobile-telephony-tegu/test/test_units.py @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: MIT +"""Have systemd itself validate the three composed unit policies offline.""" +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + + +@unittest.skipUnless(shutil.which('systemd-analyze'), 'systemd-analyze not installed') +class Units(unittest.TestCase): + def test_composed_units_verify_for_each_device(self): + repo = Path(__file__).resolve().parents[3] + packages = repo / 'packages' + if not (packages / 'omamobile-mmd').exists(): + self.skipTest('composed unit test needs the repository') + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + units = root / 'usr/lib/systemd/system' + units.mkdir(parents=True) + for pkg, name in [('omamobile-modem-sit', 'omamobile-sitd'), ('omamobile-mmd', 'omamobile-mmd')]: + shutil.copy2(packages / pkg / f'systemd/{name}.service', units / f'{name}.service') + # Stubs satisfy references only; verify never starts them. + for name in ['basic', 'sysinit', 'shutdown', 'sockets', 'multi-user', 'slices']: + (units / f'{name}.target').write_text('[Unit]\nDescription=Fixture\n') + (units / 'system.slice').write_text('[Unit]\nDescription=Fixture slice\n') + for name in ['omamobile-modem', 'omamobile-tegu-modem', 'omamobile-audio', + 'omamobile-aoc', 'omamobile-tegu-aoc', 'dbus']: + (units / f'{name}.service').write_text('[Service]\nExecStart=/bin/true\n') + (units / 'dbus.socket').write_text('[Socket]\nListenStream=/run/fixture-bus\n') + for name in ['bin/true', 'usr/bin/omamobile-sitd', 'usr/bin/omamobile-mmd', + 'usr/bin/omamobile-tegu-mmd-attach', 'usr/lib/omamobile-vendor/omamobile-modem-cp']: + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text('fixture') + path.chmod(0o755) + drop = units / 'omamobile-sitd.service.d' + drop.mkdir() + bridge = units / 'omamobile-mmd.service.d' + bridge.mkdir() + for device in ['cheetah', 'raven', 'tegu']: + shutil.copy2(packages / f'omamobile-device-{device}/vendor/systemd/system/omamobile-sitd.service.d/10-device-modem.conf', + drop / '10-device-modem.conf') + if device == 'tegu': + shutil.copy2(packages / 'omamobile-telephony-tegu/systemd/10-tegu-attach.conf', bridge / '10-tegu-attach.conf') + result = subprocess.run(['systemd-analyze', '--root', directory, '--man=no', 'verify', + 'omamobile-sitd.service', 'omamobile-mmd.service'], + capture_output=True, text=True) + if result.returncode and 'Operation not permitted' in result.stderr: + self.skipTest('local sandbox blocks systemd verification sockets') + self.assertEqual(result.returncode, 0, f'{device}: {result.stdout}{result.stderr}') diff --git a/packages/omamobile-telephony-tegu/version b/packages/omamobile-telephony-tegu/version new file mode 100644 index 000000000..6e8bf73aa --- /dev/null +++ b/packages/omamobile-telephony-tegu/version @@ -0,0 +1 @@ +0.1.0 From 764260301e50e96b8608a489815a80ad0e17ccad Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 11:32:18 -0500 Subject: [PATCH 34/66] release: the identifier scan reads /var/lib/omamobile, and skips dnsmasq's example addresses in its one file (#550) * release: the identifier scan skips group MACs and dnsmasq's option bytes The 2026.11.08 identifiers stage stopped on 15 findings, all in the root image's /etc/dnsmasq.conf: dnsmasq (an omamobile-shell dependency since #525, for the Hotspot tile) ships Arch's example configuration, with 11:22:33:44:55:66 in 14 commented dhcp-host examples and e4:45:74:68:00:00 as a commented dhcp-option=128 value. Neither is anyone's address. 0x11 has the group (multicast) bit set, and no network card's own address does, so group addresses join the locally administered ones the scan already treats as made up. The second is option data ("\xe4Eth\0\0"), so in etc/dnsmasq.conf a value on a dhcp-option line, commented or not, is skipped. A universally administered unicast address still counts everywhere else, a dhcp-host line in dnsmasq.conf included. Checked with tools/release scan: dnsmasq 2.93-1's shipped dnsmasq.conf passes (the previous scan reports it); the same file with an added dhcp-host=a4:5e:60:12:34:56 line, and a plain file naming a4:5e:60:12:34:58, are both still reported. Co-Authored-By: Claude Opus 5.5 * release: the dnsmasq exemption covers its one file only, with tests Review of the previous commit: a group-bit exemption across the whole image also passes a quarter of Bluetooth LE static random addresses (top bits 11, any low bits), which AGENTS.md counts as identifiers. The only group address the release hit is dnsmasq's 11:22:33:44:55:66, so the group bit is now skipped in /etc/dnsmasq.conf alone, as are dhcp-option values there, up to a comment on the same line. tests/release: the shipped file's lines pass; a unicast dhcp-host in it, an address in a trailing comment after an option value, and a group-looking address in another file are all found. Test addresses come from RFC 7042's documentation range and are put together at run time, so the test file holds none. Co-Authored-By: Claude Opus 5.5 * release: the identifier scan reads /var/lib/omamobile, and two more tests The identifiers stage dumped /etc, /root, /usr/share/omamobile and /var/lib/omamobile from the root image into one directory. rdump names each by its last component, so the second "omamobile" collided with the first ("File exists while making directory") and debugfs skipped it, behind >/dev/null and || true: /var/lib/omamobile was never scanned. Each is now dumped at its own path, and the stage stops if a directory the image has didn't arrive. Checked on a scratch ext4 image built with mke2fs -d: the old commands lose var/lib/omamobile, the new ones dump all three. Two tests close mutants the review found surviving: a dhcp-option value in another file is found, and a path that only ends in etc/dnsmasq.conf (xetc/dnsmasq.conf) gets no exemption. The test-install runbook now says to run omarchy update on the phone as its user, never as root over USB SSH (#548). Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- tests/release | 21 +++++++++++++++++++++ tools/release | 30 ++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/tests/release b/tests/release index 75b78f37b..d12a38c98 100755 --- a/tests/release +++ b/tests/release @@ -135,6 +135,27 @@ done printf 'serial-ABC1234 is another word\n' > "$t/scan/bad.bin" run scan "$t/scan" || fail "a listed identifier matches only as a whole word" rm "$t/scan/bad.bin" +# dnsmasq's shipped example configuration (2026.11.08): its group address and +# a dhcp-option value pass in etc/dnsmasq.conf only; a unicast dhcp-host there, +# and a group-looking address elsewhere (a Bluetooth LE random address can +# look like one), are still found. Addresses put together, as above. +grp=$(printf '%s:%s' 11:22:33 44:55:66) opt=$(printf '%s:%s' e4:45:74 68:00:00) doc=$(printf '%s:%s' 00:00:5e 00:53:01) +mkdir -p "$t/scan/etc" +printf '#dhcp-host=%s,192.168.0.60\n#dhcp-option=128,%s\ndhcp-option=128,%s\n' "$grp" "$opt" "$opt" > "$t/scan/etc/dnsmasq.conf" +run scan "$t/scan" || fail "dnsmasq's example group address and option bytes pass in etc/dnsmasq.conf" +printf 'dhcp-host=%s,192.168.0.61\n' "$doc" >> "$t/scan/etc/dnsmasq.conf" +if run scan "$t/scan"; then fail "a unicast dhcp-host in etc/dnsmasq.conf is found"; fi +printf '#dhcp-option=128,%s # %s\n' "$opt" "$doc" > "$t/scan/etc/dnsmasq.conf" +if run scan "$t/scan"; then fail "a real address after an exempt value on one line is found"; fi +rm "$t/scan/etc/dnsmasq.conf" +printf 'paired %s\n' "$grp" > "$t/scan/etc/other.conf" +if run scan "$t/scan"; then fail "a group-looking address outside etc/dnsmasq.conf is found"; fi +printf 'dhcp-option=128,%s\n' "$doc" > "$t/scan/etc/other.conf" +if run scan "$t/scan"; then fail "a dhcp-option value outside etc/dnsmasq.conf is found"; fi +mkdir -p "$t/scan/xetc"; printf '#dhcp-option=128,%s\n' "$doc" > "$t/scan/xetc/dnsmasq.conf"; rm "$t/scan/etc/other.conf" +if run scan "$t/scan"; then fail "a file named like etc/dnsmasq.conf but not it (xetc/) is found"; fi +rm -r "$t/scan/xetc" +rm -r "$t/scan/etc" pass "the scan finds real MACs, serial records, the builder's home and listed identifiers, not made-up MACs or example paths" # --- packages: only the release key's index --- diff --git a/tools/release b/tools/release index 148a56e7a..4ed441e16 100755 --- a/tools/release +++ b/tools/release @@ -587,6 +587,7 @@ st_test_install() { "uname -r # $krel" \ "systemctl is-failed omamobile-firstboot # inactive (it ran and removed its file)" \ "pacman -Q $(desc PACKAGE)" \ + "# On the phone, as its user (a terminal or the Updates app), never as root:" \ "omarchy update # clean, from stable" \ "# Then the package-hook kernel update and a reboot into it (§12.10;" \ "# device/cheetah/KERNEL-UPDATE-PLAN.md has the steps), and:" \ @@ -594,6 +595,9 @@ st_test_install() { ((dry)) || die "waiting for the attended install" } +# Whether an ext4_list file names this directory +ext4_has() { grep -qxF -- "$2" "$1"; } + # File list of an ext4 image, one path per line, read with debugfs (no root, # no mount): one debugfs run per directory level ext4_list() { @@ -623,7 +627,9 @@ PY # Identifier scan (§11.7, AGENTS.md §1) over files and directories, text and # binary alike: universally administered MAC addresses (locally administered -# ones, x2/x6/xA/xE, and all zeros or all ones are made up), serial and IMEI +# ones, x2/x6/xA/xE, and all zeros or all ones are made up; so are, in +# /etc/dnsmasq.conf alone, the group addresses and dhcp-option bytes of +# dnsmasq's shipped example configuration), serial and IMEI # records, this machine's home directory (/home/: a build path that # leaked; other /home/ paths are upstream examples and build hosts, as # in Neovim plugins and Alpine's libc), and each literal of the identifiers @@ -654,6 +660,12 @@ def scan(path): whole = (m.group(1) + m.group(2)).lower() if first & 2 or whole in (b"00:00:00:00:00:00", b"ff:ff:ff:ff:ff:ff"): continue + # dnsmasq's shipped example configuration only: its group address + # (no Wi-Fi or Ethernet card has one, but a Bluetooth LE random + # address can look like one, so not image-wide) and option bytes + line = data[data.rfind(b"\n", 0, m.start()) + 1:m.start()] + if path.endswith("/etc/dnsmasq.conf") and (first & 1 or re.search(rb"^\s*#?\s*dhcp-option=[^#]*$", line)): + continue report(path, "MAC address", whole) for what, rx in rules: for m in rx.finditer(data): @@ -705,9 +717,19 @@ st_identifiers() { ext4_list "$t/root.img" > "$rel/rootfs-files.txt" note "$(wc -l < "$rel/rootfs-files.txt") paths ($rel/rootfs-files.txt)" # What the build wrote rather than a package: configuration and our files - mkdir -p "$t/rootfs" - printf 'rdump /etc %s\nrdump /root %s\nrdump /usr/share/omamobile %s\nrdump /var/lib/omamobile %s\n' \ - "$t/rootfs" "$t/rootfs" "$t/rootfs" "$t/rootfs" | debugfs -f - "$t/root.img" >/dev/null 2>&1 || true + # at their own paths: rdump puts each directory by its last name under the + # target, and two "omamobile" under one target made debugfs refuse the + # second (/var/lib/omamobile went unscanned until 2026-11-09) + local d + for d in /etc /root /usr/share/omamobile /var/lib/omamobile; do + ext4_has "$rel/rootfs-files.txt" "$d" || continue + mkdir -p "$t/rootfs${d%/*}" + printf 'rdump %s %s\n' "$d" "$t/rootfs${d%/*}" + done | debugfs -f - "$t/root.img" >/dev/null 2>&1 || true + for d in /etc /root /usr/share/omamobile /var/lib/omamobile; do + ext4_has "$rel/rootfs-files.txt" "$d" || continue + [[ -d $t/rootfs$d ]] || die "debugfs didn't dump $d from the root image, so it can't be scanned" + done rm -f "$t/root.img" # The release initramfs the boot images carry mkdir -p "$t/initramfs" From b8f84cae0d15e82465a730f8e1b534463e83ebd0 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 11:32:22 -0500 Subject: [PATCH 35/66] release notes 2026.11.08 (#549) * release notes 2026.11.08 The notes for the first public release: kernel-2026.11.08 (1a9d1d4e9289), Omarchy held at 4.0.6, what changed since the 2026.11.03 candidate (double tap to wake, the reboot reason, the flat-battery charger re-check, the touch, Wi-Fi and RTC fixes, the shell's changes), and the known issues the test install found: Google's firmware still a separate provisioning step, omarchy update as root over SSH (#548), the flat battery recovery (#169), the modem stop (#532), Omarchy 4.5 phones, systemd-firstboot. tools/release scan: no identifiers. Co-Authored-By: Claude Opus 5.5 * release notes 2026.11.08: the right bundle, and claims this release can back From review: the Installing section still named the 2026.11.03 bundle and URL; the flat-battery item claimed a recovery the model-load retry hasn't shown on a real flat battery (#169 is open); "and sound" named nothing; the kernel-update claim now rests on this release's own test install; Hyprland is 0.57.0-3.2 on stable; bare issue numbers are links. The OMARCHY_PATH known issue was wrong about where root's update stops (before updating anything), and incomplete: with the variable set by hand the 2026-11-09 test run went on and ran Omarchy's migrations again as root. It now says to run the update as the user, and that omamobile-omarchy 0.1.38 (#548) refuses root. Co-Authored-By: Claude Opus 5.5 * release notes 2026.11.08: the hook ran on a reinstall, not a kernel update The test install's hook run came from reinstalling the release's own linux-omamobile: four images matched and vendor_kernel_boot was rewritten because the hook adds the owner's SSH key to its initramfs. Say so, and point at the 2026-11-02 update and rollback for a real kernel update through the same omamobile-boot-update 0.1.0. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- docs/release-notes/2026.11.08.md | 100 +++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 docs/release-notes/2026.11.08.md diff --git a/docs/release-notes/2026.11.08.md b/docs/release-notes/2026.11.08.md new file mode 100644 index 000000000..7fe58138d --- /dev/null +++ b/docs/release-notes/2026.11.08.md @@ -0,0 +1,100 @@ + +# Omarchy Mobile 2026.11.08 (developer preview) + +The first release of Omarchy Mobile: native Omarchy (Arch Linux ARM, Hyprland and Omarchy's own packages) on the Google Pixel 7 Pro, with a mainline Linux kernel and no Android underneath. This is a **developer preview**: it installs and runs as an everyday Linux phone for people comfortable with fastboot, but some hardware is still being worked on (below), installing erases the phone's data, and stock Android stays on slot A as the way back. + +Omarchy Mobile is a community project built on [Omarchy](https://omarchy.org). It is not an official Omarchy or Basecamp product, and it is not affiliated with or endorsed by Google. + +## What's in it + +- **Device:** Google Pixel 7 Pro (`cheetah`, Tensor G2 / gs201). No other phone is part of this release. +- **Kernel:** `kernel-2026.11.08`, linux-omarchy-mobile's `omamobile` branch at `1a9d1d4e9289` (Linux 7.3-rc6 plus our drivers); `uname -r` is `7.3.0-rc6-omamobile-g1a9d1d4e9289`. The source is public at that tag before any binary ships. +- **Userspace:** Arch Linux ARM, Omarchy 4.0.6 (held at that version in `[omamobile]` until our patches are ported to 4.5) with our pending patches (re-applied after every Omarchy upgrade), and the signed `[omamobile]` repository (pkgs.omamobile.org, stable channel) for the phone shell, Mesa for the Mali-G710, Hyprland, libcamera and the device support packages. +- **Updates:** `omarchy update` on the phone, from the stable channel, kernel included: the kernel is the `linux-omamobile` package, and `omamobile-boot-update`'s pacman hook writes a new one to slot B (it never reboots by itself; the update sheet asks for a restart). Both are in this release's root image. On the test install of this release, a reinstall of its `linux-omamobile` ran the hook: it rebuilt slot B's five images, left the four that matched, wrote `vendor_kernel_boot` (its initramfs gains the owner's SSH key, which the bundle's doesn't carry), read it back, and the phone booted it. An update to a newer kernel hasn't run on 2026.11.08 yet; the same `omamobile-boot-update` 0.1.0 wrote and rolled back one on 2026-11-02. + +### Hardware on the Pixel 7 Pro + +From [docs/DEVICES.md](../DEVICES.md) on the release day: + +| Works | Notes | +| --- | --- | +| Boot, storage | Slot B with stock Android kept on slot A; the Arch root on `userdata` behind a read-only guard for every other partition | +| Display | 120 Hz, brightness, the panel sleeps with the screen off | +| GPU | Mali-G710 on Panthor with Mesa, frequency scaling | +| Touch, buttons, haptics, torch | Touchscreen, power and volume keys, vibration through feedbackd, the torch tile | +| Wi-Fi, Bluetooth | Wi-Fi (stays connected across sleep); Bluetooth pairing and A2DP audio (headset calls not yet) | +| Modem | Calls, texts and mobile data on the one network tested so far (a Verizon-network SIM), the stack started at boot once the phone is provisioned; the carrier's APNs come from the SIM ([#373](https://github.com/derekross/omarchy-mobile/pull/373); see Known issues) | +| Battery, charging | Fuel gauge with the stock battery model; charging with a temperature guard | +| Speakers, microphones | Both speakers in stereo under Google's speaker-protection firmware with the phone's own calibration, plus the microphones; at the louder level, a little below stock's maximum volume, on a phone whose speaker firmware is the verified one (today: the factory image cp2a.260705.006); other phones start at a quieter everyday level until their firmware is verified | +| Sensors | Accelerometer (auto-rotate), light, proximity and compass | +| GNSS | Location through GeoClue, with a quick-settings tile | +| NFC | Reads and writes tags; a tag with a link opens it | +| Cameras | Main, ultrawide and front through libcamera; the telephoto at fixed focus | +| Fingerprint | Starts automatically after provisioning: enrollment offered at setup, unlock on the lock screen | +| CPU | Frequency scaling and thermal zones | + +### New in the last weeks + +- **Double tap to wake:** a double tap on the dark screen wakes the lock screen, and a single touch, a pocket or a brush of the palm leaves it dark. Covered by a hand or a pocket (the proximity sensor reads near), a double tap is ignored too. +- **`reboot-to bootloader` reaches fastboot by itself:** the kernel writes the bootloader reason where Google's driver does, so no button combination is needed. +- **A low battery starts charging sooner:** the charger looks again every 2 s for the battery reading instead of waiting 30 s with charging off, and the battery gauge retries a failed model load. The retry hasn't met a really flat battery yet ([#169](https://github.com/derekross/omarchy-mobile/issues/169)); if the phone keeps restarting on the cable, see Known issues. +- **Touch, Wi-Fi and the clock:** a touchscreen variant that sends no identify report now probes; Wi-Fi skips scan results on bands the chip can't use; the clock (the power chip's RTC) reads correctly, and every RTC-timed sleep wakes on time in our tests (10 of 10). +- **Recent apps** stay on the card you were on when another window closes. +- **The battery's reported state** (charging, full, not charging) in the shell. +- **The Hotspot tile** brings the DHCP server it needs (dnsmasq). +- **The Greek keyboard** has a row of accented vowels, and Omarchy's About window fits the screen. +- **Phone, Contacts and Messages** come in the image: Omarchy Mobile's own apps for the dialpad, call log, favorites and contacts (with import and export), and SMS conversations with drafts and search. With the modem up they place and take calls and send and receive texts (below); without it a call is refused with "No modem is available" and a text you send is kept, marked "Not sent", to retry later. +- **The modem, on by default: calls, texts and mobile data work on the tested network.** Once `tools/phone-provision` has put Google's modem files, your backup's checksums and the phone's board id on the phone, the modem stack starts at every boot on its own (`omamobile-modem-boot.target`: the modem, the radio service, the data fallback and the bridge the apps use). The APNs and the bearer order are chosen from the SIM, read once at boot, so there is nothing to type for a SIM the carrier database knows; a Verizon-network SIM is the one tested end to end (VoLTE calls both ways, texts over IMS, data behind Wi-Fi; known issues below). Nothing starts before provisioning, and the Mobile data tile says why the modem is off when it is (a boot after a hang, a phone not provisioned). +- **Voice input, ready out of the box:** a voice bar on the keyboard with live words as you speak, on-device speech recognition, and a setting for the longest recording. Voxtype and its English speech model (Whisper base.en) come in the image, so dictation works from the first login with no setup step and no download, offline too. +- **Media controls** with album art in the notification shade and on the lock screen. +- **Lock screen:** a glance view (time, date, weather, notifications), the battery level, and a clock that follows the bar's 12/24-hour setting. +- **Fluid home and drawer gestures**, pill gestures, and hiding or showing the keyboard from the home pill. +- **Keyboard:** themed, with an action row in every layout and a language sheet from the globe key. +- **Updates** entry in the app drawer, with an update sheet that shows what's new and the phone's patches. +- **Louder speakers** under the protection firmware, and an earpiece mode for calls. +- **The louder speaker level from the first start, on phones with the verified firmware:** if the speaker-protection firmware `tools/phone-provision` copies from your factory image is the one verified on the reference phone (today that is factory image cp2a.260705.006; Google's files, byte for byte), the speakers run at the louder level right after the install, with no verification step on your phone. The watchdog still checks your phone at its first song (the protection running on your phone's own calibration, plausible coil temperatures) and falls back to the quieter level if anything looks wrong. Phones on other factory images start at the quieter everyday level until their firmware is verified. `omamobile-speaker-protection status` says which. +- **Files** opens folders with a single tap; the file chooser no longer stalls at login. +- **Fingerprint unlock after provisioning:** the phone makes its read-only copies of the calibration and `persist:/ss` itself, and setup offers "Add a fingerprint" after the PIN. +- **Screenshots and images:** tapping a screenshot's notification opens it in a touch image viewer (pinch and double-tap to zoom, swipe to the next, copy, share or delete), which is also the default for every image. + +## Known issues + +- **Calls, texts and mobile data work on the tested network.** Tested on the reference phone with one Verizon-network SIM (Tracfone): VoLTE calls both ways, texts over IMS, and mobile data as a fallback route behind Wi-Fi ([DEVICES](../DEVICES.md)). Other networks are untested. The SIM's APNs and bearer order come from its carrier, read once from the SIM at boot ([#373](https://github.com/derekross/omarchy-mobile/pull/373)): a Verizon-network SIM is the one proven end to end; other carriers take the carrier database's APNs, and the Mobile network page under Setup shows and corrects them. Call audio through the earpiece works at every speaker stage (`omamobile-audio` 0.5.13), on by default (`omamobile-modem-sit` 0.3.30 with `omamobile-device-cheetah` 0.1.44). A development install whose `/etc/omamobile/modem-sit.conf` was edited (the Mobile network page writes it) keeps its `card = none` line: delete it for call audio. With the modem up the phone never sleeps (the stack holds a sleep inhibitor, because suspend with the modem up isn't qualified), and each restart with the modem up costs one recovered storage error-handler pass. After a hang or a forced reset with the modem up, the next boot leaves the modem off once (the Mobile data tile says "Off after a hang or reset"; `journalctl -b -1 -u omamobile-modem` has that boot's line) and the boot after starts it again; if that boot ends the same way, the modem stays off (the tile adds "(held)") until the markers are cleared by hand (`sudo rm -f /var/lib/omamobile/modem-up /var/lib/omamobile/modem-up.refused-*`, then restart the phone), and a clean reboot in between resets the count. `sudo touch /etc/omamobile/modem-hold` holds it from the first time. To keep the whole stack off: `sudo systemctl mask omamobile-modem-boot.target` (`disable` doesn't remove the package's link, and `systemctl is-enabled` reads "disabled" either way). +- **Suspend: works when asked for, auto-sleep off by default.** `systemctl suspend` sleeps and wakes reliably (on a key or the RTC), Wi-Fi stays connected across it, and standby lasts about 16 hours, well short of stock's. Auto-sleep after the screen goes off ships **off**; it can be turned on with `omarchy-toggle omamobile-sleep on`, but it hasn't finished a day-long test. With the modem up the phone doesn't sleep at all (above). Wi-Fi traffic and a USB plug can't wake the phone. +- **Cameras:** basic image quality (no Google ISP or tuning); the telephoto doesn't focus. +- **Bluetooth:** headset calls (HFP) don't work yet. +- **USB-C:** the phone is a USB device only (no host mode or role switch yet); after a replug, `omamobile-usb-rescue` reconnects it. +- **Fingerprint starts once per boot by design:** if it stops, restart the phone. Its first start writes the phone's secure storage (Trusty's area in the RPMB, the same kind of write as an Android factory reset); `persist` and `mfg_data` are only read. Fingers are enrolled again after a reinstall. To keep it off, `sudo systemctl mask omamobile-fp`. +- **Google's firmware is not included** and never will be, and installing it is still a separate step: after the first start, run the bundle's `tools/phone-provision` with your own factory image for your phone (Wi-Fi, Bluetooth, haptics, speakers, sensors, the modem, cameras and the fingerprint sensor), then restart the phone. Until then Wi-Fi, sound, the modem and fingerprint don't work, and the setup can't offer a fingerprint. A guided installer that does this on its own is the next release's goal. +- **Run `omarchy update` as yourself, never as root:** from the phone's terminal or the Updates entry. As root over SSH it stops before updating anything, with "OMARCHY_PATH: unbound variable"; set by hand, the variable lets it continue, and Omarchy then runs every one of its migrations again as root (it keeps their record per user), which swaps the shell's quickshell for an older build. `omamobile-omarchy` 0.1.38 refuses a root update and says why ([#548](https://github.com/derekross/omarchy-mobile/pull/548)); it reaches the development channel first. +- **A completely flat battery:** if the phone keeps restarting on the cable, hold Volume Down + Power for fastboot and leave it there on the charger for 20-30 minutes (`fastboot getvar battery-voltage` should pass 3.8 V), then choose Start ([#169](https://github.com/derekross/omarchy-mobile/issues/169)). +- **Stopping the modem** (`systemctl stop omamobile-modem`) takes 40 s and is logged as a crash ([#532](https://github.com/derekross/omarchy-mobile/issues/532)), though it stops cleanly; to get the modem back, restart the phone rather than starting it again. +- **Omarchy 4.5:** this release is built for Omarchy 4.0.6. A phone that already took Omarchy 4.5 before the hold isn't supported by this release's patches yet. +- **`systemd-firstboot` fails once** on the first start (the phone has no console); Omarchy Mobile's own first-boot setup does its job. + +## Phones already running a development build + +A phone installed before this release (from the repository, not this bundle) needs two things once before `omarchy update` works again: + +- **The new keyring.** Packages are now signed with the Omarchy Mobile release key, which keyrings before `omamobile-keyring` 20261026 don't know. Until it's installed, pacman refuses the `[omamobile]` repository ("key DDBA4581E0178D33DB69973F7F1041BF47291504 is unknown"). Install it as a local file, which pacman takes without the key: download `omamobile-keyring-20261026-1-any.pkg.tar.zst` from `https://pkgs.omamobile.org/stable/aarch64/` and run `sudo env OMARCHY_ALLOW_DIRECT_PACMAN=1 pacman -U` on it (Omarchy's update guard otherwise asks you to use `omarchy update`). Then check that `pacman-key --list-keys DDBA4581E0178D33DB69973F7F1041BF47291504` names the Omarchy Mobile Release Key, under the fingerprint at the end of these notes. +- **Hyprland 0.57 together with its libraries.** Arch Linux ARM moved to new Hyprland libraries on 2026-11-02, and the older Hyprland can't be installed next to them. `omarchy update` brings `hyprland` 0.57.0-3.2 or later (our build, with the DPMS fix) and `omamobile-shell` 0.2.79 or later in the same update; take both, then restart the phone. Without shell 0.2.79, Hyprland 0.57 draws the shell's transparent layers black (a black home screen). + +The kernel stays as it is: on a development install, `omamobile-boot-update` is off unless `/etc/omamobile/boot-update.conf` says `AUTO_WRITE=yes`, so slot B is still written by `bin/omamobile push`. + +Two things change on their own with the update. **The modem stack now starts at boot:** once the update brings `omamobile-device-cheetah` 0.1.43, a phone that is provisioned (Google's modem files, the backup's checksums and the board id in place) brings the modem, the radio service, the data fallback and the apps' bridge up at every start, as a fresh install does; a phone that isn't provisioned leaves it off. To keep it off, `sudo systemctl mask omamobile-modem-boot.target` (and `unmask` to turn it back on); `disable` doesn't remove the package's link. **Fingerprint starts at boot** too, after provisioning (known issues above); `sudo systemctl mask omamobile-fp` keeps it off. + +## Installing + +Follow [docs/INSTALL.md](../INSTALL.md), step by step. In short: a Pixel 7 Pro with an **unlocked bootloader**, a Linux computer with `fastboot` and the tools INSTALL.md lists, and Google's factory image for `cheetah`. Download the one file `omamobile-cheetah-2026.11.08.tar` with its `.tar.sha256` (and `.tar.sha256.sig`, to check the signature) from `https://pkgs.omamobile.org/releases/cheetah/2026.11.08/`, check it with `sha256sum -c`, unpack it with `tar -xf`, then run `bash install --dry-run` and `bash install` in the unpacked folder. After the first start, back up the phone's radio partitions with the bundle's `bash tools/nv-backup BACKUP-DIR` (INSTALL.md step 6; read-only, keep the backup folder private: it holds your IMEI), then add Google's firmware with `bash tools/phone-provision --nv-backup BACKUP-DIR FACTORY-IMAGE.zip` (INSTALL.md step 7). + +If the installer stops about the bootloader slots, don't work around it: [open an issue](https://github.com/derekross/omarchy-mobile/issues). + +What it writes: slot B's `boot`, `init_boot`, `vendor_boot`, `vendor_kernel_boot` and `dtbo`, and `userdata` (**erased**). It never touches slot A, the bootloader, radio, `persist`, `efs`, `modem`, `devinfo` or `vbmeta`. + +## Going back to stock Android + +Stock Android is still on slot A. In fastboot: `fastboot --set-active=a`, then `fastboot reboot`, and factory-reset Android when it asks (its data was erased by the install). Or flash Google's factory image for `cheetah`. Before you first boot stock again, note that stock's modem stack rewrites `efs`, `persist` and `modem_userdata`; keep your read-only backup of them. + +## Checksums and signatures + +The bundle's `SHA256SUMS` is signed with the Omarchy Mobile release key (`2056 7593 566E EEE2 DD88 6460 8632 C807 5EB9 4673`); its `MANIFEST` and `manifest.json` name the root image and its SHA-256, so the installer checks the root image against the signed record before it contacts the phone. From 8a059a7244baed493addcceeb0e3af38063c62a0 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 11:32:27 -0500 Subject: [PATCH 36/66] device/cheetah: NOTES, the 2026.11.08 test install, and an update run as root (#560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * device/cheetah: NOTES, the 2026.11.08 test install, and an update run as root The release record §11.6 asks for: the signed bundle's install, the hand provisioning, a kernel update through omamobile-boot-update's hook, and a clean omarchy update as the user. It also records what a root update did to the phone and how it was put back (#548). Co-Authored-By: Claude Opus 5.5 * device/cheetah: NOTES, the hook ran on a reinstall; the root run had OMARCHY_PATH set From review: the 00:42 hook run came from reinstalling the release's own linux-omamobile, and vendor_kernel_boot differed from the bundle's because the hook adds the owner's authorized_keys to the initramfs. The root update had OMARCHY_PATH set by hand; vulkan-headers came and went with the quickshell swap; and the 2026-11-03 gotcha that gave the recipe now says not to. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- device/cheetah/NOTES.md | 56 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/device/cheetah/NOTES.md b/device/cheetah/NOTES.md index ef837f802..515269d1b 100644 --- a/device/cheetah/NOTES.md +++ b/device/cheetah/NOTES.md @@ -2,6 +2,58 @@ Findings from real hardware, newest first. `BRINGUP-M1.md` is the research map written before first boot. +## 2026-11-09: the 2026.11.08 test install, and an update run as root + +The release's signed bundle, `omamobile-cheetah-2026.11.08`, installed on the +reference phone with `bash install --reinstall --bootloader-slots-match +cloudripper-17.0-15199429` (slot A's bootloader version in the stock +capture, the same as slot B's), after `--dry-run`. The phone booted +`7.3.0-rc6-omamobile-g1a9d1d4e9289` with `omamobile-device-cheetah` 0.1.47, +`omamobile-shell` 0.2.107, `omamobile-omarchy` 0.1.37 and Omarchy 4.0.6. + +- **Provisioning, by hand** (`tools/phone-provision --nv-backup`, the + owner's CP2A factory image and the 2026-11-03 radio backup, whose + checksums still matched): after the reboot Wi-Fi, the AoC and the + fingerprint stack were up, and the modem came up at boot and registered + IMS by itself. No unit failed. `tools/phone-smoke`: 18 ok, the modem's + usual "not opened" lines, the camera check skipped. The fingerprint + sensor reads ready with no finger enrolled. +- **The package hook, on a reinstall:** at 00:42 a reinstall of the + release's own `linux-omamobile` (`pacman -U`, the same + `7.3.0rc6.r704.g1a9d1d4e9289-1`) ran `omamobile-boot-update`'s hook + (the install's `AUTO_WRITE=yes`). It rebuilt slot B's five images and + wrote `vendor_kernel_boot_b`, read it back ("written and verified"), left the + other four images ("already there"), saved the previous set and did not + reboot. The reboot into it worked. The one image differed because the + hook appends the owner's `authorized_keys` to the initramfs and the + bundle's image carries none: the saved slot-B copy equals the bundle's + byte for byte, and the new one has a vendor ramdisk 171 bytes longer + (6847295 against 6847124), so a fresh install's initramfs SSH has no + owner key until the first hook run (RELEASES §11.4 expects the same + bytes). An update to a newer kernel hasn't run on this release yet. +- **`omarchy update` as root over SSH**, with `OMARCHY_PATH` set by hand + (the command we gave the owner; without it the run stops before + updating anything), ran Omarchy's migrations again as root: Omarchy records them per user, and + root's record was empty, so 59 ran. One swapped `quickshell` for an older + `quickshell-git` (Omarchy's later migration back counted as done), others + wrote configs into `/root`, restarted systemd-oomd and left + `/tmp/omarchy-update.log` owned by root, after which the Updates app + stopped at once ("script: cannot open /tmp/omarchy-update.log: Permission + denied"). Nothing else in `/etc` changed, and no package moved apart + from that swap (with `vulkan-headers`, which it pulled in) and the + normal updates. + Put back by hand: `quickshell` reinstalled, `vulkan-headers` removed, root's + Omarchy state and configs and the log deleted. `omamobile-omarchy` 0.1.38 + (#548) refuses an update as root. +- **The update as the user** (the Updates app, 11:06): "Updated", one + package (`inotify-tools`, from Arch Linux ARM), Omarchy still 4.0.6, + nothing held, no restart asked for; patches "already applied". The + "local is newer than omamobile" warnings are the stable channel still + holding the previous release until the promote. + +Recorded with `tools/release --version 2026.11.08 test-install --passed +7.3.0-rc6-omamobile-g1a9d1d4e9289`. + ## 2026-11-08: the release kernel for 2026.11.08, a flat battery, the reboot reason Kernel `7.3.0-rc6-omamobile-g1a9d1d4e9289`, `omamobile` at `1a9d1d4e9289` @@ -93,7 +145,9 @@ the same Verizon-network SIM as the entry below. The runbook: minutes after sitd starts: the modem's OEM IPC channel, which nothing opens. A follow-up. - **Gotcha:** `omamobile-update` over ssh as root needs - `OMARCHY_PATH=/usr/share/omarchy` in its environment. + `OMARCHY_PATH=/usr/share/omarchy` in its environment. **Don't (2026-11-09):** + an update as root runs Omarchy's migrations again as root; run + `omarchy update` on the phone as its user (above, 2026-11-09). ## 2026-11-03: IMS registered and an SMS sent on a Verizon-network SIM, once the bearers took stock's CIDs From 09b7eb222f9e208a394cbe03fddffb78de448023 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 11:32:31 -0500 Subject: [PATCH 37/66] omamobile-omarchy 0.1.38: omamobile-update refuses to run as root, and passes OMARCHY_PATH on (#548) * omamobile-omarchy 0.1.38: omarchy update without a session environment Omarchy's update scripts read OMARCHY_PATH under set -u, and a session gets it from Omarchy's env-bootstrap. A root login over SSH or a TTY has none, so `omarchy update` there stopped after updating, in omarchy-update-dev ("OMARCHY_PATH: unbound variable"; the 2026.11.08 test install on the Pixel 7 Pro, over tools/phone-ssh). omamobile-update already knew the default, /usr/share/omarchy, but passed it only to the migrations it runs; it now sets it for Omarchy's update too when the environment has none. test/update.sh runs the sheet's update once more with OMARCHY_PATH removed from the environment and checks that omarchy-update receives Omarchy's path; against the previous omamobile-update that check fails. test/all: 233 ok. Co-Authored-By: Claude Opus 5.5 * omamobile-omarchy 0.1.38: omamobile-update refuses to run as root Omarchy records the migrations it has run in the caller's home (~/.local/state/omarchy/migrations). On 2026-11-09 the release test phone was updated from a root login over SSH: root's record was empty, so Omarchy ran 59 migrations again as root. One swapped quickshell for an older quickshell-git (Omarchy's own later migration swaps it back, but that one counted as done too), others wrote configs into /root and restarted systemd-oomd. Before the OMARCHY_PATH default in the previous commit, the same run stopped early on "unbound variable"; the default alone made the root path reachable. run, start, __inner and run-migration now refuse as root with exit 5 and say why; check, status and channel still answer. The tests stand in for root with OMAMOBILE_UPDATE_TEST_EUID. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .../omamobile-omarchy/bin/omamobile-update | 20 ++++++++++++++++++- packages/omamobile-omarchy/test/update.sh | 20 +++++++++++++++++++ packages/omamobile-omarchy/version | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-omarchy/bin/omamobile-update b/packages/omamobile-omarchy/bin/omamobile-update index 3e2023b29..890660547 100755 --- a/packages/omamobile-omarchy/bin/omamobile-update +++ b/packages/omamobile-omarchy/bin/omamobile-update @@ -37,7 +37,9 @@ directory of stand-ins first on PATH (/usr/lib/omamobile-omarchy/update-bin): omarchy-migrate (boot-related migrations held), sudo (non-interactive from the sheet) -Before anything is downloaded it refuses: below 30% battery unless charging, +It never runs as root (Omarchy records its migrations per user, and root's +record is empty). Before anything is downloaded it refuses: below 30% +battery unless charging, when /etc/pacman.conf doesn't list [omamobile] first and [omarchy] before Arch Linux ARM's repositories, when [omarchy] isn't Omarchy's stable channel, and when the update would install another distribution's kernel, @@ -106,6 +108,8 @@ PATCH_STATUS = os.environ.get("OMAMOBILE_PATCH_STATUS", "/var/lib/omamobile/omar NOTIFY = os.environ.get("OMAMOBILE_NOTIFY", "omarchy-notification-send") OMARCHY_PATH = os.environ.get("OMARCHY_PATH") or "/usr/share/omarchy" MIN_BATTERY = int(os.environ.get("OMAMOBILE_MIN_BATTERY", "30")) +# Tests stand in for root here; nothing else should set it. +EUID = int(os.environ.get("OMAMOBILE_UPDATE_TEST_EUID") or os.geteuid()) MIN_FREE = 10 * 1024 ** 3 # omarchy-update-requires-free-space's limit UNIT = "omamobile-update" RELEASE_NOTES = "https://github.com/basecamp/omarchy/releases/latest" @@ -770,6 +774,10 @@ def inner(args): omarchy_line = next((l for l in lines if l.split()[0] in ("omarchy", "omarchy-dev")), "") print("%d package(s) to update%s" % (len(targets) or len(lines), "; " + omarchy_line if omarchy_line else ""), flush=True) + # Omarchy's scripts read OMARCHY_PATH under set -u (omarchy-update-dev: + # "unbound variable"). A session gets it from Omarchy's env-bootstrap; + # a root login over SSH or a TTY doesn't, so pass the default on. + env.setdefault("OMARCHY_PATH", OMARCHY_PATH) env.update(PATH=SHIMS + ":" + env.get("PATH", "/usr/bin"), OMARCHY_UPDATE_LOGGED="1", OMAMOBILE_UPDATE="1", OMAMOBILE_UPDATE_DIR=RUNTIME, OMAMOBILE_SUDO=SUDO, OMAMOBILE_UPDATE_STARTED=str(int(time.time()))) return subprocess.run([OMARCHY_UPDATE, "-y"], env=env).returncode @@ -926,6 +934,16 @@ def main(argv): for b in result["blockers"]: print("Blocked: " + b) return 0 if result["ok"] else 1 + if cmd in ("run", "start", "__inner", "run-migration") and EUID == 0: + # Omarchy keeps the migrations it has run in the caller's home + # (~/.local/state/omarchy/migrations). Root's list is empty, so an + # update as root (a root login over SSH, as on 2026-11-09) ran every + # migration again as root: one swapped quickshell for an older + # quickshell-git, others wrote root's own configs. + print("omamobile-update: not as root. Run \"omarchy update\" as the phone's user, in a terminal on " + "the phone or from Settings: Omarchy records its migrations per user, and root's record is " + "empty, so every migration would run again as root.", file=sys.stderr) + return 5 if cmd == "run": return run(args) if cmd == "__inner": diff --git a/packages/omamobile-omarchy/test/update.sh b/packages/omamobile-omarchy/test/update.sh index 98d8efe0f..58b8e5a2c 100755 --- a/packages/omamobile-omarchy/test/update.sh +++ b/packages/omamobile-omarchy/test/update.sh @@ -66,6 +66,7 @@ EOF cat >"$fake/omarchy-update" <>"$calls" +echo "omarchy-update OMARCHY_PATH=\${OMARCHY_PATH-unset}" >>"$calls" for c in omarchy-snapshot omarchy-update-aur-pkgs omarchy-update-orphan-pkgs omarchy-migrate omarchy-update-restart sudo; do echo "resolve \$c \$(command -v \$c)" >>"$calls" done @@ -408,4 +409,23 @@ echo "omarchy 4.0.4-2 -> 4.0.5-1" >"$t/available" python3 -I "$U" notify-check >/dev/null; python3 -I "$U" notify-check >/dev/null ok "notify-check: one toast per release, opening the sheet" '[[ $(grep -c "^notify" "$calls") == 1 ]] && grep -c "summon omamobile.update" "$calls" >/dev/null' +# A root login over SSH (or a TTY) has no Omarchy session environment, and +# Omarchy's update scripts read OMARCHY_PATH under set -u: it still arrives +: >"$calls" +rc=0; out=$(printf '1234\n' | env -u OMARCHY_PATH python3 -I "$U" start) || rc=$? +ok "no OMARCHY_PATH in the environment: the update starts (exit 0, '$out')" '[[ $rc == 0 && $out == started ]]' +wait_done +ok "no OMARCHY_PATH in the environment: omarchy-update still gets Omarchy's (omarchy-update-dev)" 'grep -c "^omarchy-update OMARCHY_PATH=/usr/share/omarchy$" "$calls" >/dev/null' + +# As root (a root login over SSH, 2026-11-09) Omarchy's per-user migration +# record is empty and every migration ran again as root: refused, nothing runs +: >"$calls" +for c in run start run-migration; do + rc=0; out=$(printf '1234\n' | OMAMOBILE_UPDATE_TEST_EUID=0 python3 -I "$U" $c 2>&1) || rc=$? + ok "as root: $c refused (exit 5) and says why" '[[ $rc == 5 && $out == *"not as root"* ]]' +done +ok "as root: nothing reached omarchy-update or sudo" '[[ ! -s $calls ]]' +rc=0; OMAMOBILE_UPDATE_TEST_EUID=0 python3 -I "$U" check --json >/dev/null || rc=$? +ok "as root: check still answers (read-only, exit $rc)" '[[ $rc == 0 || $rc == 1 ]]' + exit $((failures > 0)) diff --git a/packages/omamobile-omarchy/version b/packages/omamobile-omarchy/version index 9f42295fc..5786113b6 100644 --- a/packages/omamobile-omarchy/version +++ b/packages/omamobile-omarchy/version @@ -1 +1 @@ -0.1.37 +0.1.38 From edb2a6b2855de7298e3ab6e6af14815a5c09517d Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 12:48:21 -0500 Subject: [PATCH 38/66] alarm.sh: fetch Omarchy's keyring, signature-checked and re-verified at every use, on a host without it (#547) * alarm.sh: fetch Omarchy's keyring, signature-checked, on a host without it The build image trusts [omarchy] through Omarchy's pacman keyring, taken from the host's /usr/share/pacman/keyrings. A build server that isn't an Omarchy machine has none: on ms01 (Ubuntu) the first publish dry run stopped there, and the stopgap was a hand copy of the desktop's files in a folder named by OMARCHY_KEYRING_DIR, which nothing keeps current when Omarchy rotates its keys. alarm_omarchy_keyring now fetches omarchy-keyring from Omarchy's repository (OMARCHY_CHANNEL, aarch64) when the host has no keyring, the way alarm_fetch checks the Arch Linux ARM tarball: the package's detached signature must be by Omarchy's packaging key (pinned: 40DFB630FF42BCFFB047046CF0134EE680CAC571, the key its omarchy-trusted names, fetched once from the keyserver and cached), and its SHA-256 the one the index lists (the index itself isn't signed, so it only names the file). The three files are cached in $ALARM_CACHE/omarchy-keyring with the version, and fetched again when the index names a newer one; with the index unreachable a cached copy is used and said so. An Omarchy host keeps using its own keyring, and an explicit OMARCHY_KEYRING_DIR is used alone, as before. Checked on the laptop with the host keyring hidden: the fetched files are byte-identical to the installed omarchy-keyring 20251027-1; a second run reuses the cache; a wrong pinned key is refused with nothing cached; an unreachable index fails without a cache and uses it with one; an explicit missing OMARCHY_KEYRING_DIR is refused; an Omarchy host still gets /usr/share/pacman/keyrings. Co-Authored-By: Claude Opus 5.5 * alarm.sh: the cached Omarchy keyring is verified at every use, and no rollback From review: on a version match, or with Omarchy's index unreachable, the cached keyring files were used unchecked, and since the version comes from the unsigned index, any older signed keyring would replace a newer cached one. The cache now keeps the package and its signature; each use checks the signature against the pinned key and that the three files are the package's own, byte for byte, and fetches again otherwise (or refuses with no index). An index naming an older version than the cache is refused. A host without bsdtar gets a message naming libarchive-tools. Checked against pkgs.omarchy.org with a scratch cache: fetch and reuse; an edited omarchy-trusted is fetched again and matches the laptop's installed keyring; one changed byte in the cached package with the index unreachable is refused; an index older than the cache is refused. Co-Authored-By: Claude Opus 5.5 * alarm.sh: the keyring package's own version must be the one the index names From review: the version came from the unsigned index alone, so an index pairing a newer %VERSION% with an older package Omarchy once signed would pass the checksum and signature and be cached under the newer number. The signed package's .PKGINFO pkgver must now equal it. Also a comment on why sort -V is enough for an epoch-less keyring. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- tools/lib/alarm.sh | 117 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 7 deletions(-) diff --git a/tools/lib/alarm.sh b/tools/lib/alarm.sh index 151db306a..296aefff0 100644 --- a/tools/lib/alarm.sh +++ b/tools/lib/alarm.sh @@ -28,9 +28,22 @@ ALARM_TARBALL=$ALARM_CACHE/ArchLinuxARM-aarch64-latest.tar.gz # hyprland). Stable, the release the phone's Omarchy patches follow; edge # carries release candidates (4.5.0rc1 on 2026-10-20) they may not apply to. OMARCHY_CHANNEL=${OMARCHY_CHANNEL:-stable} -# The keyring that signs [omarchy], taken from this (Omarchy) laptop, which -# already trusts it: the container can't bootstrap that trust on its own. +# The keyring that signs [omarchy]. On an Omarchy machine it is the host's +# (/usr/share/pacman/keyrings, kept current by pacman), which already trusts +# it: the container can't bootstrap that trust on its own. A host without it +# (a build server on another distribution) fetches omarchy-keyring from +# Omarchy's repository instead, checked like the tarball: its detached +# signature must be by Omarchy's packaging key, pinned below, and its +# SHA-256 the one the repository's index lists. The three files are cached +# in $ALARM_CACHE/omarchy-keyring with the package and its signature, which +# are verified again at every use; the cache is refreshed when the index +# names a newer version and kept when it names an older one (a rollback is +# refused). Setting OMARCHY_KEYRING_DIR uses that folder and nothing else. +OMARCHY_KEYRING_DIR_SET=${OMARCHY_KEYRING_DIR:+1} OMARCHY_KEYRING_DIR=${OMARCHY_KEYRING_DIR:-/usr/share/pacman/keyrings} +# Omarchy : the key omarchy-keyring's omarchy-trusted names +OMARCHY_KEY=40DFB630FF42BCFFB047046CF0134EE680CAC571 +OMARCHY_PKGS_URL=${OMARCHY_PKGS_URL:-https://pkgs.omarchy.org} # A contributor's local signing key (tools/local-key-init; --local in # build-packages and build-rootfs): the path of its exported public key. # When set, the build image also trusts that key, locally signed, and only @@ -82,6 +95,98 @@ alarm_fetch() { alarm_die "bad or missing signature on $ALARM_TARBALL (expected key $ALARM_KEY)" } +# Verify an omarchy-keyring package against its detached signature by the +# pinned packaging key $OMARCHY_KEY. $1: the package, $2: its .sig. +_omarchy_keyring_verify() { + local gnupg status + gnupg=$(mktemp -d) + if [[ ! -s $ALARM_CACHE/omarchy-pkgs.asc ]]; then + GNUPGHOME=$gnupg gpg -q --batch --keyserver "$ALARM_KEYSERVER" --recv-keys "$OMARCHY_KEY" || + { rm -rf "$gnupg"; alarm_die "could not fetch Omarchy's packaging key $OMARCHY_KEY"; } + GNUPGHOME=$gnupg gpg -q --batch --armor --export "$OMARCHY_KEY" >"$ALARM_CACHE/omarchy-pkgs.asc" + else + GNUPGHOME=$gnupg gpg -q --batch --import "$ALARM_CACHE/omarchy-pkgs.asc" + fi + status=$(GNUPGHOME=$gnupg gpg --batch --status-fd 1 --verify "$2" "$1" 2>/dev/null || true) + rm -rf "$gnupg" + grep -Eq "^\[GNUPG:\] VALIDSIG .* $OMARCHY_KEY\$" <<<"$status" +} + +# The cached keyring is used only while its package still verifies and the +# three files are the package's own, byte for byte. $1: the cache folder. +_omarchy_keyring_cached_ok() { + local dir=$1 pkg f + pkg=$(cat "$dir/PACKAGE" 2>/dev/null) || return 1 + [[ -n $pkg && -s $dir/$pkg && -s $dir/$pkg.sig ]] || return 1 + _omarchy_keyring_verify "$dir/$pkg" "$dir/$pkg.sig" || return 1 + for f in omarchy.gpg omarchy-trusted omarchy-revoked; do + cmp -s "$dir/$f" <(bsdtar -xOf "$dir/$pkg" "usr/share/pacman/keyrings/$f") || return 1 + done +} + +# The folder holding omarchy.gpg, omarchy-trusted and omarchy-revoked; prints +# it. The host's when it has all three or OMARCHY_KEYRING_DIR was set, +# otherwise the verified copy described at OMARCHY_KEYRING_DIR above: the +# package and its signature are kept beside it and checked again at every +# use, and an index naming an older keyring than the cached one is refused. +alarm_omarchy_keyring() { + local f have=1 dir=$ALARM_CACHE/omarchy-keyring base want file sum tmp cached + for f in omarchy.gpg omarchy-trusted omarchy-revoked; do [[ -f $OMARCHY_KEYRING_DIR/$f ]] || have=0; done + if ((have)) || [[ -n $OMARCHY_KEYRING_DIR_SET ]]; then + ((have)) || alarm_die "no Omarchy keyring in OMARCHY_KEYRING_DIR=$OMARCHY_KEYRING_DIR (omarchy.gpg, omarchy-trusted, omarchy-revoked)" + echo "$OMARCHY_KEYRING_DIR"; return + fi + command -v bsdtar >/dev/null || alarm_die "fetching Omarchy's keyring needs bsdtar (libarchive-tools on Debian and Ubuntu)" + cached=$(cat "$dir/VERSION" 2>/dev/null || true) + if [[ -n $cached ]] && ! _omarchy_keyring_cached_ok "$dir"; then + alarm_say "The cached Omarchy keyring no longer verifies: fetching it again" >&2 + rm -rf "$dir"; cached= + fi + base=$OMARCHY_PKGS_URL/$OMARCHY_CHANNEL/aarch64 + tmp=$(mktemp -d) + if ! curl -fsSL -o "$tmp/omarchy.db" "$base/omarchy.db"; then + rm -rf "$tmp" + [[ -n $cached ]] || alarm_die "no Omarchy keyring on this host and $base/omarchy.db can't be fetched" + alarm_say "Omarchy's index can't be fetched: using the cached keyring ($cached, verified)" >&2 + echo "$dir"; return + fi + # The index isn't signed: it only names the file; the package's own + # signature and its listed SHA-256 are what's checked + read -r want file sum < <(bsdtar -xOf "$tmp/omarchy.db" --include='omarchy-keyring-*/desc' | + awk '/^%VERSION%$/ { getline; v = $0 } /^%FILENAME%$/ { getline; f = $0 } /^%SHA256SUM%$/ { getline; s = $0 } END { print v, f, s }') + [[ -n $file && -n $sum ]] || { rm -rf "$tmp"; alarm_die "omarchy-keyring isn't in $base/omarchy.db"; } + if [[ -n $cached && $want == "$cached" ]]; then + rm -rf "$tmp"; echo "$dir"; return + fi + # sort -V orders pkgver-pkgrel; Omarchy's keyring has no epoch (an epoch + # would read as older here, which stops the build rather than letting one in) + if [[ -n $cached && $(printf '%s\n%s\n' "$want" "$cached" | sort -V | tail -1) == "$cached" ]]; then + rm -rf "$tmp" + alarm_die "Omarchy's index names omarchy-keyring $want, older than the cached $cached: refusing a rollback (remove $dir to accept it)" + fi + alarm_say "Fetching Omarchy's keyring (omarchy-keyring $want)" >&2 + curl -fsSL -o "$tmp/$file" "$base/$file" && curl -fsSL -o "$tmp/$file.sig" "$base/$file.sig" || + { rm -rf "$tmp"; alarm_die "could not download $base/$file"; } + [[ $(sha256sum <"$tmp/$file" | cut -d' ' -f1) == "$sum" ]] || + { rm -rf "$tmp"; alarm_die "$file doesn't match the SHA-256 Omarchy's index lists"; } + _omarchy_keyring_verify "$tmp/$file" "$tmp/$file.sig" || + { rm -rf "$tmp"; alarm_die "bad or missing signature on $file (expected key $OMARCHY_KEY)"; } + # The version the index gave must be the signed package's own, or an old + # package Omarchy once signed could be cached under a newer number + [[ $(bsdtar -xOf "$tmp/$file" .PKGINFO | sed -n 's/^pkgver = //p') == "$want" ]] || + { rm -rf "$tmp"; alarm_die "$file isn't omarchy-keyring $want, the version Omarchy's index names"; } + mkdir -p "$tmp/x" && + bsdtar -xf "$tmp/$file" -C "$tmp/x" usr/share/pacman/keyrings/omarchy.gpg \ + usr/share/pacman/keyrings/omarchy-trusted usr/share/pacman/keyrings/omarchy-revoked || + { rm -rf "$tmp"; alarm_die "$file holds no Omarchy keyring"; } + f=$tmp/x/usr/share/pacman/keyrings + echo "$want" >"$f/VERSION"; echo "$file" >"$f/PACKAGE" + mv "$tmp/$file" "$tmp/$file.sig" "$f/" + rm -rf "$dir.new" && mv "$f" "$dir.new" && rm -rf "$dir" && mv "$dir.new" "$dir" + rm -rf "$tmp" + echo "$dir" +} + # The plain tarball as a Docker image; prints its tag. alarm_base_image() { local sum tag @@ -100,13 +205,11 @@ alarm_base_image() { # pacman.conf, base-devel, arch-install-scripts and a "builder" user with # this laptop's uid. Prints its tag. $1: the repository root. alarm_build_image() { - local root=$1 base tag hash ctx name + local root=$1 base tag hash ctx name keyring base=$(alarm_base_image) - for f in omarchy.gpg omarchy-trusted omarchy-revoked; do - [[ -f $OMARCHY_KEYRING_DIR/$f ]] || alarm_die "no $OMARCHY_KEYRING_DIR/$f: this needs Omarchy's keyring (omarchy-keyring) on the build machine" - done + keyring=$(alarm_omarchy_keyring) || exit 1 ctx=$(mktemp -d) - cp "$OMARCHY_KEYRING_DIR"/omarchy{.gpg,-trusted,-revoked} "$ctx/" + cp "$keyring"/omarchy{.gpg,-trusted,-revoked} "$ctx/" cp "$root"/packages/omamobile-keyring/omamobile{.gpg,-trusted,-revoked} "$ctx/" if [[ -n $ALARM_LOCAL_KEY ]]; then [[ -f $ALARM_LOCAL_KEY ]] || alarm_die "no local key $ALARM_LOCAL_KEY" From 1ce4c3ba5f46a1c3508bd532b90e9b01656557f8 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 13:16:14 -0500 Subject: [PATCH 39/66] docs/review: round 45's lessons (L-562 to L-597) (#551) Round 45's confirmed-candidate lessons from the omarchy-mobile and linux-omarchy-mobile reviews, plus five from the maintainer session of 2026-11-08 (the four build steps a test kernel needs for push, reboot-to and the modem's clean-stop marker, pacman steps on a non-Arch build host, a new dependency's example config and the identifier scan, and checkdepends). Six candidates that were second instances of existing lessons became "Again in round 45" sentences on L-333, L-427, L-430, L-454, L-532 and L-547. C-32 and C-33 correct round 44 on #420's 0029 (applies to omarchy 4.5.0-3 at fuzz 0) and on kernel #219's test phone (the cover letter names it). Co-authored-by: Claude Opus 5.5 --- docs/review/LESSONS.md | 323 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 323 insertions(+) diff --git a/docs/review/LESSONS.md b/docs/review/LESSONS.md index dd576e70c..96de25c09 100644 --- a/docs/review/LESSONS.md +++ b/docs/review/LESSONS.md @@ -483,6 +483,11 @@ never change, so reviews can cite them. that isn't cheetah; name a log line or a compositor query instead. Extends L-295 and L-276. *From:* kernel #212, round 44 (a near miss in drafting); 2026-11-08. + Again in round 45, the right way round: kernel #212's author counted the + DECON frame-start interrupt in `/proc/interrupts` under a redrawing terminal + (120/60/121 per second), read-only and device-neutral; name that (`grep -i + decon /proc/interrupts` twice, a second apart) when asking another phone for + a rate. - **L-533. A lens or OIS controller at the same I2C address as the module's calibration EEPROM is a calibration part.** Stock's tegu DT puts `eeprom-nessie`, `act-nessie` and `ois-nessie` all at 0x24: the LC898129 @@ -491,6 +496,33 @@ never change, so reviews can cite them. writes only the registers it names, and the notes list every register written during bring-up. Extends L-90 and L-108. *From:* kernel #213, round 44, 2026-11-08. +- **L-562. A custom recovery or installer in a contributor's record is a slot + question first.** Kodiak's notes said a step was "taken from" a third-party + recovery and sat merged through two rounds; the answer, "installed to + `vendor_boot` on both slots, may have mounted persist", means slot A was + written, the fallback recovery is no longer stock's, and the calibration + backup and slot B's rollback set may not be stock's either. *Check:* + whenever a third-party recovery, root tool or installer appears, ask which + partitions on which slots it wrote (`vbmeta` flags included), when relative + to each backup, and what it mounted; record a slot A write as a §3.1 event + and downgrade any backup taken under it (L-198). Extends L-186, L-198 and + L-35. *From:* #511 with #489 and #231, round 45, 2026-11-08. +- **L-563. A locally administered MAC that a PR makes persistent is an + identifier, and `tools/pr-check` exempts it and reads no commit message or + PR body.** #510 saves a random address pair per phone, so the contributor's + example in the body and commit now names their phone to every host it meets. + *Check:* for a PR that stores generated addresses or IDs, grep the body, + every commit message and the thread for them (the L-324 pattern without the + locally-administered exemption), and ask for placeholders and a rotation. + Extends L-324 and L-145. *From:* #510, round 45, 2026-11-08. +- **L-564. `reboot-to` (and `bin/omamobile push`) stops no unit, so with the + modem up it leaves `/var/lib/omamobile/modem-up` behind and the next boot + skips the modem once.** *Check:* a runbook or test plan that reboots a phone + with the modem up stops it first (`systemctl stop omamobile-modem`; it takes + about 40 s and ends as "failed" for now, issue #532), or uses `systemctl + reboot`. To keep the modem off for a boot it is `systemctl mask + omamobile-modem-boot.target`, not `/etc/omamobile/modem-hold`, which matters + only after an unclean end. *From:* the 2026-11-08 7 Pro session, issue #532. ## Shared code and the reference device @@ -903,6 +935,58 @@ never change, so reviews can cite them. data's `model`. *Check:* the driver's `v4l2_i2c_subdev_set_name` argument, the match table, and `git grep` of the compatible in the gs201 DTs. Extends L-206. *From:* #494, round 44, 2026-11-08. +- **L-565. An error-path-only fix in a shared driver is cheetah-neutral in + behaviour only while that error never happens, and its object still + changes.** Kernel #222's one `break` reallocated registers across + `s3c64xx_spi_transfer_one` (and moved the readl pool into `runtime_resume`'s + last line), and the 7 Pro has three SPI users that chunk in PIO. *Check:* + grep `logs/` for the error line the new branch follows (`I/O Error: rx-`: 0 + in 1000 logs) before calling the change invisible, and let the 7 Pro run + record "not exercised" with that count rather than "the fix works". Extends + L-51, L-206 and L-440. *From:* kernel #222, round 45, 2026-11-08. +- **L-566. A doc change we ask for in a shared package's plan is checked for + which phone it claims.** On #376 we asked that the 7 Pro's MODEM-PLAN stop + saying "a second start isn't supported" once the code changed; the reworded + line states the new behaviour as a 7 Pro fact, measured only on the 9a. + *Check:* for each sentence a PR changes under `device//`, find the run on + that device that supports it, or ask for "on the ; not yet run + here". Extends L-188 and L-31. *From:* #376, round 45, 2026-11-08. +- **L-567. A public device package tested next to a private companion is + checked for which safety nets live only in the companion.** #222's oriole + package installed cleanly, but only alongside a private package carrying the + reboot watchdog and a boot check, and `device.conf`'s `PACKAGE=` makes the + public one alone the image's device package. *Check:* when a smoke report's + package list names a `*-local-*` or private package, ask what it ships, and + map each safety file to the public package or to a "not supported yet" line + in the README. Extends L-61, L-158 and L-358. *From:* #222, round 45, + 2026-11-08. +- **L-568. L-8 runs without touching anyone's build directory.** Copy a kernel + output's `arch/arm64/boot/Image`, the device's DTBs, + `scripts/dtc/{dtc,fdtoverlay}`, `initramfs.cpio.lz4` and + `include/config/kernel.release` (and `initramfs.release`) into a scratch + `KERNEL_OUT`, then run `DEVICE=cheetah images` with main's `bin/omamobile` + (`git show origin/main:bin/omamobile`) and the PR's from the same worktree. + `images` writes only `$KERNEL_OUT/images`, and a stale build is fine for a + before/after compare. *Check:* six equal sha256s. Extends L-8 and L-194. + *From:* #507, round 45, 2026-11-08. +- **L-569. A fix that updates every `cmp`-pinned copy of a shared source goes + stale when a new package with the same pin merges first, and then it turns + main red.** #459 updated seven `reboot-to.c` copies; akita's package, with + the same `cmp` against cheetah's file, merged two days later (#456), so #459 + as it stands fails akita's `test/all` and needs an akita version that #509 + is about to take. *Check:* each round, for every open PR that edits a file + other packages pin, `git grep -l '' origin/main -- + 'packages/*/test/all'` against the PR's file list, and put the missing + packages and their next free versions in the merge plan. Extends L-257 and + L-426. *From:* #459 with #456 and #509, round 45, 2026-11-08. +- **L-570. A test kernel for `bin/omamobile push` needs four steps into its + `KERNEL_OUT`: `kernel`, `initramfs`, `images` (with `DEVICE=cheetah`) and + `modules`.** `push` refuses before any write when one is missing ("holds + images for … an unknown device", "build the initramfs first", the missing + modules tarball), so a skipped step costs a round trip, not the phone. + *Check:* a runbook that hands the human a test kernel lists all four with + the same `KERNEL_DIR`/`KERNEL_OUT`, in that order. *From:* the 2026-11-08 7 + Pro session. ## Shell and scripts @@ -1004,6 +1088,11 @@ never change, so reviews can cite them. Again in round 44: a "some `c N:*` line exists" pattern on #493 matched unrelated wildcard lines (`c 5:*`, `c 136:*`); found by deleting the line under test. + Again in round 45: #501's "reaches the MANIFEST" case read what its stub + `docker` printed, so it proved the plumbing and not the producer, and #505's + `tests/dipper-probe` checked that its needles are in `initramfs-inside.sh`, + always true, instead of feeding the real `initramfs/init` through the patch + step. - **L-467. `RestartPreventExitStatus=` covers the main process only; a pre-start refusal that must not be retried uses `ExecCondition=`.** #371's `ExecStartPre=` check exited 3 with `RestartPreventExitStatus=3`; on @@ -1146,6 +1235,53 @@ never change, so reviews can cite them. at or above 234 and outside `Documentation/admin-guide/devices.txt`'s fixed list gets a path-based rule, a value generated at start, or an update plan. *From:* #493, round 44, 2026-11-08. +- **L-571. An allow line added because "Waydroid binds it" is checked for what + the node lets the container do to the host.** #493's `/dev/uhid` creates HID + devices that the host compositor reads, which is a way to inject input into + the host session; Android booted without it and logged nothing about it. + *Check:* for each new `lxc.cgroup2.devices.allow`, name the host object that + opening the node creates or reaches (uhid and uinput are host input, `kvm` + host CPU state, `mem` and `port` host memory and I/O), and ask for a failing + Android feature without it before it goes in. Extends L-540 and L-454. + *From:* #493, round 45, 2026-11-08. +- **L-572. A lock added to an input handler is checked for what a holder that + hangs does to every later press.** #508's `flock` without `-w` made a stuck + short-press action freeze the power key for the session, where main would + have let the next press through. *Check:* for any new `flock`, mutex or + queue in a key, touch or wake path, run the PR's harness with the slowest + helper made to sleep past the press interval, measure when the next press + acts on main and on the head, and ask for a bound. Extends L-161 (fail + towards the user being able to act). *From:* #508, round 45, 2026-11-08. +- **L-573. Deferring a surface's "on open" reads is checked against what the + surface shows first and what refreshes it while it's closed.** #518 queued + the shade's notification read ninth, behind the reveal, and the shade's + periodic read runs only while it's open (`running: root.opened`, first tick + at 3 s), so every open showed the previous open's list for about 0.65 s. + *Check:* for each read moved off the open path, `grep -n` its function for + the timers and watchers that call it, note their `running:` condition, and + compute when the first fresh value appears after opening; ask that what the + first screen shows goes first. Extends L-235. *From:* #518, round 45, + 2026-11-08. +- **L-574. (Provisional, not yet checked on a phone.) A network-sharing + feature is checked against the firewall the image turns on.** #525 makes the + hotspot's dnsmasq start, but firstboot's ufw denies incoming and forwarded + traffic, so a client's DHCP and DNS may never reach it, and the PR's test + (the server side came up) can't show that. *Check:* `git grep -n 'ufw ' + packages/omamobile-firstboot` for the defaults, and ask for one client test + (an address, then a ping out) before a "hotspot works" claim. Confirm or + drop once a client test has run. *From:* #525, round 45, 2026-11-08. +- **L-575. A Mesa `pkgrel` bump moves `_omamobile` with it (1.3 with + omamobile3, 1.4 with omamobile4).** The marker is what shows in `GL_VERSION` + and the libgallium name, so a bump that leaves it reports the old build on + the phone. *Check:* `git log -p -- packages/mesa/PKGBUILD | grep -E + '^[-+](pkgrel|_omamobile)='` on every Mesa PR. *From:* #500, round 45 + (missed in round 44), 2026-11-08. +- **L-576. A build host that is not Arch runs the tools' pacman steps in the + container, with that container's view of keys and users.** `repo-add` there + ran as `-u $(id -u)`, which under rootless Docker can't read the release + keyring (#544), and the Omarchy keyring isn't on the host at all (#547). + *Check:* a dry run of `tools/repo-publish` on a new build host before its + publish timer is enabled. *From:* #544, #547, 2026-11-08. ## Kernel (linux-omarchy-mobile) @@ -1770,6 +1906,77 @@ never change, so reviews can cite them. diff ` with `git diff `, and grep the difference for any reference-phone path. Extends L-45, L-122 and L-195. *From:* kernel #187, round 44, 2026-11-08. + Again in round 45: for kernel #187, `git diff --stat` listed only zuma, husky and akita files, and a per-function + object compare of the prebuilt base/test pair (same-source control objects + first, at 0 changes) answered "what changes on cheetah" without a rebuild; + give the contributor the expected tree id of the rebase. +- **L-577. A draft whose commits a sibling stack carries is checked by + patch-id per commit, and closed with a note to its author, not merged.** 22 + of kernel #156's 25 remaining commits are patch-identical in #187 and the + other 3 differ in context only; saying so, with ids, answers "is anything + lost if we close it", and a request made on the draft (gate the split) is + retired where the sibling's thread settled it. *Check:* `git cherry` against + the base, then `git patch-id --stable` on both lists, and grep the sibling + thread for each open request. Extends L-182 and L-429. *From:* kernel #156 + with #187, round 45, 2026-11-08. +- **L-578. A blob check that fails on one file is narrowed to the nodes the + test used before we ask for another boot.** Kernel #209's tested + `zuma-husky.dts` differed from the head only by other test nodes around it; + the `nfc@8` node, its pin groups, the PMU's `#clock-cells`, + `clk-exynos-clkout.c` and `nxp-nci/i2c.c` were identical. *Check:* for each + differing file, extract the nodes or functions the test exercised (`sed -n + '/

/ | sha256sum` against the PKGBUILD's entry (check the method on main's files first). `tools/pr-check` could do this for every touched PKGBUILD. Extends L-103 and L-268. *From:* #142, round 29. + Again in round 45: #502's SPDX line on `udev.rules`, added to answer a + licensing request, changed its sha256; after any round that asks for headers + on package files, recompute every local `source=` sum. - **L-311. The same test failing across unrelated PRs within minutes points at the CI runner's packages, not the diffs.** On 2026-10-29 Arch moved `simdjson` to 5.0.8 before `nodejs` was rebuilt, so from about 01:55Z node @@ -2137,6 +2347,39 @@ never change, so reviews can cite them. comment, and both were green alone. *Check:* `git merge-tree` each open pair that touches `tests/all`, and give the resolved line in both reviews. Extends L-104 and L-375. *From:* #491 and #492, round 44, 2026-11-08. +- **L-585. `kernel-pr-check`'s sign-off check accepts a `Signed-off-by:` + anywhere in the message.** Kernel #218, and kernel #220's imported commits, + had the sign-off outside the trailer block, and the gate said "signed off". + *Check:* `git interpret-trailers --parse` per commit; the tool could take + sign-offs from `--parse` output only. Extends L-119. *From:* kernel #218 and + #220, round 45, 2026-11-08. +- **L-586. A package test file that nothing calls is not a test, and a new + test file is checked by name against its runner.** #471 added + `test/mobile-pam-preserve.py`, and neither `test/all`, `test/patches.py` nor + `test/port45.py` calls it, so CI and every local run were green without it + ever running. *Check:* for every new file under `packages/

/test/`, `git + grep -n '' -- packages/

` finds a caller other than the + file itself; then run it once by hand against the input it was written for. + Extends L-454. *From:* #471, round 45, 2026-11-08. +- **L-587. A fail-closed test of a new "lock everything" mode starts from a + state where the lock matters.** #503's NFS case packed no allowlist, so the + guard was read-only with or without the new code. *Check:* for every new + mode that overrides an allowlist, have the test start with the allowlist + present, mutate the mode to log and fall through, and the test must fail. + Extends L-419. *From:* #503, round 45, 2026-11-08. +- **L-588. A new package dependency brings its upstream example config into + the root image, and the release identifier scan reads it.** dnsmasq, added + for the Hotspot tile (#525), installs an `/etc/dnsmasq.conf` whose examples + tripped the scan (#550). *Check:* when a PR adds a dependency to a package + the image installs, list the dependency's `/etc` files (`bsdtar -tf` on its + package) and run `tools/release scan` on them before the next release. + *From:* #525, #550, 2026-11-08. +- **L-589. A PKGBUILD test that runs a tool needs that tool in + `checkdepends`.** CI's runner and the build image had node and a phone + didn't, so `check()` failed only in `tools/phone-install-package` (#545). + *Check:* for every interpreter or command a `check()` or `test/all` runs, + find it in `depends`, `makedepends` or `checkdepends`, not on the CI host. + *From:* #545, 2026-11-08. ## Reviews and merging @@ -2517,6 +2760,11 @@ never change, so reviews can cite them. | grep `; if listed, put the restage in the merge plan before any dependent PR. Extends L-420 and L-423. *From:* #403 with #371, round 39, 2026-11-03. + Again in round 45: overlays count too. #517 renamed two nodes in cheetah's + `aoc-sound-test.dtso` (listed in `DTB_OVERLAYS`) and bumped nothing because + the package directory didn't change; the merge plan pairs such a PR with the + device package's next version and a restage, and names the boot that checks + the new DTB. - **L-428. `Fixes #N` on a PR that answers part of an issue closes the rest at merge.** #403 deferred #390's second point (an inhibitor left after a failed start) and still said "Fixes #390". *Check:* read the issue's @@ -2537,6 +2785,10 @@ never change, so reviews can cite them. card. *Check:* `git merge-tree` of each pair on today's base, both ways, and keep the resolved file in the review. Extends L-253 and L-423. *From:* kernel #162 with #187, round 39, 2026-11-03. + Again in round 45: round 44's "#503 and #484 merge cleanly" stopped holding + after #503's rework, whose `sda` branch conflicts with #484's whole-disk + rule; a "merges cleanly" in our own comment is re-checked after every + rework. - **L-431. A conflict resolution that keeps both sides' tests runs both suites in the order they end up in.** Resolving #288 by appending main's `--no-checkpatch` test after #288's checker tests left it running on a @@ -2675,6 +2927,29 @@ never change, so reviews can cite them. repos//issues/comments?since=` in both repositories, filtered to the user). Extends L-109 and L-124. *From:* kernel #187 with #472, round 44, 2026-11-08. +- **L-590. "Merge, then run it on a phone before it's published" doesn't exist + while the development channel publishes `origin/main` daily.** + `omamobile-publish.timer` runs at 04:00 from a clean `origin/main`, so a + merged package is on `pkgs.omamobile.org/development` the next morning. + *Check:* when a review puts a phone run "before publishing", either make it + a before-merge gate or say that the maintainer pauses the timer (`systemctl + --user stop omamobile-publish.timer` on the build machine) until the run. + Extends L-444 and L-250. *From:* #471, round 45, 2026-11-08. +- **L-591. A record without a time zone is placed in UTC before it is compared + with thread times.** #514's stage times read as if the modem steps came + after the 22:20Z report (S5e ending "23:21"); the contributor's commits are + `+0200`, which puts S3 at 19:15Z, 71 minutes after the hold question. + *Check:* take the zone from the contributor's commit dates (`git log + --format=%ci`) or the log's own stamps, convert every step to UTC, and lay + it next to the thread's times before saying what ran before or after what. + Extends L-344 and L-557. *From:* #514, round 45, 2026-11-08. +- **L-592. A follow-up report is counted against the full record when it + arrives.** The kernel #187 report described three power-on phases; the plan + written afterwards shows five power-ups, two with the charger in and music + playing. *Check:* when a contributor's plan follows a thread report, + tabulate the plan's write steps and compare the count with the report before + replying to either. Extends L-345 and L-488. *From:* #514 with kernel #187, + round 45, 2026-11-08. ## Claims and evidence @@ -3435,6 +3710,38 @@ never change, so reviews can cite them. "in review" a cell cites, list the DT nodes the feature needs and `git grep` them on the base and the open heads; a node in neither is named in the cell. Extends L-149 and L-28. *From:* #494, round 44, 2026-11-08. +- **L-593. A negative record that drops earlier positive facts is diffed + against the contributor's earlier versions.** Asked to "record what + happened", #330 rewrote a section as "not established", dropping a verified + 15-partition compare and the NV `ro=1` observations its first version had. + *Check:* `git show :device//STATE.md` (or the old NOTES) + for every fact the new paragraph calls unknown, and hand back the ones they + already had (here the `backup-stock` list answered "is `logdump` backed + up"). Extends L-198 and L-313. *From:* #330, round 45, 2026-11-08. +- **L-594. A PR description's "retaining … sign-offs" is checked per commit.** + Kernel #219 and #220 both claimed it, and neither held. *Check:* `git log + --format='%an%n%(trailers:key=Signed-off-by)'` over the PR's commits against + the upstream originals. Extends L-29 and L-216. *From:* kernel #219 and + #220, round 45, 2026-11-08. +- **L-595. A fix for a host-side prompt is tested on that host.** #510 was + tested from a Linux laptop for a macOS "Allow accessories" prompt, and it + keeps the random first enumeration the prompt may key on. *Check:* ask for a + run on the reporter's OS with the reporter's setting, or reword the claim to + what was measured. Extends L-29. *From:* #510, round 45, 2026-11-08. +- **L-596. "Stock" line numbers are checked against Google's file at the + branch named.** #514 cited `modem_ctrl_s5100.c:874-903` and `:990-991` from + a third-party copy of the shusky tree; Google's + `android-gs-shusky-6.1-android16` file has those functions at 906-933 and + 1022-1027. *Check:* fetch the file from android.googlesource.com + (`?format=TEXT | base64 -d`), grep the function names, and give the + contributor the right lines. Extends L-76 and L-412. *From:* #514, round 45, + 2026-11-08. +- **L-597. A comment that says "the test fails if X" is checked against where + X would actually appear.** #493's `allow = a` guard tests our own include + file, while the hazard is a line after the include in Waydroid's generated + config, which only `verify` sees at start. *Check:* for each hazard a + comment names, find the file it would be in and the gate that reads that + file. Extends L-540. *From:* #493, round 45, 2026-11-08. ## Corrections (where a review was wrong) @@ -3651,3 +3958,19 @@ never change, so reviews can cite them. table and an Expect line, and went into the contributor's commit. *Lesson:* see L-493; ACPM-PLAN and DISPLAY-PLAN were corrected in #480. *From:* kernel #116. +- **C-32 (2026-11-08). Round 44 told #471's and #420's authors that #420's + 0029, a 4.0.6 patch, would most likely break the 4.5 family; it applies at + fuzz 0 to the real omarchy 4.5.0-3 package.** The real risk was 4.0.6 phones + losing 0029 and an untested 4.5 behaviour, and Omarchy's packages are signed + and public. *Lesson:* for a claim about a fuzz-0 apply on a version we don't + have cached, download the package from `pkgs.omarchy.org//aarch64/` + into its own scratch directory, verify it with `gpgv --keyring + /etc/pacman.d/gnupg/pubring.gpg`, run the package's `test/patches.py` with + `OMARCHY_PKG` set, and report the result, not "most likely". Extends L-548. + *From:* #471 with #420, rounds 44-45. +- **C-33 (2026-11-08). Round 44 told kernel #219's author the FTS5 series was + probably developed on other SDM845 phones; its upstream cover letter says it + was tested on a Xiaomi Mi 8.** *Lesson:* before doubting a "tested on X" + claim about an upstream series, read the cover letter (patch 0/N) and the + maintainer's apply mail, not only the patches. Extends C-4. *From:* kernel + #219 with #330, rounds 44-45. From 3f110bde9ac73a7407f576902f332a6a4262e114 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 13:17:00 -0500 Subject: [PATCH 40/66] docs/review: round 46's lessons (L-598 to L-657) (#570) Round 46's confirmed candidates from the reviews of the open omarchy-mobile and linux-omarchy-mobile pull requests, the round's own process slips (shared refs and scratch files deleted by glob, a maintainer fixup that skipped the package's test/all, an amend on a contributor branch) and the 2026.11.08 release PRs (#547, #548, #549, #550, #560). Repeats of existing lessons extend them instead: L-45 (kernel #222), L-183 (#409), L-426 (the round's version collisions, now set by hand at merge) and L-550 (#471 with #420). C-34 and C-35 correct our #290 shell suggestion and round 45's claim that tests/dipper-probe guards anything. Stacked on #551 (round 45's lessons). Co-authored-by: Claude Opus 5.5 --- docs/review/LESSONS.md | 530 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 530 insertions(+) diff --git a/docs/review/LESSONS.md b/docs/review/LESSONS.md index 96de25c09..d872bd088 100644 --- a/docs/review/LESSONS.md +++ b/docs/review/LESSONS.md @@ -523,6 +523,67 @@ never change, so reviews can cite them. reboot`. To keep the modem off for a boot it is `systemctl mask omamobile-modem-boot.target`, not `/etc/omamobile/modem-hold`, which matters only after an unclean end. *From:* the 2026-11-08 7 Pro session, issue #532. +- **L-598. A code change that enables a protected-partition write waits until + its evidence is called verified, not provisional.** #436 marked its 3.11 + table "provisional, not a same-state row" in the same push that kept the + build flag enabling 3.11 writes at every boot. *Check:* for a PR that widens + a `devinfo`, GPT or calibration write, grep its notes for "provisional", "not + yet confirmed" and "still needs"; if one applies to the layout, ask for the + enabling switch to come out (or a split) until it goes. Extends L-2, L-36 and + L-527. *From:* #436, round 46, 2026-11-09. +- **L-599. (Provisional: from ABL's documented retry behaviour on 3.15, not + yet seen on 3.11.) A same-state row for slot metadata has no slot boot + between its two reads.** ABL spends a retry when it boots an unmarked slot, + so `getvar` before a boot and Linux's bytes after it disagree on a correct + layout. *Check:* when a row's retry byte is one below `getvar`, ask in which + order the reads were taken, and prescribe the Linux read, then fastboot by + the buttons, then `getvar`. Extends L-36 and L-527. *From:* #436, round 46, + 2026-11-09. +- **L-600. A "read-only check" a contributor reports is also read for what the + phone is running now.** #330's check showed a live session of an unpublished + image with `/sys/block/sda/ro` 0 on a single-slot phone. *Check:* for any + reported `ro` values, read the whole-disk lines first, then ask what booted, + how and since when, before reading the partition lines as a guard result. + Extends L-321 and L-562. *From:* #330, round 46, 2026-11-09. +- **L-601. A guard change that makes a partition writable is checked for a + writer in the same tree.** #530 opened enchilada's `boot_b` on `sde`, while + `flash` and `push` refuse `android-v0`, `push` and `omamobile-boot-update` + look on `sda` only, and a fastboot install never runs the guard, so the only + possible writer was a hand `dd`. *Check:* for each partition a guard or + allowlist change opens, grep `cmd_push`, `cmd_flash`, `omamobile-boot-update` + and `tools/install-phone` for how they find it; if no tool reaches it, the + opt-in waits for the writer's PR, and the mechanism can land inert. Extends + L-321 and L-422. *From:* #530, round 46, 2026-11-09. +- **L-602. A contributor's note that a documented recovery path didn't work on + their phone is checked against what the PR changes before it lands in the + device's notes.** #554's NOTES said Volume Down + Power "ended in a normal + boot", and kernel #233's fix, which runs only at power off, can't touch that + path. *Check:* name the mechanism the fix changes and the one the claim + uses; if they differ, ask for the hold, the starting state and the result, + and keep AGENTS' instruction until it is re-run. Extends L-29 and L-91. + *From:* #554 with kernel #233, round 46, 2026-11-09. +- **L-603. A boot that replaces `multi-user.target` as the default loses + everything wanted only there:** `omamobile-boot-success`, ufw, logind (#554's + off-mode charging target). *Check:* `grep -l 'WantedBy=multi-user'` over the + image's units (Omarchy's included) and each device package's + `multi-user.target.wants/`, and say for each whether the new boot needs it. + *From:* #554, round 46, 2026-11-09. +- **L-604. A PR that touches AGENTS.md or CONTRIBUTING.md is word-diffed in + full against its own parent, not only read where its topic is.** #409's + 9a-sleep commit replaced the whole AGENTS.md with what looks like a local + copy: the first safety rule became "Reboots and pushes do not need advance + approval", and three maintainer-only tool rows lost their "human's go"; the + commit message mentioned none of it. *Check:* `git show -- + AGENTS.md CONTRIBUTING.md | grep '^[-+]'` for every commit; any hunk outside + the PR's stated topic is blocking until explained. Extends L-224, L-339 and + L-486. *From:* #409, round 46, 2026-11-09. +- **L-605. When a safety fix's only way back is a step the device can't take, + the decision says so.** The 9a's gauge leaves POR only when Android reloads + the model, and a stock boot there costs userdata, so "refuse until reloaded" + meant "no battery for good". *Check:* for a refusal a PR relaxes, name what + clears the refused state on that device and whether AGENTS §4 allows it. + Extends L-284. *From:* kernel #234, round 46, 2026-11-09. + ## Shared code and the reference device @@ -987,6 +1048,62 @@ never change, so reviews can cite them. *Check:* a runbook that hands the human a test kernel lists all four with the same `KERNEL_DIR`/`KERNEL_OUT`, in that order. *From:* the 2026-11-08 7 Pro session. +- **L-606. A shared stop-path fix proven on one phone's unit is checked + against the other phone's unit settings.** #372's rfsd hold makes the 9a's + modem stop end in `success`, but the 9a's transient unit sends SIGINT to the + whole control group, while the 7 Pro's `omamobile-modem.service` uses + `KillMode=mixed` with SIGTERM to `unshare`, which issue #532 found doesn't + exit. *Check:* for a "now ends in success on both phones" claim, compare + `KillMode`, `KillSignal`, `TimeoutStopSec` and the main process of each unit + that runs the shared code, and ask for (or do) a stop on each. Extends L-206, + L-348 and L-492. *From:* #372 with issue #532, round 46, 2026-11-09. +- **L-607. "Enabled" read from `systemctl is-enabled`, or from "not masked", + is wrong for a unit started by a vendor wants link in one device package + and by nothing on the others.** #555's status line did that for a shared + unit. *Check:* for a switch over a shared unit, list each device package's + `*.target.wants/` links for it, and read `systemctl show -p WantedBy` rather + than `is-enabled`. Extends L-137 and L-206. *From:* #555, round 46, + 2026-11-09. +- **L-608. A feature split into "opt-in" and "helper" parts is checked for + which parts are actually behind the opt-in.** #556's inhibitor waits for + `modem-suspend-enable`, but sitd's screen-state reporting, written as M6's + helper, runs on every phone with sitd. *Check:* for each new behaviour in + the PR, find the condition that gates it in the shipped unit or script, and + list the devices it reaches with the opt-in off. Extends L-206 and L-458. + *From:* #556, round 46, 2026-11-09. +- **L-609. A hand copy that one PR's record reveals is checked against the + package another open PR ships for that phone.** #514's "Current state" + listed an AoC blacklist in `/etc/modprobe.d` on the 8 Pro, while #453's + first packaged boot was meant to test the package's own blacklist. *Check:* + for each hand-installed file a contributor's notes list on a phone, `git + grep` its role (modprobe, UCM, unit) across that author's open package PRs + for the device, and add it to that PR's "remove the hand copies" step. + Extends L-46. *From:* #453 with #514, round 46, 2026-11-09. +- **L-610. A stacked draft that carries another open PR's commits inherits + that PR's pending reference-phone run, and the review says whose run it + is.** Kernel #164's per-function diff showed 24 changed functions in + cheetah's `gs201-csis.o` and 16 in `imx386.o`, all from #63 and #103, whose + promised 7 Pro capture (10-28) the maintainer still owed. *Check:* map each + changed cheetah object to the commit and PR it comes from (patch-id against + the open heads), and grep those threads for the promised run before asking + the contributor for anything. Extends L-196 and L-480. *From:* kernel #164, + round 46, 2026-11-09. +- **L-611. A consumer-side "re-apply the pins" fix in a shared driver is shown + cheetah-neutral through the pinctrl core's early returns, node by node.** + For kernel #224, gs201's UFS has no `pinctrl-0`, so `dev->pins` is NULL; + gs101 and zuma have "default" only, so the sleep select is `IS_ERR` and the + default select hits `p->state == state`. *Check:* the reference phone's node + and overlays for `pinctrl-*`, then `pinctrl_bind_pins()` and + `pinctrl_select_bound_state()` on the base. Extends L-228. *From:* kernel + #224, round 46, 2026-11-09. +- **L-612. Before planning a contributor's own test of a shared-driver path, + check that their board's DT takes it.** Kernel #223's code runs only with + `maxim,fg-model`, which on our tree only cheetah and panther have, so the + author's Pixel 6 can't exercise it with the public tree. *Check:* `git grep + '' github/omamobile -- arch/`, and name the + phones that can test it. Extends L-490. *From:* kernel #223, round 46, + 2026-11-09. + ## Shell and scripts @@ -1282,6 +1399,114 @@ never change, so reviews can cite them. keyring (#544), and the Omarchy keyring isn't on the host at all (#547). *Check:* a dry run of `tools/repo-publish` on a new build host before its publish timer is enabled. *From:* #544, #547, 2026-11-08. +- **L-613. An `EXIT` trap that clears a hang marker also runs when systemd + times the unit out.** Bash runs the EXIT trap on SIGTERM, also mid-write + when the block is interruptible, so #510's cleanup that removes the marker + turned a timed-out hang into "finished", and the next boot would repeat it. + *Check:* for a boot script with a marker and `TimeoutStartSec=`, find which + code paths remove the marker, then run the script with its slow step + replaced by a FIFO open and `kill -TERM` it: the marker should survive. + Extends L-170 and L-468. *From:* #510, round 46, 2026-11-09. +- **L-614. A flag that blocks a repeated user action is checked for where it + is cleared.** #461's `releasing` stops a second hang-up while the first is + outstanding, but nothing clears it after a refusal or a timeout, so the + Phone app can then never end the call. *Check:* for every "in progress" flag + a PR adds to a user-facing method, `grep -n` every assignment and list the + states that clear it; a terminal error path with no clear is a question. + Extends L-302 and L-502. *From:* #461, round 46, 2026-11-09. +- **L-615. When a PR serializes one caller of a shared state change, the + review re-lists the callers on today's main, not on the PR's base.** #508 + locked the power key's short action; #420, merged a day later, added two + more display transitions in the same script that don't take the lock. + *Check:* `git diff origin/main -- ` for new entry points + that reach the same helpers (`wake_*`, `lock_dark`, `omarchy-system-lock`), + and ask whether each takes the lock. Extends L-462 and L-572. *From:* #508 + with #420, round 46, 2026-11-09. +- **L-616. Moving a UI removal behind an acknowledgment is checked against + what the row's own animation leaves on screen while it waits.** In #533, + `NotificationRow` folds to height 0 and only then calls + `forgetNotification`, so the row stays in the model, invisible, until the + reply; on a refusal it stays invisible until the next refresh, and a model + reset during the wait re-creates the delegate at full height. *Check:* read + the delegate's end-of-gesture code (the fold or fly-off) and the list's + refresh timers, list what the user sees on success, on failure and when a + refresh lands mid-wait, and ask the phone test to cover the last one. + Extends L-573. *From:* #533, round 46, 2026-11-09. +- **L-617. A feature flag that a backend must report starts false in the + UI.** #539's `shareAvailable: true` drew the VPN boxes on every open until + the state line came, and kept them if parsing failed. *Check:* for each + `*Available` property a page reads from a helper, its default and the + `catch` path. Extends L-161 (fail towards not offering what isn't there). + *From:* #539, round 46, 2026-11-09. +- **L-618. A Qt fixture that stands in for a production animation is checked + for how that animation is declared.** #518's test gates on a free-standing + `NumberAnimation` it starts by hand, while the real `revealAnimation` lives + in `Behavior on reveal`; whether a Behavior's animation reports `running`, + and when, decides whether the gate works on the phone (on Qt 6.12.0 it does, + synchronously on the property change). *Check:* when a fixture rebuilds an + animation, timer or handler outside its real context, write a ten-line + qmltestrunner case with the production declaration (a Behavior with an + `id`, plus a `Connections` on `runningChanged`) and log when the property + changes before accepting the fixture's result. Extends L-454. *From:* #518, + round 46, 2026-11-09. +- **L-619. A gesture strip at `z: 100` over a scrolling list is probed for + which of the two takes an upward drag.** #553's 36 px DragHandler strip at + the bottom of the Wi-Fi page overlapped the list's last ~18 px, and the + probe showed the strip wins: the page closed and the list didn't scroll. + *Check:* compute the overlap from the phone's real values (`gaps_out = 0` in + `hypr/phone.lua`, the panel padding), then run a 30-line qmltestrunner probe + with the same handler over a ListView and swipe once inside and once + outside the overlap. Extends L-160. *From:* #553, round 46, 2026-11-09. +- **L-620. A drag handler that measures `mouse.y - startY` inside an item its + own offset moves follows the finger at half speed.** Main's quick-settings + sheet and #553's card both do; a probe gave offsets `-10,-10,-20,-20,…` for + a finger moving 10 px a step, so a 60 px threshold needs 120 px. *Check:* + for any new drag that moves its own parent, run the probe, or read whether + the delta is taken in scene or window coordinates. *From:* #553, round 46, + 2026-11-09. +- **L-621. A surface condition that adds "or the keyboard is up" is checked + against every client that raises the keyboard, not only the one the PR is + about.** #557 meant the dock's and drawer's search, but `oskOpen` follows + squeekboard's visibility for any surface, so the strip (and its + drawer-opening swipe) also appears under quick settings' Wi-Fi password on + the home screen. *Check:* find where the flag comes from + (`omamobile-osk-watch`), list the surfaces with text fields that can be up + on the home screen (Wi-Fi, Bluetooth, Hotspot, the lock), and walk the new + branch for each. Extends L-160. *From:* #557, round 46, 2026-11-09. +- **L-622. Relaxing one term of a visibility condition can expose an old race + that the term used to mask.** In #557, `appOnScreen` kept the strip off + under a lock taken from the home screen whatever `sessionLocked` said; with + `|| oskOpen`, the asynchronous lock query's stale answer now matters there + too. *Check:* for each term a PR loosens, list the other terms that are + asynchronous or cached and ask what they read in the window the old term + covered. *From:* #557, round 46, 2026-11-09. +- **L-623. When a fix removes an error, check what that error was stopping.** + `omamobile-update` run as root over SSH had no `OMARCHY_PATH`, and Omarchy + 4.0.6's `omarchy-update-dev` died on the unbound variable before anything + ran; #548's first change passed `OMARCHY_PATH` on, which would have let a + root run go on to Omarchy's migrations, and Omarchy keeps the per-user + record of which ran in `$HOME`, so a root run re-runs every one as root (59 + on the 11-09 test install, through the NOTES gotcha's `OMARCHY_PATH=…`). + #548 now refuses root. *Check:* for a fix that makes a failing path + succeed, run the path with the fix and list what now executes after the old + failure point, as which user and with which `$HOME`, and ask which of those + steps keep per-user state. Extends L-29 and L-499. *From:* #548 with #560, + round 46, 2026-11-09. +- **L-624. A fix that refuses a command is grepped against our own runbooks + for that command.** #548 refuses `omarchy update` as root, while + `tools/release`'s test-install steps print it under "over USB SSH", where + the login is root, and that runbook is what led to the 11-09 run. + *Check:* for any new refusal, `git grep` the command in `tools/release`, + `docs/`, `device/*/*-PLAN.md` and the NOTES gotchas, and check the user each + one runs as (`tools/phone-ssh` is root). *From:* #548 with #560, round 46, + 2026-11-09. +- **L-625. A sleep test run through a direct `/sys/power/state` freeze doesn't + cover hooks added in the same PR.** #556's cycles were `rtcwake` runs, which + skip `system-sleep` hooks (AGENTS §4, the 9a NFC gotcha). *Check:* compare + each hook's commit time with the runs, and ask for cycles through + `systemctl suspend` for any new or changed `system-sleep` hook. Extends + L-392. *From:* #556, round 46, 2026-11-09. + ## Kernel (linux-omarchy-mobile) @@ -1977,6 +2202,45 @@ never change, so reviews can cite them. evidence says that default is unsafe on phones, put the override in the migration plan as a condition of the move. Extends L-433 and L-37. *From:* #515, round 45, 2026-11-08. +- **L-626. A per-state "not for s2idle" switch is checked against the s2idle + fallback, not only `find_deepest_state()`.** When no state above WFI has + `enter_s2idle`, `do_idle()` calls `cpuidle_find_deepest_state()`, which + ignores `enter_s2idle`, so kernel #224's state is still entered, through the + ordinary `->enter` and without `tick_freeze()`. *Check:* read + `kernel/sched/idle.c`'s s2idle branch down to `call_cpuidle()` for a table of + WFI plus the marked state, and ask for each state's `time` delta across one + sleep; an `s2idle_usage` the change makes impossible to increase isn't + evidence (L-454). *From:* kernel #224, round 46, 2026-11-09. +- **L-627. A platform driver's sleep callback that "refuses before the PCI + core suspends" its root port runs after it:** children's noirq callbacks + complete before the parent's (kernel #232). *Check:* for any new refusal in a + host controller's PM ops, name the devices below it and the phase, and read + the `dpm_*_suspend_devices()` order (or ask for one `pm_print_times` + cycle). *From:* kernel #232, round 46, 2026-11-09. +- **L-628. A PMIC register a fix clears at power off is checked for who sets + it again at boot.** Kernel #233 clears WTSR at power off; our kernel never + writes it on the S2MPG12, and the value read (0x0f) matches neither stock's + probe (0x07) nor its restart (0x7f), so the bootloader re-arms it, and if it + doesn't, a manual reset turns cold and pstore is lost. *Check:* `git grep` + the register in the driver for every writer, decode the read value against + the vendor's probe and restart values, and ask for one read after a cold + boot. Extends L-213 and L-437. *From:* kernel #233, round 46, 2026-11-09. +- **L-629. A stopgap that publishes a sensor's fallback state publishes only + the values the fallback gets right.** Kernel #234 accepted a MAX77779 with no + model and, with it, five capacity and time values scaled by the default + 8.5 Ah for a 5 Ah pack. *Check:* for each property a relaxed readiness check + now publishes, ask whether it depends on what's missing (the model, a + calibration), and ask for `-ENODATA` for those. Extends L-99 and L-161. + *From:* kernel #234, round 46, 2026-11-09. +- **L-630. A "logging only" change to a retry path is re-counted against the + base's current retry count.** Kernel #223 was written against a driver that + tried the model load once; the release kernel now tries 8 times with 3 inner + retries per loop, so its two messages can print up to 48 times. *Check:* for + a new message in a loop, find every loop that reaches it on today's base + (`git log -L ::` on the callers) and give the worst-case + count. Extends L-29. *From:* kernel #223 with `28bab7f602ca`, round 46, + 2026-11-09. + ## The gates themselves @@ -2380,6 +2644,88 @@ never change, so reviews can cite them. *Check:* for every interpreter or command a `check()` or `test/all` runs, find it in `depends`, `makedepends` or `checkdepends`, not on the CI host. *From:* #545, 2026-11-08. +- **L-631. A detached-signature tamper test changes a byte inside the signed + data or the signature packet.** gpg ignores bytes appended after a + signature, so an "append junk, expect BAD" case passes a check that verifies + nothing new (#547). *Check:* for each negative signature test, flip a byte + in the middle of the signed file (`printf '\xff' | dd conv=notrunc bs=1 + seek=`) and, separately, one inside the `.sig`, and see both refused. + Extends L-454. *From:* #547, round 46, 2026-11-09. +- **L-632. A signature check behind an unsigned index proves who signed the + file, not that it is current.** #547's keyring fetch verifies the package + against a pinned key, but takes the version from the unsigned `omarchy.db` + and refetches on any difference, so an older signed keyring would pass, and + a cache hit uses the extracted files without a re-check (unlike + `alarm_fetch`, which re-verifies the tarball every run). *Check:* for every + signed download, name where the version comes from (index or verified + metadata), whether an older version is refused, and whether the cached copy + is verified again on use; `curl -I .sig` tells whether the index is + signed at all. Extends L-371 and L-422. *From:* #547, round 46, 2026-11-09. +- **L-633. An identifier-scan exemption justified by IEEE address bits is + checked against Bluetooth addressing, and scoped to the file that needed + it.** #550 skipped group-bit MACs image-wide because "no network card has + one", but a Bluetooth LE static random address has its two top bits set and + arbitrary low bits, so the group and locally administered exemptions + together skip three quarters of them, and a byte-reversed BD_ADDR dump + likewise. *Check:* for each exemption, feed one of each identifier kind + AGENTS §1 names (Wi-Fi, Bluetooth public and random, gadget pairs) through + the rule; prefer a path-scoped or literal exemption to a bit rule, and use + RFC 7042's `00:00:5e:00:53:xx` for test values. Extends L-145 and L-563. + *From:* #550, round 46, 2026-11-09. +- **L-634. The release scan's MAC pattern has blind spots a reviewer of an + exemption should know:** an address after a colon (`tag:`, `id:`, `mac:`) + never matches the lookbehind, and hyphenated or bare 12-hex forms aren't + matched at all. *Check:* feed the scan `tag:`, a hyphenated MAC and 12 + bare hex digits before calling a MAC gate complete. *From:* #550, round 46, + 2026-11-09. +- **L-635. A gate's input collection is checked to land, not only its + matcher.** The identifiers stage's two `rdump`s into one folder collide on + the name `omamobile`, debugfs refuses the second, and `>/dev/null 2>&1 || + true` hides it, so `/var/lib/omamobile` had never been scanned; two rounds + of review read the exemptions and took the dump on trust. *Check:* for a gate + that gathers files (rdump, cpio, tar, find), run the gathering on a fixture + with one marker file per source and list what arrived, and grep for `2>&1 || + true` around it. Extends L-145 and L-421. *From:* #550, round 46 (second + look, correcting the first-round review), 2026-11-09. +- **L-636. A path-scoped exemption is mutation-tested for its scope, not only + its content.** #550's tests caught a widened group bit, but not the option + rule applied in any file, or the path without its leading slash. *Check:* for + each exemption with a path condition, delete the condition and re-run the + tests; if nothing fails, ask for an "elsewhere it is found" case. Extends + L-145 and L-466. *From:* #550, round 46, 2026-11-09. +- **L-637. A count assertion over a series directory is a merge hazard.** + #471's `test/source-family.py` asserts `== 28`, which fails on the first + legacy fix, whichever PR brings it. *Check:* grep a PR's new tests for + literal counts of files that other PRs add to, and ask for a count derived + from a pinned list. Extends L-454. *From:* #471, round 46, 2026-11-09. +- **L-638. `kernel-pr-check`'s base device-tree build races with itself.** It + passes every board as an explicit `.dtb` target to one `make -j`, and the + top-level `%.dtb` rule starts one sub-make per target in the same + directory, so they race on the directory's `.cmd` files; a "base's device + trees don't all build" note that names a `.cmd` file and "missing separator" + is that race, not the base (kernel #220, base `1a9d1d4e9289`, + `sc8280xp-microsoft-arcata.dtb.cmd:43`). *Check:* the named `.cmd` file is + complete afterwards, and the same base set builds with `-j1` or as one `make + $(build)=arch/arm64/boot/dts/

` call; the tool could build the base and + head lists through a single sub-make. Extends L-30 and L-102. *From:* kernel + #220, round 46, 2026-11-09. +- **L-639. A new `depends` on a virtual name is checked for its `provides`.** + #533 added `'omamobile-notification-snapshot>=1'`, and the only provider was + a commit on the contributor's fork, stacked on an unmerged PR, at a package + version main had already shipped; CI is green because nothing installs the + package. *Check:* for every added `depends` or `makedepends` entry that isn't + an Arch or Omarchy package name, `git grep -n "provides=.*" + origin/main` and each open PR head; if it isn't on main, put the providing + PR first in the merge order and check its version against main. Extends + L-12 and L-426. *From:* #533, round 46, 2026-11-09. +- **L-640. A package bump is checked for version strings the package's own + code prints.** #536 bumped omamobile-remote to 0.1.2 and the guide's install + line, but the script's `version` command still printed 0.1.1 (#513 had + bumped both). *Check:* on every version bump, `git grep -n -F '' -- packages/

docs/`, and ask for a test that ties any + printed version to the `version` file. Extends L-12 and L-263. *From:* #536, + round 46, 2026-11-09. + ## Reviews and merging @@ -2641,6 +2987,11 @@ never change, so reviews can cite them. split is checked against the reason we gave for the split, not only against the gates: two bindings that pass dtbs_check still documented the unprefixed names we split the card out to avoid. + **Also (#409, round 46):** a "the script records X" claim is checked by + finding the line that does it: #409's `sleep-series-loop.sh` had no ext4 + line, and its cap was per invocation, not the per-night cap the condition + named. + - **L-184. When we tell a contributor how to resolve a conflict, derive the resolution from the file, and better, hand over the resolved hunk.** Rounds 18 and 19 said "keep both lines in both lists" for @@ -2750,6 +3101,13 @@ never change, so reviews can cite them. branch's file and subject with `git show origin/main:packages/

/version`. Extends L-12, L-217 and L-404. *From:* #407, #389, #400, #367, round 39, 2026-11-03. + Again in round 46, in most of the round's reviews: #553 and #557 both claim + omamobile-shell 0.2.108 with a clean `merge-tree` including `version`; #539 + and #542 claim 0.2.107, which main already shipped; #371 collided on four + packages at once. The rule since: the maintainer sets every version by hand + at merge (file and squash subject), and each review lists the collisions it + found rather than asking the contributor to renumber. + - **L-427. A change under a boot-files device package's `src/` makes its staged boot files stale, and that strands a sibling's new dependency on it.** `tools/stage-boot-files` hashes `packages//src`, so #403's @@ -2874,6 +3232,13 @@ never change, so reviews can cite them. file to the family it was written for, and give the merge order and the move in both reviews. Extends L-104, L-423, L-424 and L-426. *From:* #420 with #471, round 44, 2026-11-08. + Again in round 46: #471 against main after #420 conflicted only on + `version`, yet the plain resolution dropped 0029 from every 4.0.6 phone, and + CI couldn't see it because its 0029 assertion sits in the real-package block + CI skips (L-548). For each file main added under the repurposed directory + since the PR's base, run `test/all` with `OMARCHY_PKG` for each family on + the resolved tree. + - **L-551. A version we write into "I'll title it X" goes stale like any other promise; check it again when merging.** On 11-05 we promised #421 the title `shell 0.2.101`; #464 shipped 0.2.101 two days later, and the branch's @@ -2950,6 +3315,57 @@ never change, so reviews can cite them. tabulate the plan's write steps and compare the count with the report before replying to either. Extends L-345 and L-488. *From:* #514 with kernel #187, round 45, 2026-11-08. +- **L-641. Parallel reviewers work under a per-review topic, in ref names and + in a per-review scratch subfolder, and never glob-delete shared names.** In + round 46 one reviewer deleted others' refs with a `review/*-r46-*` glob and + ran `rm -f merge-*` in the round's shared folder; another lost + `review/pr471-r46-om` mid-review ("om" is too generic) and went on from the + commit id; a third wrote `threads.txt` and `pr-check-main` at the round + folder's top level, where other reviews keep files of the same names. + *Check:* `ls` the round folder and `git branch --list "review/*-"` + first (both empty for a topic unique to the run), write only under + `round//`, delete only by the exact names recorded at creation, + and pass commit ids to every later command. Extends L-43, L-127 and L-364. + *From:* #471, #530 and the round's cleanup, round 46, 2026-11-09. +- **L-642. After a maintainer fixup to a contributor branch, run the touched + package's whole `test/all`, not a subset.** The #371 fixup changed a + version and `depends` line, and that package's own test hard-coded the old + value, so CI failed. *Check:* for each package directory + the fixup touches, `packages/

/test/all` (and `tests/packages` for the + depends graph) on the fixed-up head before pushing it. Extends L-408. + *From:* #371, round 46, 2026-11-09. +- **L-643. A maintainer fixup on a contributor's branch is a new commit on + top, not an amend.** An amended commit that is already on the branch can + only be pushed with a force push, which rewrites the contributor's history. + *Check:* `git merge-base --is-ancestor HEAD` before + every push to someone else's branch; if it fails, redo the change as a new + commit. *From:* #371, round 46, 2026-11-09. +- **L-644. A stacked branch under a squash-merged base is rebased with + `--onto `, and the review says so.** #540 and #541 each carry + #493's four commits; after a squash merge none of them is patch-identical to + main's squash commit, so a plain `git rebase origin/main` replays them and + conflicts. *Check:* when a contributor says "I'll rebase once X merges", + give them `git rebase --onto origin/main `. *From:* #493 + with #540 and #541, round 46, 2026-11-09. +- **L-645. An expectation we write into one PR about another PR's head goes + stale when that PR is fixed, and the contributor may copy it into a + runbook.** Round 45 told #505 "the screen will most likely go dark" because + of kernel #220's supply move; #220 was fixed 40 minutes later, and #505's + runbook now expects the old fault. *Check:* each round, for every cross-PR + expectation in our last comments, re-derive it on the other PR's current + head before reading the runbook that quotes it, and own the correction. + Extends L-250 and L-403. *From:* #505 with kernel #220, rounds 45-46, + 2026-11-09. +- **L-646. "The tested tree carries over" is checked per file by blob against + a reconstructed tested tree, when the tested kernel was a local merge.** + For kernel #187 the 7 Pro ran `a3e96faa` plus #191; `git merge-tree + --write-tree <#191's merged commit> ` rebuilt it, and every + non-zuma file the PR touches had the same blob at the rebased head, which + answered "does the run stand?" without a rebuild or a reboot. *Check:* + rebuild the tested combination with `merge-tree`, then `git rev-parse + :` against `:` for each touched file. Extends L-45, L-483 + and L-547. *From:* kernel #187, round 46, 2026-11-09. + ## Claims and evidence @@ -3123,6 +3539,11 @@ never change, so reviews can cite them. and the new head don't differ.** *Check:* `git diff -- `; empty means the test stands, otherwise ask for a re-test. *From:* #29, round 2 (994dd90 against d773f62: identical). + **Also (kernel #222, round 46):** a message-only re-push (`git diff + ` empty, same parent) carries the evidence over only while the base's + blob for each touched file is unchanged too (`git rev-parse : + :`). + - **L-46. A phone's settings reflect that phone's image, not the one we build.** A contributor's `busctl` value (`HandlePowerKey=suspend`) came from a local drop-in, while our image's `omarchy-settings` sets `ignore`. @@ -3742,6 +4163,100 @@ never change, so reviews can cite them. config, which only `verify` sees at start. *Check:* for each hazard a comment names, find the file it would be in and the gate that reads that file. Extends L-540. *From:* #493, round 45, 2026-11-08. +- **L-647. A flag file for an app from `[omarchy]` is checked against that + app's launcher in the signed package.** #542's whole fix rests on + `/usr/bin/grok-bot` reading `~/.config/grok-bot-flags.conf`, and on the + app's 512 px minimum. *Check:* `pacman -Sp ` for the URL, download the + package and its `.sig` into an empty scratch directory, `gpgv --keyring + /etc/pacman.d/gnupg/pubring.gpg .sig ` (name both files: a glob + like `*.pkg.tar.*` matches the `.sig` too and reports a BAD signature), then + read the launcher and grep the `app.asar` for the claimed constant. Extends + L-498 and C-32. *From:* #542, round 46, 2026-11-09. +- **L-648. A thread reply posted next to a notes commit is compared with the + commit, fact by fact, in UTC.** #330's 11-09 entry (08:52Z) said "not + compared, not complete, no reply"; the replies at 08:53Z said "matches, + complete, reachable", and the record that would land was the older one. + *Check:* `git log -1 --format=%cI` on the notes commit against each reply's + `createdAt`, then list every fact the reply adds and ask for it in the file. + Extends L-109 and L-591. *From:* #330 with #499 and #505, round 46, + 2026-11-09. +- **L-649. A tool's documentation isn't a record of a run, and a console that + ends at the confirm prompt doesn't show the write.** Kodiak's "both slots" + came from the installer's online description, through the contributor's + assistant; the correction's evidence then ended at "Flash these images? … + ^C". *Check:* for any "the installer wrote X" or "didn't write Y", ask for + the run's own write lines (`install.log`, the `fastboot flash` output), and + read a pasted console to its last step before accepting it as evidence of a + write. Extends L-29 and L-562. *From:* #511, round 46, 2026-11-09. +- **L-650. A phone run in an app's preview or demo mode is checked for what + the mode skips.** #526's `--preview` replaces the device reads with + fictional data and skips the D-Bus registration, so the phone screenshot and + smoke report covered neither the real About page nor the single-instance + path, and the contributor's private app owned the same bus name. *Check:* + `grep -n 'preview\|demo' main.*` for every branch the flag skips, and ask + for the run on a phone where no other owner of the app's bus name or files + is installed. Extends L-361 and L-567. *From:* #526, round 46, 2026-11-09. +- **L-651. A shell page with a pluggable backend is tested on the backend the + repository ships, not only on a private one.** #539 ran on the 9a against an + off-tree hostapd backend; NetworkManager, what every other phone gets, ran + only against a fake `nmcli`. *Check:* `git grep` the hook path + (`hotspot-backend`) on main and the open heads; if no shipped backend + implements it, ask for a phone run of the default path and a README line on + where a device's backend comes from. Extends L-61 and L-567. *From:* #539, + round 46, 2026-11-09. +- **L-652. "Stopped after X" in a report about an upstream script is checked + against that script's order at the version the phone runs.** #548's body + and #549's known issue said `omarchy update` "stops after updating" in + `omarchy-update-dev`, but Omarchy 4.0.6's `omarchy-update` calls + `omarchy-update-dev` before `omarchy-update-system-pkgs`, so nothing was + installed, and that decides what the user is told. *Check:* extract the + pinned package + (`~/.cache/omamobile-rootfs/pkg/omarchy--aarch64.pkg.tar.zst`, reading + its own `usr/bin` per L-498), then `grep -n` the failing step's + position in the caller. Extends L-29 and L-499. *From:* #548 with #549, + round 46, 2026-11-09. +- **L-653. Release notes started from the previous release's are grepped for + that release's version and for every sentence that rested on its + evidence.** #549's Installing section kept `omamobile-cheetah-2026.11.03.tar` + and its URL, and the Updates line kept "the release was tested with a + kernel update" from a run of the previous kernel; `tools/release tag` checks + only the kernel tag and `uname -r`. *Check:* `grep -n '' + docs/release-notes/.md`, `diff` the new notes against the previous + ones, and for each unchanged claim find the dated NOTES entry for this + release (or reword it to the date it was shown); the tag stage could refuse + any other `YYYY.MM.DD` outside a "previous release" line. Extends L-433 and + L-435. *From:* #549, round 46, 2026-11-09. +- **L-654. A "fixed" line in release notes is checked against the open issue + and the notes' own known issues.** #549 said a flat battery "recovers by + itself on most boots" while #169 was open, NOTES said the retry "waits for + the next real flat battery", and the same notes' known issue told people to + recover in fastboot. *Check:* for each "new" item that cites an issue, `gh + issue view N --json state`, and grep NOTES for "not yet", "waits for" and + "untested" next to the fix. Extends L-29 and L-435. *From:* #549, round 46, + 2026-11-09. +- **L-655. "A kernel update through the hook" is checked against which images + the hook wrote.** On cheetah the kernel is in `boot` and the DTB and + initramfs in `vendor_kernel_boot`; #560's record shows `boot_b` "already + there" and only `vendor_kernel_boot_b` written, with one `linux-omamobile` + in the release repository, so the "kernel update" was a rewrite of the same + kernel. *Check:* for a hook or `push` claim, read the per-image "written" and + "already there" lines and the package versions before and after; a changed + kernel writes `boot_b`. Extends L-435. *From:* #549 with #560, round 46, + 2026-11-09. +- **L-656. A record of a hook or `push` write that names only some images is + a reproducibility question.** With the same packages, + `omamobile-boot-update`'s hook should find all five images "already there" + on a fresh bundle install (RELEASES §11.4); #560's hook rewrote + `vendor_kernel_boot_b` alone. *Check:* when a record shows a partial write + on a fresh release install, ask for the package transaction and for which + part of the image differs, and compare the hook's saved previous set with + the bundle's image. Extends L-425. *From:* #560, round 46, 2026-11-09. +- **L-657. A NOTES entry that records harm from a step also updates the older + gotcha that prescribes that step.** NOTES 11-03 says root over SSH "needs + `OMARCHY_PATH=…`", the step that let 59 migrations run as root on 11-09 + (#560). *Check:* `grep -n` the older entries for the command the new entry + warns about. See L-623. *From:* #560, round 46, 2026-11-09. + ## Corrections (where a review was wrong) @@ -3974,3 +4489,18 @@ never change, so reviews can cite them. claim about an upstream series, read the cover letter (patch 0/N) and the maintainer's apply mail, not only the patches. Extends C-4. *From:* kernel #219 with #330, rounds 44-45. +- **C-34 (2026-11-09). Our 11-02 comment on #290 suggested `mapfile -t apks < + <(…) || die` as the explicit stop; it can never fail.** The `||` tests + mapfile's status (0), and a process substitution's exit status is lost, + under `set -e -o pipefail` too; the contributor caught it in #535. + *Lesson:* a shell error-handling form we suggest is run once with a failing + command before we post it (`bash -c 'set -euo pipefail; mapfile -t a < + <(false) || echo caught; echo went on'` prints "went on"). Extends C-4 and + L-229. *From:* #290 with #535, round 46. +- **C-35 (2026-11-09). Round 45 told #505's author "I ran `tests/dipper-probe` + … and they pass" without checking that anything calls it;** `tests/all` + doesn't, so CI never has, and round 45 wrote L-586 for #471 the same day. + *Lesson:* L-586 applies to every new file under `tests/` too, not only + package tests: `git grep -n '' -- tests .github` before + saying a test guards anything. *From:* #505, rounds 45-46. + From 5ce6b19e7a275c5e7c947d4044b78a6b3ce9a35a Mon Sep 17 00:00:00 2001 From: "Lefteris @SomniusX" Date: Mon, 9 Nov 2026 21:27:08 +0200 Subject: [PATCH 41/66] omamobile-remote 0.1.2: read the lock state once more before the first Return (#536) Two commits: the lock state is read once more before the first Return, and `omamobile-remote version` prints the package version, with a test/all check that it matches the version file. --- docs/REMOTE-TESTING.md | 2 +- packages/omamobile-remote/bin/omamobile-remote | 7 ++++++- packages/omamobile-remote/test/all | 10 +++++++++- packages/omamobile-remote/test/fake/hyprctl | 7 ++++++- packages/omamobile-remote/version | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/docs/REMOTE-TESTING.md b/docs/REMOTE-TESTING.md index 81abd02af..03153019a 100644 --- a/docs/REMOTE-TESTING.md +++ b/docs/REMOTE-TESTING.md @@ -14,7 +14,7 @@ It is opt-in. `omamobile-remote` and the patched `wlrctl` are in `packages/`, no On the phone, from the repository built by `tools/build-packages`: ``` -pacman -U wlrctl-0.2.2-1-aarch64.pkg.tar.* omamobile-remote-0.1.1-1-any.pkg.tar.* +pacman -U wlrctl-0.2.2-1-aarch64.pkg.tar.* omamobile-remote-0.1.2-1-any.pkg.tar.* ``` From your computer, an ssh key to the phone's user (USB networking is the easy way: `ssh user@172.16.42.1` on the images that have it). Every command below is run as that user: diff --git a/packages/omamobile-remote/bin/omamobile-remote b/packages/omamobile-remote/bin/omamobile-remote index a65904acd..c0e11867d 100755 --- a/packages/omamobile-remote/bin/omamobile-remote +++ b/packages/omamobile-remote/bin/omamobile-remote @@ -136,7 +136,7 @@ cmd=${1:-help} shift || true case $cmd in help|-h|--help) sed -n '3,30p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; - version) echo "omamobile-remote 0.1.1"; exit 0 ;; + version) echo "omamobile-remote 0.1.2"; exit 0 ;; esac find_session @@ -235,6 +235,11 @@ case $cmd in if [[ -z $pin && ! -t 0 ]]; then IFS= read -r pin || true; fi [[ -n $pin ]] || die "no PIN: set OMAMOBILE_PIN or pipe it in; it is never taken as an argument" wake; pause 0.5 + # waking the screen takes a moment too: read the state once more before + # the first Return, which would go to the focused app if the phone got + # unlocked meanwhile (a fingerprint, or whoever holds it) + st=$(lock_state) || exit 2 + if [[ $st != true ]]; then unset pin pin_env; echo "unlocked by something else before the first Return; nothing typed"; exit 0; fi wtype -k Return; pause 1.5 # the phone may have been unlocked in the meantime (a fingerprint, or # whoever holds it): then the PIN and the Return would go to an app diff --git a/packages/omamobile-remote/test/all b/packages/omamobile-remote/test/all index 7ce022219..d72dcf758 100755 --- a/packages/omamobile-remote/test/all +++ b/packages/omamobile-remote/test/all @@ -17,6 +17,10 @@ trap 'rm -rf "$tmp"' EXIT mkdir -p "$tmp/noproc" export OMAMOBILE_REMOTE_PROC=$tmp/noproc +# --- the printed version matches the version file +check "omamobile-remote version prints the version file" \ + test "$(bin/omamobile-remote version)" = "omamobile-remote $(cat version)" + # --- the scripts parse for f in bin/* install test/all test/fake/*; do if [[ $(head -n1 "$f") == '#!/bin/bash' ]]; then @@ -113,9 +117,13 @@ echo true > "$FAKE_STATE/locked" OMAMOBILE_PIN=$FAKE_PIN $R unlock >/dev/null check "unlock with the right PIN unlocks" bash -c '[[ $(cat "$FAKE_STATE/locked") == false ]]' echo true > "$FAKE_STATE/locked"; touch "$FAKE_STATE/unlock-on-return"; : > "$FAKE_LOG" -out=$(OMAMOBILE_PIN=$FAKE_PIN $R unlock); rc=$? +rc=0; out=$(OMAMOBILE_PIN=$FAKE_PIN $R unlock) || rc=$? rm -f "$FAKE_STATE/unlock-on-return" check "unlock stops without typing when the phone got unlocked after the first Return" bash -c "[[ $rc == 0 ]] && grep -q 'before the PIN' <<<'$out' && ! grep -q 'wtype - ' '$FAKE_LOG'" +echo true > "$FAKE_STATE/locked"; echo 0 > "$FAKE_STATE/dpms"; touch "$FAKE_STATE/unlock-on-wake"; : > "$FAKE_LOG" +rc=0; out=$(OMAMOBILE_PIN=$FAKE_PIN $R unlock) || rc=$? +rm -f "$FAKE_STATE/unlock-on-wake"; echo 1 > "$FAKE_STATE/dpms" +check "unlock stops before the first Return when the phone got unlocked while waking" bash -c "[[ $rc == 0 ]] && grep -q 'before the first Return' <<<'$out' && ! grep -q 'wtype -k Return' '$FAKE_LOG'" check "locked exits 1 when unlocked" bash -c '! omamobile-remote locked' check "the PIN is in no log, no journal line and no argument" bash -c '! grep -q "$FAKE_PIN" "$FAKE_LOG" "$FAKE_JOURNAL"' check "run does not pass the PIN on to what it starts" bash -c 'OMAMOBILE_PIN=$FAKE_PIN omamobile-remote run sh -c "echo [\${OMAMOBILE_PIN-unset}]" | grep -q "^\[unset\]$"' diff --git a/packages/omamobile-remote/test/fake/hyprctl b/packages/omamobile-remote/test/fake/hyprctl index 5744bc901..6d04293f6 100755 --- a/packages/omamobile-remote/test/fake/hyprctl +++ b/packages/omamobile-remote/test/fake/hyprctl @@ -3,6 +3,11 @@ case $1 in cursorpos) read -r x y < "$FAKE_STATE/pos"; echo "$x, $y" ;; monitors) printf 'Monitor DSI-1 (ID 0):\n\tdpmsStatus: %s\n' "$(cat "$FAKE_STATE/dpms" 2>/dev/null || echo 1)" ;; - dispatch) [[ $2 == *'dpms'*'enable'* ]] && echo 1 > "$FAKE_STATE/dpms"; echo "hyprctl $*" >> "$FAKE_LOG"; echo ok ;; + dispatch) + if [[ $2 == *'dpms'*'enable'* ]]; then + echo 1 > "$FAKE_STATE/dpms" + [[ -f $FAKE_STATE/unlock-on-wake ]] && echo false > "$FAKE_STATE/locked" + fi + echo "hyprctl $*" >> "$FAKE_LOG"; echo ok ;; layers) printf 'Monitor DSI-1:\n\tLayer level 2 (top):\n\t\tLayer aaab0946d770: xywh: 0 695 420 196, a: 1, namespace: osk, pid: 1\n' ;; esac diff --git a/packages/omamobile-remote/version b/packages/omamobile-remote/version index 17e51c385..d917d3e26 100644 --- a/packages/omamobile-remote/version +++ b/packages/omamobile-remote/version @@ -1 +1 @@ -0.1.1 +0.1.2 From 02b9fdb6fe36c170c9679d702b823d941d8f4c65 Mon Sep 17 00:00:00 2001 From: GrendelRTG Date: Mon, 9 Nov 2026 14:27:13 -0500 Subject: [PATCH 42/66] initramfs: guard UFS_RW partitions on a second LUN (UFS_RW_LUNS) (#530) The storage guard takes a list of LUNs whose UFS_RW partitions may be writable (UFS_RW_LUNS, default sda alone), so a device whose boot partitions sit on a second LUN can open them partition by partition while that disk stays read-only. It fails closed on a missing or malformed list, sda or a partition name in it, and glob or shell characters. No descriptor sets the key: enchilada's UFS_RW_LUNS=sde comes with the pull request that gives boot_b on sde a writer (push and the slot-B install, with its CONTRIBUTING section 3.1 entry). tests/storage-guard covers the second LUN with a test descriptor. Every Pixel's guard runs the same tests as before. --- bin/omamobile | 8 ++++ device/enchilada/NOTES.md | 14 +++++++ docs/RELEASES.md | 5 ++- initramfs/init | 35 +++++++++++++---- tests/storage-guard | 81 +++++++++++++++++++++++++++++++++++---- 5 files changed, 127 insertions(+), 16 deletions(-) diff --git a/bin/omamobile b/bin/omamobile index 752c2b144..753244013 100755 --- a/bin/omamobile +++ b/bin/omamobile @@ -142,6 +142,11 @@ load_device() { seen_rw+="$p " done [[ $seen_rw == *" userdata "* ]] || die "$file: UFS_RW must include userdata" + # Optional: LUNs besides sda that hold UFS_RW partitions; the init guards + # each as it guards sda (whole-disk node removed, partitions one by one) + if [[ -n ${DEV_UFS_RW_LUNS:-} && ! $DEV_UFS_RW_LUNS =~ ^sd[b-z]( sd[b-z])*$ ]]; then + die "$file: UFS_RW_LUNS may hold only disk names sdb to sdz separated by spaces" + fi if [[ $DEV_BOOT_METHOD == android-v0 ]]; then # One header-v0 boot.img: a gzip kernel with the board DTB appended, the @@ -558,6 +563,9 @@ initramfs_config() { # The storage guard's allowlist. Without this file the init leaves every # partition read-only. printf '%s\n' "${rw[*]}" > "$etc/omamobile-ufs-rw" + if [[ -n ${DEV_UFS_RW_LUNS:-} ]]; then + printf '%s\n' "$DEV_UFS_RW_LUNS" > "$etc/omamobile-ufs-rw-luns" + fi if [[ -n $product ]]; then printf '%s\n' "$product" > "$etc/omamobile-usb-product" fi diff --git a/device/enchilada/NOTES.md b/device/enchilada/NOTES.md index 96e8deb34..c45cb3a41 100644 --- a/device/enchilada/NOTES.md +++ b/device/enchilada/NOTES.md @@ -101,6 +101,20 @@ tree and goes away if stock is restored. 20 s and panics, and `panic=10` reboots the phone. ABL then starts the active slot, A, which is the rescue. +## 2026-11-08: the LUN-aware guard, booted RAM-only + +`fastboot boot` of an initramfs built from commit 2331a85 (the +`UFS_RW_LUNS` pull request, with `UFS_RW_LUNS=sde` in this descriptor), +kernel `7.1.0-rc1-sdm845`; nothing written. From the init's log and +`/sys/block`: + +- allowlist `boot_b userdata`; LUNs with allowlisted partitions `sda sde`; +- `/dev/sda` and `/dev/sde` removed; +- only `sda17` (`userdata`) and `sde39` (`boot_b`) writable; the other + 71 `sde` partitions `ro=1`; +- `sdb`, `sdc`, `sdd` and `sdf` read-only at the disk level; +- no UFS errors in the kernel log. + ## 2026-11-05: complete backup Taken from the slot-A rescue (`boot_a`, `system_a`), read-only. Every diff --git a/docs/RELEASES.md b/docs/RELEASES.md index ac96ac586..743080008 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -34,7 +34,7 @@ The audit behind this design (2026-10-13). "Step" names the roadmap step that re | `bin/omamobile initramfs` | the splash size comes from `PANEL_SIZE`; C sources from the device package when it has them. The init path and the trigger write come from the descriptor | 1 (done) | | `bin/omamobile capture` | the default capture name `cheetah-` | 1 (done) | | `bin/omamobile push`, `flash` | the partition lookup assumes the main LUN is `sda` | 1 (allowlist check and `BOOT_IMAGES` layouts done; the Pixel 6 has no `init_boot` or `vendor_kernel_boot`, [oriole NOTES](../device/oriole/NOTES.md)), 3 | -| `initramfs/init` | `probe()` when `BRINGUP_PROBE=1` and the board matches `COMPATIBLE` (watchdog and DPP reads); the main LUN `sda`. The TRIG_CON write is `SIMPLEFB_TRIG_CON`, the storage-guard allowlist `UFS_RW` and the USB product string `USB_PRODUCT`, all packed from the descriptor into that device's initramfs only | 2 (trigger, allowlist and USB name done; the rest still step 2) | +| `initramfs/init` | `probe()` when `BRINGUP_PROBE=1` and the board matches `COMPATIBLE` (watchdog and DPP reads); the main LUN `sda`. The TRIG_CON write is `SIMPLEFB_TRIG_CON`, the storage-guard allowlist `UFS_RW` (and `UFS_RW_LUNS`) and the USB product string `USB_PRODUCT`, all packed from the descriptor into that device's initramfs only | 2 (trigger, allowlist and USB name done; the rest still step 2) | | `bin/omamobile initramfs` | the developer's `~/.ssh/*.pub` baked in as `authorized_keys` (fine for development, never for a release); `--release` leaves them out, and `tools/make-bundle` refuses to sign an initramfs that has them | 2 (done) | | `tools/extract-vendor-firmware` | `BOARD="google,gs201-cheetah"`, `DEVICE="cheetah"`, the firmware `MAP` | 4 | | `tools/extract-vendor-chroot`, `extract-fingerprint-vendor` | `DEVICE="cheetah"`, cheetah's file lists | 4 | @@ -80,6 +80,7 @@ Bring-up tools (`*-stage`, `display-hz`, `usbc-deadman`) stay per plan: they pok | `PAGESIZE`, `BASE`, `KERNEL_OFFSET`, `RAMDISK_OFFSET`, `SECOND_OFFSET`, `TAGS_OFFSET` | (enchilada: `4096`, `0x00000000`, `0x00008000`, `0x01000000`, `0x00f00000`, `0x00000100`) | `android-v0` only, all required: the header-v0 page size and load offsets, numbers in decimal or lower-case hex. `images` packs the gzip `Image` with the `DTB` appended as the kernel, the initramfs as the ramdisk and `CMDLINE` as the command line. `BOOT_IMAGES` is `boot` alone and `boot_b` must be on `UFS_RW` | | `BOOT_IMAGES` | `boot init_boot vendor_boot vendor_kernel_boot dtbo` | The images written to slot B (the `_b` suffix is added by the tools and is not configurable). `boot`, `vendor_boot` and `dtbo` are always there. Without `init_boot`, `boot` carries the empty generic ramdisk and the OS version; without `vendor_kernel_boot`, `vendor_boot` carries the DTB and the initramfs (the Pixel 6: `boot vendor_boot dtbo`) | | `UFS_RW` | `boot_b … dtbo_b userdata` | The storage guard's allowlist, packed into the initramfs as `/etc/omamobile-ufs-rw`. Only slot B's boot images (`boot_b`, `init_boot_b`, `vendor_boot_b`, `vendor_kernel_boot_b`, `dtbo_b`) and `userdata` are accepted, `userdata` and every `BOOT_IMAGES` entry must be on it, and each name only once. The init fails closed: a missing, empty or malformed file, or any other name in it, leaves every partition read-only | +| `UFS_RW_LUNS` | (unset) | Optional. The LUNs besides `sda` that hold `UFS_RW` partitions, as disk names `sdb` to `sdz`, packed as `/etc/omamobile-ufs-rw-luns`. The init guards each as it guards `sda`: the whole-disk node removed, the disk left writable, and only its `UFS_RW` partitions left writable. Absent (every descriptor so far), malformed, or with a closed allowlist: every LUN but `sda` stays read-only at the disk level. Boot-image writers on the phone (`omamobile-boot-update`) still look only on `sda` | | `INITRAMFS_INIT` | `/initramfs/init` | The init script. A leading `/` is relative to the repo root, so devices share one script. Any other value is relative to the descriptor | | `INITRAMFS_MODULES` | (unset) | Optional: kernel modules the initramfs carries in `/lib/modules/omamobile/`, listed in load order in `/lib/modules/omamobile/order`, from this kernel build's `lib/modules/$(kernel_release)` (`omamobile modules` first). The shared init loads them before any other step, and only on a board whose first compatible is `COMPATIBLE`. For drivers the boot needs before the Arch root, such as the PMIC rails a `simple-framebuffer` waits for; `images` refuses an initramfs whose modules come from another build | | `INITRAMFS_I2C_TOOLS` | (unset) | `1`: `i2cget` and `i2cset` (and `libi2c`) from Alpine's i2c-tools in the initramfs, for an init that talks to a chip before any driver runs (raven closes the MAX77759 USB switch). Nothing else from the package | @@ -123,7 +124,7 @@ What `bin/omamobile` checks, so a wrong descriptor fails the build rather than t - the descriptor's format, required keys and `CODENAME`; - `UFS_RW` holds only slot B's boot images and `userdata`, each once, includes `userdata`, and covers every `BOOT_IMAGES` entry; - `BOOT_IMAGES` names only `boot`, `init_boot`, `vendor_boot`, `vendor_kernel_boot` and `dtbo`, each once, and includes `boot`, `vendor_boot` and `dtbo`; -- `initramfs` packs the checked `UFS_RW` into the image (`/etc/omamobile-ufs-rw`), so the init's allowlist is the descriptor's; +- `initramfs` packs the checked `UFS_RW` into the image (`/etc/omamobile-ufs-rw`), so the init's allowlist is the descriptor's, and `UFS_RW_LUNS`, when set, holds only disk names `sdb` to `sdz` (`/etc/omamobile-ufs-rw-luns`); - the DTB really is built with the first `SOC_IDS` value, and each rewrite took; - with `SOC_COMPATIBLE` instead, the DTB has a `/soc_compatible` node holding exactly its entries (one child each, labelled or not), and a descriptor never names both keys; - `AVB_FOOTERS` names only the device's boot images, once each, with block-aligned partition sizes, and comes with its rollback index and security patch; the footers are deterministic (the salt is the image's own hash) for a given avbtool: the footer records avbtool's version, which `images` prints, so another `external/avb` checkout gives other bytes; diff --git a/initramfs/init b/initramfs/init index 36cd2d946..f33cbd631 100755 --- a/initramfs/init +++ b/initramfs/init @@ -50,7 +50,8 @@ ufs_ro_log() { echo "omamobile: ufs-ro: $*" > /dev/kmsg; } # userdata (the Arch root). The kernel only lets a partition be written if # its whole disk is writable too, so the main disk (sda) stays writable but # its whole-disk node is removed, so nothing can write across partitions by -# accident. The boot LUNs (sdb, sdc, sdd: bootloader images) are read-only +# accident; a LUN the descriptor's UFS_RW_LUNS names is guarded the same way. +# The other LUNs (on Pixels sdb, sdc, sdd: bootloader images) are read-only # at the disk level. Calibration partitions (efs, persist, modem_userdata...) # and all of slot A stay read-only. # The allowlist is the descriptor's UFS_RW, which bin/omamobile initramfs @@ -59,6 +60,9 @@ ufs_ro_log() { echo "omamobile: ufs-ro: $*" > /dev/kmsg; } # start and the initramfs shell stays up over SSH. Whatever the file says, # only slot B's boot images and userdata can be named. UFS_RW="" +UFS_RW_LUNS="" +# Is $1 a disk that holds allowlisted partitions? sda always. +ufs_rw_disk() { case " sda $UFS_RW_LUNS " in *" $1 "*) true ;; *) false ;; esac; } ufs_rw_load() { local list p if [ ! -s /etc/omamobile-ufs-rw ]; then @@ -88,6 +92,23 @@ ufs_rw_load() { done UFS_RW="$*" ufs_ro_log "allowlist: $UFS_RW" + # LUNs besides sda that hold allowlisted partitions (the descriptor's + # UFS_RW_LUNS: enchilada's boot_b is on sde). Each is guarded as sda is. + # Malformed: none, so their partitions stay read-only. + [ -s /etc/omamobile-ufs-rw-luns ] || return 0 + list=$(cat /etc/omamobile-ufs-rw-luns) + # shellcheck disable=SC2086 # split into names on purpose + case "$list" in *[!a-z\ ]*) set -- bad ;; *) set -- $list ;; esac + for p in "$@"; do + case "$p" in + sd[b-z]) ;; + *) + ufs_ro_log "malformed LUN list in /etc/omamobile-ufs-rw-luns: every LUN but sda read-only" + return 0 ;; + esac + done + UFS_RW_LUNS="$*" + ufs_ro_log "LUNs with allowlisted partitions: sda $UFS_RW_LUNS" } ufs_rw_load mkdir -p /run/ufs-ro @@ -99,14 +120,14 @@ ufs_ro_pass() { name=${s##*/} [ -e "/run/ufs-ro/$name" ] && continue [ -b "/dev/$name" ] || continue # devtmpfs node not there yet: next pass - if [ "$name" = sda ]; then - rm -f /dev/sda + if ufs_rw_disk "$name"; then + rm -f "/dev/$name" : > "/run/ufs-ro/$name" - ufs_ro_log "/dev/sda: whole-disk node removed (partitions guarded individually)" + ufs_ro_log "/dev/$name: whole-disk node removed (partitions guarded individually)" continue fi part=$(ufs_partname "$s") - if [ -n "$part" ] && [ "${name%%[0-9]*}" = sda ] && \ + if [ -n "$part" ] && ufs_rw_disk "${name%%[0-9]*}" && \ case " $UFS_RW " in *" $part "*) true ;; *) false ;; esac; then : > "/run/ufs-ro/$name" ufs_ro_log "/dev/$name ($part) left writable (allowlist)" @@ -131,11 +152,11 @@ ufs_unguarded() { for s in /sys/block/sd* /sys/block/sd*/sd*; do [ -r "$s/ro" ] || continue name=${s##*/} - [ "$name" = sda ] && continue + ufs_rw_disk "$name" && continue read -r ro < "$s/ro" [ "$ro" = 0 ] || continue part=$(ufs_partname "$s") - if [ -n "$part" ] && [ "${name%%[0-9]*}" = sda ]; then + if [ -n "$part" ] && ufs_rw_disk "${name%%[0-9]*}"; then case " $UFS_RW " in *" $part "*) continue ;; esac fi echo "$name${part:+ ($part)}" diff --git a/tests/storage-guard b/tests/storage-guard index efcec83a3..8cce6ad78 100755 --- a/tests/storage-guard +++ b/tests/storage-guard @@ -7,7 +7,10 @@ # here against a fake sysfs and /dev: a missing, empty or malformed file, or # a forbidden name, leaves every partition read-only; cheetah's list leaves # exactly its six partitions writable, as the hard-coded list did; /dev/sda's -# whole-disk node is removed either way. +# whole-disk node is removed either way. A LUN named in UFS_RW_LUNS (a +# test descriptor's sde, enchilada's layout) is guarded as sda is; without +# that list, or with a bad one or a closed allowlist, it stays read-only at +# the disk level. set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; } @@ -31,6 +34,8 @@ if [[ $(grep -c '^ *UFS_RW=' initramfs/init) != 2 ]] || ! grep -q '^UFS_RW=""$' fail "initramfs/init has no allowlist of its own, only the packed one" fi grep -q '^ initramfs_config "\$stage/etc"$' bin/omamobile || fail "initramfs packs the files into the image's /etc" +[[ ! -e $t/etc-cheetah/omamobile-ufs-rw-luns && ! -e $t/etc-oriole/omamobile-ufs-rw-luns ]] || fail "the Pixels pack no LUN list" +pass "the Pixels pack no LUN list" pass "cheetah, felix and akita pack the six-name list, oriole and bluejay their three boot images and userdata" # --- Pack time: refused descriptors, in a repository-shaped tree --- @@ -42,9 +47,17 @@ sed -e 's/^CODENAME=.*/CODENAME=six/' device/oriole/device.conf > "$R/device/six cp "$R/device/six/device.conf" "$t/good.conf" om() { (cd "$R" && DEVICE=six bin/omamobile "$@") > "$t/log" 2>&1; } om initramfs-config "$t/etc-six" || { cat "$t/log"; fail "the test descriptor packs"; } -refused() { # what, UFS_RW value, expected message +# A second test descriptor with enchilada's layout: boot_b on LUN sde +mkdir -p "$R/device/lun" +{ sed -e 's/^CODENAME=.*/CODENAME=lun/' device/enchilada/device.conf; echo UFS_RW_LUNS=sde; } > "$R/device/lun/device.conf" +(cd "$R" && DEVICE=lun bin/omamobile initramfs-config "$t/etc-lun") > "$t/log" 2>&1 || { cat "$t/log"; fail "lun: initramfs-config"; } +[[ $(cat "$t/etc-lun/omamobile-ufs-rw") == "boot_b userdata" && $(cat "$t/etc-lun/omamobile-ufs-rw-luns") == sde ]] \ + || fail "the lun descriptor packs its UFS_RW and UFS_RW_LUNS" +pass "a descriptor with UFS_RW_LUNS=sde packs boot_b userdata and its LUN sde" +refused() { # what, value, expected message[, key appended instead of UFS_RW] cp "$t/good.conf" "$R/device/six/device.conf" - sed -i "s/^UFS_RW=.*/UFS_RW=\"$2\"/" "$R/device/six/device.conf" + if [[ -n ${4:-} ]]; then printf '%s="%s"\n' "$4" "$2" >> "$R/device/six/device.conf" + else sed -i "s/^UFS_RW=.*/UFS_RW=\"$2\"/" "$R/device/six/device.conf"; fi rm -rf "$t/etc-bad" if om initramfs-config "$t/etc-bad"; then fail "refuses $1"; fi grep -c -- "$3" "$t/log" >/dev/null || { cat "$t/log"; fail "refuses $1 with: $3"; } @@ -63,6 +76,10 @@ refused "a name twice" "boot_b vendor_boot_b dtbo_b userdata boot_b" "names boot refused "upper case" "boot_b vendor_boot_b dtbo_b USERDATA" "only partition names" refused "a glob" "boot_b vendor_boot_b dtbo_b userdata *" "only partition names" refused "a boot image missing" "boot_b vendor_boot_b userdata" "dtbo_b is not in UFS_RW" +refused "sda as an extra LUN" "sda" "UFS_RW_LUNS may hold only" UFS_RW_LUNS +refused "a LUN path" "/dev/sde" "UFS_RW_LUNS may hold only" UFS_RW_LUNS +refused "shell syntax in the LUN list" "sde;sdf" "UFS_RW_LUNS may hold only" UFS_RW_LUNS +refused "a LUN with a partition number" "sde1" "UFS_RW_LUNS may hold only" UFS_RW_LUNS cp "$t/good.conf" "$R/device/six/device.conf" # --- Boot time: initramfs/init's guard against a fake sysfs and /dev --- @@ -100,22 +117,37 @@ fake_disks() { echo 0 > "$B/sys/block/sdb/ro"; : > "$B/dev/sdb" printf 'PARTNAME=bl1_a\n' > "$B/sys/block/sdb/sdb1/uevent" echo 0 > "$B/sys/block/sdb/sdb1/ro"; : > "$B/dev/sdb1" + # A LUN that holds slot B's boot image beside slot A's and vbmeta (enchilada) + mkdir -p "$B/sys/block/sde"; echo 0 > "$B/sys/block/sde/ro" + : > "$B/dev/sde"; i=0 + for p in boot_a boot_b dtbo_b vbmeta_b; do + i=$((i + 1)) + mkdir -p "$B/sys/block/sde/sde$i" + printf 'PARTNAME=%s\n' "$p" > "$B/sys/block/sde/sde$i/uevent" + echo 0 > "$B/sys/block/sde/sde$i/ro"; : > "$B/dev/sde$i" + done } guard() { # run the guard's load and one pass PATH="$t/bin:$PATH" sh -c ". '$t/guard-test.sh'; ufs_ro_pass" } -writable() { # names of the partitions left writable, in GPT order +writable() { # names of the partitions left writable on a disk (sda), in GPT order local s out="" - for s in "$B"/sys/block/sda/sda*; do + for s in "$B"/sys/block/${1:-sda}/${1:-sda}*; do [[ $(cat "$s/ro") == 0 ]] && out+="$(sed -n 's/^PARTNAME=//p' "$s/uevent") " done printf '%s' "${out% }" } -disk_checks() { # $1: case name +disk_checks() { # $1: case name; $2: sde when sde is a listed LUN [[ ! -e $B/dev/sda ]] || fail "$1: /dev/sda's whole-disk node is removed" [[ $(cat "$B/sys/block/sda/ro") == 0 ]] || fail "$1: sda itself stays writable (the kernel needs it for its partitions)" [[ $(cat "$B/sys/block/sdb/ro") == 1 && $(cat "$B/sys/block/sdb/sdb1/ro") == 1 ]] || fail "$1: the boot LUN is read-only" - grep -q 'whole-disk node removed' "$B/dev/kmsg" || fail "$1: the sda removal is logged" + grep -q '/dev/sda: whole-disk node removed' "$B/dev/kmsg" || fail "$1: the sda removal is logged" + if [[ ${2:-} == sde ]]; then + [[ ! -e $B/dev/sde && $(cat "$B/sys/block/sde/ro") == 0 ]] || fail "$1: sde is guarded as sda is" + else + [[ -e $B/dev/sde && $(cat "$B/sys/block/sde/ro") == 1 && -z $(writable sde) ]] \ + || fail "$1: an unlisted LUN is read-only, boot_b on it too (writable: $(writable sde))" + fi } fake_disks @@ -169,3 +201,38 @@ fake_disks; printf 'boot_b vendor_boot_b dtbo_b userdata persist\n' > "$B/etc/om closed "persist in the allowlist" "allowlist names persist" fake_disks; printf 'boot_a userdata\n' > "$B/etc/omamobile-ufs-rw" closed "a slot A name in the allowlist" "allowlist names boot_a" + +# --- A second LUN: boot_b on sde (enchilada's layout) --- +unguarded() { PATH="$t/bin:$PATH" sh -c ". '$t/guard-test.sh'; ufs_unguarded"; } +fake_disks +cp "$t/etc-lun/omamobile-ufs-rw" "$t/etc-lun/omamobile-ufs-rw-luns" "$B/etc/" +guard +[[ $(writable sde) == boot_b ]] || fail "lun: only boot_b is writable on sde (got: $(writable sde))" +[[ $(writable) == "boot_b userdata" ]] || fail "lun: its names on sda (got: $(writable))" +grep -q "LUNs with allowlisted partitions: sda sde" "$B/dev/kmsg" || fail "lun: the LUN list is logged" +disk_checks lun sde +[[ -z $(unguarded) ]] || fail "lun: nothing outside the allowlist is writable (got: $(unguarded))" +echo 0 > "$B/sys/block/sde/sde4/ro" +[[ $(unguarded) == "sde4 (vbmeta_b)" ]] || fail "lun: a reopened partition on sde is reported (got: $(unguarded))" +pass "the lun lists: sde guarded as sda, boot_b alone writable there; the hand-over check covers sde" + +fake_disks +cp "$t/etc-lun/omamobile-ufs-rw" "$B/etc/" +guard +disk_checks "lun without its LUN list" +pass "without UFS_RW_LUNS, sde stays read-only at the disk level, as before" + +for bad in 'sde sda' 'sde;sdf' '/dev/sde' 'sde1' 'SDE'; do + fake_disks + cp "$t/etc-lun/omamobile-ufs-rw" "$B/etc/" + printf '%s\n' "$bad" > "$B/etc/omamobile-ufs-rw-luns" + guard + grep -q "malformed LUN list" "$B/dev/kmsg" || { cat "$B/dev/kmsg"; fail "LUN list '$bad': says so on kmsg"; } + disk_checks "LUN list '$bad'" + [[ $(writable) == "boot_b userdata" ]] || fail "LUN list '$bad': sda keeps its allowlist (got: $(writable))" +done +pass "a malformed LUN list leaves every LUN but sda read-only" + +fake_disks +printf 'boot_b userdata persist\n' > "$B/etc/omamobile-ufs-rw"; printf 'sde\n' > "$B/etc/omamobile-ufs-rw-luns" +closed "a closed allowlist with a LUN list" "allowlist names persist" From 3b3c8bb7a39eca26b27ddaf52e2b7d1739de4c1c Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Mon, 9 Nov 2026 14:35:05 -0500 Subject: [PATCH 43/66] device/enchilada, DEVICES: the LUN-aware guard is in; the opt-in comes with the slot-B install (#580) #530 merged the guard's UFS_RW_LUNS without enchilada's opt-in, so the NOTES and the DEVICES row no longer call it a pull request to come: they say enchilada's UFS_RW_LUNS=sde arrives with the slot-B install that gives boot_b on sde a writer. Co-authored-by: Claude Opus 5.5 --- device/enchilada/NOTES.md | 5 +++-- docs/DEVICES.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/device/enchilada/NOTES.md b/device/enchilada/NOTES.md index c45cb3a41..990d7efe8 100644 --- a/device/enchilada/NOTES.md +++ b/device/enchilada/NOTES.md @@ -180,8 +180,9 @@ wrote nothing. nothing mounted. - **`boot_b` is on LUN `sde`, not `sda`.** The shared guard's `UFS_RW` only looks at `sda`, so `boot_b` and `dtbo_b` stay read-only (seen - live). This is the same split as dodge; a LUN-aware `UFS_RW` will be its - own shared pull request. + live). This is the same split as dodge. The guard can now open a second + LUN (`UFS_RW_LUNS`, #530); enchilada's `UFS_RW_LUNS=sde` comes with the + slot-B install, which gives `boot_b` on `sde` a writer. - msm DRM came up (`fb0` is `msmdrmfb`). - ABL appends `root=PARTUUID= skip_initramfs ro init=/init` to the command line even on `fastboot boot`. The shared init runs as PID 1 diff --git a/docs/DEVICES.md b/docs/DEVICES.md index 35da976d8..446d6c59e 100644 --- a/docs/DEVICES.md +++ b/docs/DEVICES.md @@ -80,5 +80,5 @@ Devices we'd like to support, with the closest starting point. Open an issue to | Pixel 4 XL | coral | SM8150 (Snapdragon 855) | **WIP, community port**, in the matrix above: bring-up notes merged ([#52](https://github.com/derekross/omarchy-mobile/pull/52): [BRINGUP-M1](../device/coral/BRINGUP-M1.md), [NOTES](../device/coral/NOTES.md)), with companion kernel/userspace sources ([omarchy-mobile-coral v0.2.3](https://github.com/HemangKumawat/omarchy-mobile-coral/tree/v0.2.3)); slot-B installer and `CONTRIBUTING.md` §3.1 entry still to land | | POCO F3 | alioth | SM8250 (Snapdragon 870) | the first non-Pixel port: a guarded installer and root image in review ([#25](https://github.com/derekross/omarchy-mobile/pull/25)) | | OnePlus 13 | dodge | SM8750 (Snapdragon 8 Elite) | **WIP, community port**, in the matrix above: device files, notes and the qcom-abl boot images merged ([#111](https://github.com/derekross/omarchy-mobile/pull/111)); its kernel stays in the contributor's fork ([mrlund/linux-omarchy-mobile `dodge-v3-20261101`](https://github.com/mrlund/linux-omarchy-mobile/tree/dodge-v3-20261101); [kernel #115](https://github.com/derekross/linux-omarchy-mobile/pull/115) closed: the SoC series is out of this tree's scope); the guarded installer follows in a later pull request | -| OnePlus 6 | enchilada | SDM845 (Snapdragon 845) | **WIP, community port: [#432](https://github.com/derekross/omarchy-mobile/issues/432)**, in the matrix above: descriptor and notes; RAM-only (`fastboot boot`) until the slot-B install and its CONTRIBUTING.md §3.1 entry are agreed; `omamobile images` packs its header-v0 boot image, and a LUN-aware `UFS_RW` follows in its own pull request | +| OnePlus 6 | enchilada | SDM845 (Snapdragon 845) | **WIP, community port: [#432](https://github.com/derekross/omarchy-mobile/issues/432)**, in the matrix above: descriptor and notes; RAM-only (`fastboot boot`) until the slot-B install and its CONTRIBUTING.md §3.1 entry are agreed; `omamobile images` packs its header-v0 boot image, and its `UFS_RW_LUNS=sde` (the guard's second-LUN list, #530) comes with the slot-B install | | PinePhone Pro | pinephone-pro | Rockchip RK3399S | No port in this tree yet; mainline's `rk3399-pinephone-pro.dts` is already in our kernel. Prior art: [Omarchy on the PinePhone Pro](https://github.com/FlorencioJP/omarchy-mobile-pinephone-pro) | From 472f3684163eaa764d255eb22ca9d4d2a2ea8584 Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:36:08 +0100 Subject: [PATCH 44/66] omamobile-modem-sit 0.3.33: fail the status probe on incomplete replies (#569) The read-only probe previously exited successfully after missing status replies. Return failure for malformed SIM status, malformed mandatory states, empty replies and request errors while always closing the client. Keep the legitimate no-SIM SMSC error 11 exception and the existing first USIM timeout. Add eight tests against the real service.probe with inert replies and advance the package version. Co-authored-by: OpenAI Codex --- packages/omamobile-modem-sit/lib/service.py | 13 ++++ .../omamobile-modem-sit/test/test_probe.py | 74 +++++++++++++++++++ packages/omamobile-modem-sit/version | 2 +- 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 packages/omamobile-modem-sit/test/test_probe.py diff --git a/packages/omamobile-modem-sit/lib/service.py b/packages/omamobile-modem-sit/lib/service.py index a7967edd1..df2dc7dfb 100644 --- a/packages/omamobile-modem-sit/lib/service.py +++ b/packages/omamobile-modem-sit/lib/service.py @@ -844,6 +844,7 @@ def probe(): states, radio state, packet registration, NR mode, whether an SMSC is set. No identifiers are printed; nothing is changed.""" client = Sit() + failed = False try: # The CP answered the first request 9.4 s after ONLINE on 2026-11-02. sim = client.request(0x0200, timeout=20) @@ -852,6 +853,7 @@ def probe(): [(sim[i], sim[i + 1]) for i in range(3, 3 + sim[2] * 63, 63)], flush=True) else: print('SIM status layout unexpected, length', len(sim), flush=True) + raise SystemExit(1) for ident, label in ((0x0801, 'radio state'), (0x0701, 'packet registration'), (0x0749, 'NR mode'), (0x0711, 'PS service')): try: @@ -862,16 +864,27 @@ def probe(): print(label, 'state', value[0], 'reject', value[1], 'RAT', value[3], flush=True) else: print(label, list(value[:4]), flush=True) + if ident in (0x0801, 0x0701) or not value: + failed = True except (ModemError, TimeoutError) as error: print(label, 'unavailable:', error, flush=True) + failed = True try: smsc = client.request(0x0108) print('SMSC present', bool(smsc and smsc[0]), flush=True) + if not smsc: + failed = True except (ModemError, TimeoutError) as error: print('SMSC unavailable:', error, flush=True) + # Without a SIM the CP legitimately rejects the SMSC request. + if not (sim[0] == 0 and isinstance(error, ModemError) and error.error == 11): + failed = True finally: client.close() + if failed: + raise SystemExit(1) + def main(): parser = argparse.ArgumentParser(description='Omarchy Mobile SIT RIL: calls, SMS and data registration') diff --git a/packages/omamobile-modem-sit/test/test_probe.py b/packages/omamobile-modem-sit/test/test_probe.py new file mode 100644 index 000000000..a6ccb1551 --- /dev/null +++ b/packages/omamobile-modem-sit/test/test_probe.py @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: MIT +import env # noqa: F401 (private paths before imports) +import contextlib +import io +import struct +import unittest +from unittest.mock import patch +import service + + +class ProbeTests(unittest.TestCase): + def execute(self, overrides=None, present=False): + sim = bytes([1, 0, 1, 2, 5] + [0] * 61) if present else bytes(3) + replies = {0x0200: sim, 0x0801: struct.pack(' Date: Mon, 9 Nov 2026 13:46:56 -0600 Subject: [PATCH 45/66] tests: read the whole pipe instead of grep -q under pipefail (#575) * tests: read the whole pipe instead of grep -q under pipefail AGENTS.md's Userspace gotcha (and review lesson L-15): grep -q exits at its first match, the command still writing into the pipe gets SIGPIPE, and pipefail fails the pipeline. Issue #457 is this race in the modem NV-overlay test, reproduced every time with PYTHONUNBUFFERED=1. The same pattern sits in other test scripts that set pipefail. A "|| fail" check then fails at random, and a "&& fail" or "! ... || fail" check passes when it should fail. Replace each grep -q with grep -c ... >/dev/null, which reads all of its input; the patterns, -x, -E, -v, negations and messages stay as they were, so no check asserts anything new. packages/omamobile-modem/test/nv-overlay is left alone: the maintainer offered its fix to the reporter of #457. Two kinds of line can't race and change only so that no test pipes into grep -q: the audio filter check reads one line from grep -c, and the three omamobile-remote checks run in a child bash without pipefail. Tested: each racing pattern run 20 times with a writer that keeps writing after the match (old: a false fail or a false pass 20 of 20; new: the right result 20 of 20); tests/packages for every touched package, where omamobile-audio stops at two host-only checks that fail the same way on main; and tests/all, where only release-upload fails, on a checkout path containing "/.". Test-only, so no package versions change (#457). Co-Authored-By: Claude Opus 5.5 * tests/grep-q-pipes: no test script under pipefail pipes into grep -q A small guard so the previous commit's fix holds: it git-greps the test scripts that set pipefail (tests/ and packages/*/test) for a pipe into grep -q, --quiet or --silent, and fails with the lines it found. It first checks its own pattern against lines it must and must not match (a "||" before grep, a here-string, grep -c). nv-overlay is left out until #457's fix lands. Tested: passes on this branch (46 scripts); on origin/main's tree it fails and lists the lines the previous commit changes. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- packages/omamobile-audio/test/all | 2 +- packages/omamobile-device-akita/test/all | 2 +- packages/omamobile-device-cheetah/test/all | 4 +-- packages/omamobile-device-felix/test/all | 2 +- packages/omamobile-device-husky/test/all | 2 +- packages/omamobile-device-lynx/test/all | 4 +-- packages/omamobile-device-panther/test/all | 2 +- packages/omamobile-device-raven/test/all | 4 +-- packages/omamobile-fingerprint/test/all | 2 +- packages/omamobile-gnss/test/all | 2 +- packages/omamobile-mirror/test/all | 4 +-- packages/omamobile-modem/test/all | 2 +- packages/omamobile-remote/test/all | 6 ++--- tests/all | 5 ++-- tests/grep-q-pipes | 29 ++++++++++++++++++++++ tests/initramfs-reproducible | 4 +-- tests/install-phone | 6 ++--- tests/rootfs-smoke | 16 ++++++------ 18 files changed, 64 insertions(+), 34 deletions(-) create mode 100755 tests/grep-q-pipes diff --git a/packages/omamobile-audio/test/all b/packages/omamobile-audio/test/all index ed70024a7..31f1283f1 100755 --- a/packages/omamobile-audio/test/all +++ b/packages/omamobile-audio/test/all @@ -1027,7 +1027,7 @@ fi # --- the speaker filter and its tone controls (C9g) ------------------------------- conf=pipewire/60-omamobile-speaker-loudness.conf grep -c 'condition = \[ { omamobile.speaker-eq = package } \]' "$conf" >/dev/null && - grep -c 'omamobile.speaker-eq = package' "$conf" | grep -qx 2 || fail "filter: loads only while no user copy is saved" + grep -c 'omamobile.speaker-eq = package' "$conf" | grep -cx 2 >/dev/null || fail "filter: loads only while no user copy is saved" grep -c 'flags = \[ nofail \]' "$conf" >/dev/null || fail "filter: PipeWire starts without it if it fails to load" grep -c 'node.name = "alsa_output.platform-sound-aoc.HiFi__Speaker__sink"' "$conf" >/dev/null || fail "filter: the speaker sink only" grep -c 'api.alsa.card.name = "google,aoc-snd-card"' "$conf" >/dev/null || fail "filter: the Pixel 7 Pro's card only" diff --git a/packages/omamobile-device-akita/test/all b/packages/omamobile-device-akita/test/all index c46f8d81e..8dc567dd4 100755 --- a/packages/omamobile-device-akita/test/all +++ b/packages/omamobile-device-akita/test/all @@ -120,7 +120,7 @@ pass "no lid drop-in" # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-device-cheetah/test/all b/packages/omamobile-device-cheetah/test/all index 12cd88a82..04501f703 100755 --- a/packages/omamobile-device-cheetah/test/all +++ b/packages/omamobile-device-cheetah/test/all @@ -29,7 +29,7 @@ buf[0x34:0x38] = bytes([1, 0x04, 0, 0]) # slot b: active, not successful open(sys.argv[1], "wb").write(buf) PY cp "$tmp/devinfo" "$tmp/devinfo.orig" -"$tmp/build/omamobile-bootctl" dump "$tmp/devinfo" | grep -q 'version: 3.15' || fail "bootctl decodes devinfo" +"$tmp/build/omamobile-bootctl" dump "$tmp/devinfo" | grep -c 'version: 3.15' >/dev/null || fail "bootctl decodes devinfo" plan=$("$tmp/build/omamobile-bootctl" mark-successful "$tmp/devinfo" b 2>&1 || true) grep -q '0x35: 04 -> 06' <<<"$plan" || fail "mark-successful plans one byte (0x35: 04 -> 06)" cmp -s "$tmp/devinfo" "$tmp/devinfo.orig" || fail "a dry run writes nothing" @@ -142,7 +142,7 @@ pass "install ships the staged boot files for omamobile-boot-update, checked, an # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-device-felix/test/all b/packages/omamobile-device-felix/test/all index 7c46a57bd..82ae85158 100755 --- a/packages/omamobile-device-felix/test/all +++ b/packages/omamobile-device-felix/test/all @@ -108,7 +108,7 @@ pass "install stages the udev rule, the USB link, and the mirrorlist, and nothin # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-device-husky/test/all b/packages/omamobile-device-husky/test/all index e7979d4d7..ce4c7b1a0 100755 --- a/packages/omamobile-device-husky/test/all +++ b/packages/omamobile-device-husky/test/all @@ -160,7 +160,7 @@ pass "the display start loads gs_decon after allowing DSI commands for google-hk # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-device-lynx/test/all b/packages/omamobile-device-lynx/test/all index 727245c58..ab2d94881 100755 --- a/packages/omamobile-device-lynx/test/all +++ b/packages/omamobile-device-lynx/test/all @@ -78,7 +78,7 @@ buf[0x34:0x38] = bytes([1, 0x04, 0, 0]) # slot b: active, not successful open(sys.argv[1], "wb").write(buf) PY2 cp "$tmp/devinfo" "$tmp/devinfo.orig" -"$tmp/build/omamobile-bootctl" dump "$tmp/devinfo" | grep -q 'version: 3.15' || fail "bootctl decodes devinfo" +"$tmp/build/omamobile-bootctl" dump "$tmp/devinfo" | grep -c 'version: 3.15' >/dev/null || fail "bootctl decodes devinfo" plan=$("$tmp/build/omamobile-bootctl" mark-successful "$tmp/devinfo" b 2>&1 || true) grep -q '0x35: 04 -> 06' <<<"$plan" || fail "mark-successful plans one byte (0x35: 04 -> 06)" cmp -s "$tmp/devinfo" "$tmp/devinfo.orig" || fail "a dry run writes nothing" @@ -127,7 +127,7 @@ pass "install stages the udev rule, the USB link, the mirrorlist, and the boot-s # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index d4b6baeea..56ad60d8d 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -215,7 +215,7 @@ pass "the camera drivers never autoload; omamobile-camera-start loads them from # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-device-raven/test/all b/packages/omamobile-device-raven/test/all index 07cb77cf1..6d1c4d9e2 100755 --- a/packages/omamobile-device-raven/test/all +++ b/packages/omamobile-device-raven/test/all @@ -26,7 +26,7 @@ buf[0x34:0x38] = bytes([1, 0x04, 0, 0]) # slot b: active, not successful open(sys.argv[1], "wb").write(buf) PY cp "$tmp/devinfo" "$tmp/devinfo.orig" -"$tmp/build/omamobile-bootctl" dump "$tmp/devinfo" | grep -q 'version: 3.15' || fail "bootctl decodes devinfo" +"$tmp/build/omamobile-bootctl" dump "$tmp/devinfo" | grep -c 'version: 3.15' >/dev/null || fail "bootctl decodes devinfo" plan=$("$tmp/build/omamobile-bootctl" mark-successful "$tmp/devinfo" b 2>&1 || true) grep -q '0x35: 04 -> 06' <<<"$plan" || fail "mark-successful plans one byte (0x35: 04 -> 06)" cmp -s "$tmp/devinfo" "$tmp/devinfo.orig" || fail "a dry run writes nothing" @@ -134,7 +134,7 @@ pass "the modem's drivers never load at boot" # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network -! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -q '^Gateway=' || fail "usb0 sets no default route in [Network] (metric 0)" +! sed -n '/^\[Network\]/,/^\[/p' "$net" | grep -c '^Gateway=' >/dev/null || fail "usb0 sets no default route in [Network] (metric 0)" metric=$(sed -n '/^\[Route\]/,/^\[/{s/^Metric=//p}' "$net") [[ ${metric:-0} -gt 700 ]] || fail "usb0's gateway goes after Wi-Fi (600) and mobile data (700)" pass "USB is the last gateway" diff --git a/packages/omamobile-fingerprint/test/all b/packages/omamobile-fingerprint/test/all index ce21394c9..dcc692637 100755 --- a/packages/omamobile-fingerprint/test/all +++ b/packages/omamobile-fingerprint/test/all @@ -106,7 +106,7 @@ grep -c 'ln -sfn ../omamobile-fp.service "$d/usr/lib/systemd/system/multi-user.t # a die in the namespace still stops in order, and the marker is taken # atomically st=$(sed -n '/^start() {/,/^}/p' lib/omamobile-fp-chroot) -grep -A1 '^ say "stage \$stage running"$' <<<"$st" | grep -qx ' rm -f "\$PENDING"' || +grep -A1 '^ say "stage \$stage running"$' <<<"$st" | grep -cx ' rm -f "\$PENDING"' >/dev/null || fail "start clears start-pending right after the stack runs" grep -qx " trap 'stop \$?' EXIT" <<<"$st" || fail "the namespace's EXIT trap keeps the stop order on a die" grep -c 'set -o noclobber; umask 077; echo .* > "\$MARKER"' lib/omamobile-fp-chroot >/dev/null || diff --git a/packages/omamobile-gnss/test/all b/packages/omamobile-gnss/test/all index 0aaa8223d..c6093a1bd 100755 --- a/packages/omamobile-gnss/test/all +++ b/packages/omamobile-gnss/test/all @@ -184,7 +184,7 @@ if [[ -n $image ]]; then grep -q 'SuplEnable="false"' "$x" || fail "default gps.xml must have SUPL off" grep -q 'RtoEnable="true"' "$x" || fail "default gps.xml must keep RTO" for k in EnableGlonass EnableGalileo EnableBeidou; do - sed -n '//p' "$x" | grep -q "$k=\"true\"" || fail "$k not in " + sed -n '//p' "$x" | grep -c "$k=\"true\"" >/dev/null || fail "$k not in " done grep -q 'MultiCarrRFMode="GL_MULTI_CARR_RF_MODE_L1_L5"' "$x" || fail "stock L1+L5 mode changed" if command -v xmllint >/dev/null; then xmllint --noout "$x" || fail "gps.xml not well-formed"; fi diff --git a/packages/omamobile-mirror/test/all b/packages/omamobile-mirror/test/all index abb565d6d..8fb4fa545 100755 --- a/packages/omamobile-mirror/test/all +++ b/packages/omamobile-mirror/test/all @@ -158,13 +158,13 @@ grep -q '^user: *alice' "$t/out" || fail "session user" OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" on > "$t/out" || fail "second on" [[ $(grep -c 'start omamobile-mirror.service' "$log") == 1 ]] || fail "second on started wayvnc again" grep -q 'already on' "$t/out" || fail "second on message" -OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" status --json | grep -q '"running":true,"address":"172.16.42.1","port":5900' || fail "json" +OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" status --json | grep -c '"running":true,"address":"172.16.42.1","port":5900' >/dev/null || fail "json" : > "$t/ufw-rule" OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" off >/dev/null || fail "off" [[ ! -e $t/state/omamobile-mirror.service && ! -e $t/state/omamobile-mirror-firewall.service ]] || fail "off left units" [[ ! -e $t/ufw-rule ]] || fail "off left the ufw rule" OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" off >/dev/null || fail "second off" -OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" status | grep -q '^mirroring: no' || fail "status after off" +OMAMOBILE_MIRROR_ASSUME_ROOT=0 "$mir" status | grep -c '^mirroring: no' >/dev/null || fail "status after off" # on as the user; a failed start closes the firewall again : > "$log" diff --git a/packages/omamobile-modem/test/all b/packages/omamobile-modem/test/all index 70f5ae26d..1676089a0 100755 --- a/packages/omamobile-modem/test/all +++ b/packages/omamobile-modem/test/all @@ -309,7 +309,7 @@ pass "refusals: unprovisioned, the latch, a stale modem-up marker once then held u=$stage/usr/lib/systemd/system for f in omamobile-modem-inhibit.service omamobile-modem-boot.target; do [[ -e $u/$f ]] || fail "staged $f"; done grep -qx 'Requires=omamobile-modem-inhibit.service' systemd/omamobile-modem.service || fail "the modem unit requires the inhibitor" -grep -E '^After=' systemd/omamobile-modem.service | grep -q 'omamobile-modem-inhibit.service' || fail "the modem unit starts after the inhibitor" +grep -E '^After=' systemd/omamobile-modem.service | grep -c 'omamobile-modem-inhibit.service' >/dev/null || fail "the modem unit starts after the inhibitor" grep -qx 'Type=notify' systemd/omamobile-modem.service && grep -qx 'NotifyAccess=all' systemd/omamobile-modem.service || fail "the modem unit is Type=notify (READY from the start script)" grep -qx 'ExecStopPost=/usr/lib/omamobile-vendor/omamobile-modem-start --stopped' systemd/omamobile-modem.service || fail "the stop hook" diff --git a/packages/omamobile-remote/test/all b/packages/omamobile-remote/test/all index d72dcf758..be1f849f4 100755 --- a/packages/omamobile-remote/test/all +++ b/packages/omamobile-remote/test/all @@ -100,7 +100,7 @@ check "osk box prints the layer rectangle" bash -c '[[ $(omamobile-remote osk bo check "locked exits 0 when locked" $R locked touch "$FAKE_STATE/shell-broken" check "locked exits 2 (not 1) when the lock state cannot be read" bash -c 'omamobile-remote locked >/dev/null 2>&1; [[ $? == 2 ]]' -check "unlock does not claim success when the lock state cannot be read" bash -c 'OMAMOBILE_PIN=4321 omamobile-remote unlock 2>&1 | grep -q "cannot read the lock state" && ! OMAMOBILE_PIN=4321 omamobile-remote unlock >/dev/null 2>&1' +check "unlock does not claim success when the lock state cannot be read" bash -c 'OMAMOBILE_PIN=4321 omamobile-remote unlock 2>&1 | grep -c "cannot read the lock state" >/dev/null && ! OMAMOBILE_PIN=4321 omamobile-remote unlock >/dev/null 2>&1' rm -f "$FAKE_STATE/shell-broken" check "OMARCHY_PATH falls back to /usr/share/omarchy when no shell is found" bash -c 'unset OMARCHY_PATH; omamobile-remote locked' mkdir -p "$tmp/proc/4242" @@ -126,8 +126,8 @@ rm -f "$FAKE_STATE/unlock-on-wake"; echo 1 > "$FAKE_STATE/dpms" check "unlock stops before the first Return when the phone got unlocked while waking" bash -c "[[ $rc == 0 ]] && grep -q 'before the first Return' <<<'$out' && ! grep -q 'wtype -k Return' '$FAKE_LOG'" check "locked exits 1 when unlocked" bash -c '! omamobile-remote locked' check "the PIN is in no log, no journal line and no argument" bash -c '! grep -q "$FAKE_PIN" "$FAKE_LOG" "$FAKE_JOURNAL"' -check "run does not pass the PIN on to what it starts" bash -c 'OMAMOBILE_PIN=$FAKE_PIN omamobile-remote run sh -c "echo [\${OMAMOBILE_PIN-unset}]" | grep -q "^\[unset\]$"' -check "keep-awake does not pass the PIN on to its command" bash -c 'OMAMOBILE_PIN=$FAKE_PIN omamobile-remote keep-awake sh -c "echo [\${OMAMOBILE_PIN-unset}]" | grep -q "^\[unset\]$"' +check "run does not pass the PIN on to what it starts" bash -c 'OMAMOBILE_PIN=$FAKE_PIN omamobile-remote run sh -c "echo [\${OMAMOBILE_PIN-unset}]" | grep -c "^\[unset\]$" >/dev/null' +check "keep-awake does not pass the PIN on to its command" bash -c 'OMAMOBILE_PIN=$FAKE_PIN omamobile-remote keep-awake sh -c "echo [\${OMAMOBILE_PIN-unset}]" | grep -c "^\[unset\]$" >/dev/null' rm -f "$tmp/launched-env"; OMAMOBILE_PIN=97531 $R launch sh -c "env > '$tmp/launched-env'" >/dev/null; sleep 0.5 check "launch does not pass the PIN on to the app" bash -c '[[ -s "$0" ]] && ! grep -q "OMAMOBILE_PIN\|97531" "$0"' "$tmp/launched-env" check "only command names reach the journal" bash -c '! grep -qE "echo hi|100|0000" "$FAKE_JOURNAL"' diff --git a/tests/all b/tests/all index fa3efaac9..bd3c7143c 100755 --- a/tests/all +++ b/tests/all @@ -6,7 +6,8 @@ # against a stand-in phone tree, # tools/phone-install-package against a stand-in phone, the initramfs's # first-boot growth, the bring-up overlays, the simplefb trigger, the init's per-board steps, the storage guard's packed -# allowlist and the USB product string, bin/omamobile's boot-image layouts +# allowlist and the USB product string, no test script piping into grep -q, +# bin/omamobile's boot-image layouts # (and omamobile-boot-update building the same bytes on the phone) # and flash against a fake fastboot, omamobile-firstboot's own tests, and the # smoke test of the newest root image in out/ if there is one, the felix, @@ -42,7 +43,7 @@ sh -n device/flame/initramfs/build bash -n tools/build-flame-probe echo "ok - scripts parse" python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch; do echo "# $t" "$t" done diff --git a/tests/grep-q-pipes b/tests/grep-q-pipes new file mode 100755 index 000000000..2f8dbd21b --- /dev/null +++ b/tests/grep-q-pipes @@ -0,0 +1,29 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# No test script that sets pipefail pipes into grep -q (AGENTS.md section 4, +# Userspace): grep -q exits at the first match, the writer can get SIGPIPE, +# and pipefail then fails the pipeline, so a check fails at random, or an +# "&& fail" check passes. Use grep -c ... >/dev/null, which reads all its +# input. packages/omamobile-modem/test/nv-overlay is left out until the fix +# for #457 lands. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; } +pass() { printf 'ok - %s\n' "$1"; } +pattern='(^|[^|])\|[[:space:]]*grep[[:space:]]+(-[[:alnum:]]*q|--quiet|--silent)' + +for bad in 'x | grep -q y' 'x |grep -qx y' 'x | grep -Eq y' 'x | grep --quiet y'; do + grep -cE "$pattern" <<<"$bad" >/dev/null || fail "the pattern finds '$bad'" +done +for good in 'x | grep -c y >/dev/null' 'x || grep -q y f' 'grep -q y <<<"$x"'; do + grep -cE "$pattern" <<<"$good" >/dev/null && fail "the pattern leaves '$good' alone" +done + +mapfile -t scripts < <(git grep -l 'set -[a-z]*o pipefail' -- tests 'packages/*/test' \ + ':(exclude)tests/grep-q-pipes' ':(exclude)packages/omamobile-modem/test/nv-overlay') +[[ ${#scripts[@]} -gt 0 ]] || fail "found the pipefail test scripts" +if hits=$(git grep -nE "$pattern" -- "${scripts[@]}"); then + printf '%s\n' "$hits" >&2 + fail "no test script under pipefail pipes into grep -q (use grep -c ... >/dev/null)" +fi +pass "no pipe into grep -q in ${#scripts[@]} pipefail test scripts" diff --git a/tests/initramfs-reproducible b/tests/initramfs-reproducible index d40843b72..0ee6a5e9d 100755 --- a/tests/initramfs-reproducible +++ b/tests/initramfs-reproducible @@ -40,8 +40,8 @@ list=$(lz4 -dc "$t/a.lz4" | cpio -itv --quiet) listing() { lz4 -dc "$1" | cpio -itv --quiet | awk '{ n = ""; for (i = 9; i <= NF; i++) n = n " " $i; print $1, $3, $4, $5, n }' | LC_ALL=C sort; } (cd "$t/b" && find . | cpio -o -H newc --owner=0:0 --quiet) | lz4 -l -9 -q > "$t/old.lz4" diff <(listing "$t/old.lz4") <(listing "$t/a.lz4") || fail "the cpio -itv listing (modes, owners, sizes, names) matches the old packing's" -listing "$t/a.lz4" | grep -qE '^drwxr-xr-x root root [0-9]+ \.$' || fail "the root entry is a 0755 directory owned by root" -awk '{print $3, $4}' <<<"$list" | sort -u | grep -qvx 'root root' && fail "every entry owned by 0:0" +listing "$t/a.lz4" | grep -cE '^drwxr-xr-x root root [0-9]+ \.$' >/dev/null || fail "the root entry is a 0755 directory owned by root" +awk '{print $3, $4}' <<<"$list" | sort -u | grep -cvx 'root root' >/dev/null && fail "every entry owned by 0:0" grep -qF 'initramfs_pack "$stage" "$KERNEL_OUT/initramfs.cpio.lz4"' bin/omamobile || fail "bin/omamobile initramfs packs with initramfs_pack" grep -qF 'umask 022' bin/omamobile || fail "bin/omamobile initramfs stages under umask 022" echo "ok - the initramfs packs reproducibly (sorted names, owner 0:0, fixed mtimes, no inode numbers), with the same entries and modes as before, / at 0755" diff --git a/tests/install-phone b/tests/install-phone index 78a3c1e26..77a7908be 100755 --- a/tests/install-phone +++ b/tests/install-phone @@ -136,8 +136,8 @@ grep -qx 'CREDENTIAL=pin' <<<"$conf" || fail "a numeric password is a PIN" grep -qx 'HOSTNAME=alice-phone' <<<"$conf" || fail "the default host name is -phone" grep -qx 'WIFI_SSID=Home Net' <<<"$conf" && grep -qx 'WIFI_PSK=correct horse' <<<"$conf" || fail "the Wi-Fi network" grep -qxF "SSH_KEY=$(cat "$t/home/.ssh/id_ed25519.pub")" <<<"$conf" || fail "the SSH key" -debugfs -R 'stat /etc/omamobile/firstboot.conf' "$flashed" 2>/dev/null | grep -q 'Mode: 0600' || fail "firstboot.conf is root-only" -debugfs -R 'stat /etc/omamobile/firstboot.conf' "$flashed" 2>/dev/null | grep -q 'User: 0 Group: 0' || fail "firstboot.conf belongs to root" +debugfs -R 'stat /etc/omamobile/firstboot.conf' "$flashed" 2>/dev/null | grep -c 'Mode: 0600' >/dev/null || fail "firstboot.conf is root-only" +debugfs -R 'stat /etc/omamobile/firstboot.conf' "$flashed" 2>/dev/null | grep -c 'User: 0 Group: 0' >/dev/null || fail "firstboot.conf belongs to root" [[ $(debugfs -R 'cat /root/.ssh/authorized_keys' "$flashed" 2>/dev/null) == "$(cat "$t/home/.ssh/id_ed25519.pub")" ]] || fail "root's authorized_keys" mkdir -p "$t/fbroot/usr/share/zoneinfo" "$t/fbroot/etc" : > "$t/fbroot/usr/share/zoneinfo/UTC" @@ -147,7 +147,7 @@ OMAMOBILE_FIRSTBOOT_ROOT=$t/fbroot "$SRC/packages/omamobile-firstboot/bin/omamob fail "omamobile-firstboot accepts what install-phone writes" [[ $(debugfs -R 'cat /etc/omamobile/boot-update.conf' "$flashed" 2>/dev/null | grep -v '^#') == AUTO_WRITE=yes ]] \ || fail "a release install turns the boot hook on (boot-update.conf AUTO_WRITE=yes)" -debugfs -R 'stat /etc/omamobile/boot-update.conf' "$flashed" 2>/dev/null | grep -q 'User: 0 Group: 0' || fail "boot-update.conf belongs to root" +debugfs -R 'stat /etc/omamobile/boot-update.conf' "$flashed" 2>/dev/null | grep -c 'User: 0 Group: 0' >/dev/null || fail "boot-update.conf belongs to root" pass "the image copy gets a root-only firstboot.conf (hash, not password) and root's key, which firstboot accepts" refuse() { diff --git a/tests/rootfs-smoke b/tests/rootfs-smoke index 2a5a27173..09bdae648 100755 --- a/tests/rootfs-smoke +++ b/tests/rootfs-smoke @@ -26,7 +26,7 @@ if [[ $img == *.zst ]]; then fi d() { debugfs -R "$1" "$img" 2>/dev/null; } cat_() { d "cat $1"; } -exists() { d "stat $1" | grep -q '^Inode:'; } +exists() { d "stat $1" | grep -c '^Inode:' >/dev/null; } [[ $(dumpe2fs -h "$img" 2>/dev/null | sed -n 's/^Filesystem volume name: *//p') == omamobile-root ]] || fail "label omamobile-root" pass "ext4, label omamobile-root" @@ -34,7 +34,7 @@ pass "ext4, label omamobile-root" passwd=$(cat_ /etc/passwd) grep -q '^root:' <<<"$passwd" || fail "/etc/passwd readable" grep -q '^alarm:' <<<"$passwd" && fail "no alarm account" -awk -F: '$3 >= 1000 && $3 != 65534' <<<"$passwd" | grep -q . && fail "no user account" +awk -F: '$3 >= 1000 && $3 != 65534' <<<"$passwd" | grep -c . >/dev/null && fail "no user account" [[ $(cat_ /etc/shadow | awk -F: '$1 == "root" {print substr($2, 1, 1)}') == '!' ]] || fail "root is locked" pass "no account but root, and root is locked" @@ -66,8 +66,8 @@ exists /usr/bin/omamobile-firstboot || fail "omamobile-firstboot installed" exists /usr/lib/systemd/system/multi-user.target.wants/omamobile-firstboot.service || fail "the first-boot unit is enabled" exists /etc/omamobile/firstboot.conf && fail "no firstboot.conf in the image (the installer writes it)" for unit in sshd NetworkManager systemd-networkd sddm; do - d "ls -l /etc/systemd/system/multi-user.target.wants" | grep -q "$unit.service" || - d "ls -l /etc/systemd/system" | grep -q "display-manager.service" || fail "$unit enabled" + d "ls -l /etc/systemd/system/multi-user.target.wants" | grep -c "$unit.service" >/dev/null || + d "ls -l /etc/systemd/system" | grep -c "display-manager.service" >/dev/null || fail "$unit enabled" done pass "first boot unit, sshd, NetworkManager, networkd and SDDM enabled" @@ -127,16 +127,16 @@ fi # MODEM-PLAN M4.6's step (each boot powers the modem, each reboot costs one # recovered UFS error-handler pass), never the image's. for unit in omamobile-modem omamobile-sitd omamobile-sit-data omamobile-mmd; do - d "ls -l /etc/systemd/system/multi-user.target.wants" | grep -q "$unit\.service" && fail "$unit is not enabled in the image" - d "ls -l /etc/systemd/system/omamobile-sitd.service.wants" | grep -q "$unit\.service" && fail "$unit is not enabled in the image" + d "ls -l /etc/systemd/system/multi-user.target.wants" | grep -c "$unit\.service" >/dev/null && fail "$unit is not enabled in the image" + d "ls -l /etc/systemd/system/omamobile-sitd.service.wants" | grep -c "$unit\.service" >/dev/null && fail "$unit is not enabled in the image" done pass "no modem unit enabled at boot" exists /etc/pacman.d/gnupg && fail "no pacman keyring (it holds a private key)" -d "ls /etc/ssh" | grep -q ssh_host_ && fail "no SSH host keys" +d "ls /etc/ssh" | grep -c ssh_host_ >/dev/null && fail "no SSH host keys" [[ $(cat_ /etc/machine-id) == uninitialized ]] || fail "machine id uninitialized" exists /root/.ssh && fail "no root SSH keys" -d "ls -p /etc/NetworkManager/system-connections" | grep -q 'nmconnection' && fail "no Wi-Fi connections" +d "ls -p /etc/NetworkManager/system-connections" | grep -c 'nmconnection' >/dev/null && fail "no Wi-Fi connections" pass "no per-machine state: keyring, host keys, machine id, SSH keys, Wi-Fi" for p in /usr/lib/firmware/updates /usr/lib/omamobile-fp/root /usr/lib/omamobile-vendor/gnss/root \ From b5207b86e17592b1bb2ba118871dcb098286cc17 Mon Sep 17 00:00:00 2001 From: angelrenefm <17342133+angelrenefm@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:47:01 +0100 Subject: [PATCH 46/66] omamobile-shell: the touch tests find qmltestrunner in /usr/lib64/qt6 too (#572) Without it test/all skipped every touch test on the PC and two went stale unseen: home-gestures still used the old 0.25 drawer threshold (now 0.4, Launcher3's) and switcher-touch didn't copy FrameMeter.qml. --- packages/omamobile-shell/test/drawer-touch | 2 +- packages/omamobile-shell/test/home-gestures | 2 +- packages/omamobile-shell/test/home-mouse | 2 +- packages/omamobile-shell/test/media-touch | 2 +- packages/omamobile-shell/test/owl-idle | 2 +- packages/omamobile-shell/test/pill-touch | 2 +- packages/omamobile-shell/test/shade-touch | 2 +- packages/omamobile-shell/test/switcher-touch | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/omamobile-shell/test/drawer-touch b/packages/omamobile-shell/test/drawer-touch index 0251738df..a763b6b42 100755 --- a/packages/omamobile-shell/test/drawer-touch +++ b/packages/omamobile-shell/test/drawer-touch @@ -15,7 +15,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.launcher -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "drawer-touch: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/home-gestures b/packages/omamobile-shell/test/home-gestures index 334981bf8..4d8299406 100755 --- a/packages/omamobile-shell/test/home-gestures +++ b/packages/omamobile-shell/test/home-gestures @@ -13,7 +13,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugins=$here/../plugins -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "home-gestures: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/home-mouse b/packages/omamobile-shell/test/home-mouse index 8383da675..40b184f2d 100755 --- a/packages/omamobile-shell/test/home-mouse +++ b/packages/omamobile-shell/test/home-mouse @@ -11,7 +11,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.home -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "home-mouse: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/media-touch b/packages/omamobile-shell/test/media-touch index d273237f5..74d74f00e 100755 --- a/packages/omamobile-shell/test/media-touch +++ b/packages/omamobile-shell/test/media-touch @@ -9,7 +9,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.quicksettings -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "media-touch: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/owl-idle b/packages/omamobile-shell/test/owl-idle index 8e3b8049b..2e12f4164 100755 --- a/packages/omamobile-shell/test/owl-idle +++ b/packages/omamobile-shell/test/owl-idle @@ -11,7 +11,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.home -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "owl-idle: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/pill-touch b/packages/omamobile-shell/test/pill-touch index 28e13fe2e..cf6ab0185 100755 --- a/packages/omamobile-shell/test/pill-touch +++ b/packages/omamobile-shell/test/pill-touch @@ -15,7 +15,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.launcher -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "pill-touch: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/shade-touch b/packages/omamobile-shell/test/shade-touch index bb3c3f2b3..5ba0e5e9a 100755 --- a/packages/omamobile-shell/test/shade-touch +++ b/packages/omamobile-shell/test/shade-touch @@ -9,7 +9,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.quicksettings -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "shade-touch: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) diff --git a/packages/omamobile-shell/test/switcher-touch b/packages/omamobile-shell/test/switcher-touch index d3feeb4f3..ea4b24a38 100755 --- a/packages/omamobile-shell/test/switcher-touch +++ b/packages/omamobile-shell/test/switcher-touch @@ -9,7 +9,7 @@ set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) plugin=$here/../plugins/omamobile.switcher -runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v qmltestrunner || true) +runner=$(command -v qmltestrunner6 || command -v /usr/lib/qt6/bin/qmltestrunner || command -v /usr/lib64/qt6/bin/qmltestrunner || command -v qmltestrunner || true) [[ -n $runner ]] || { echo "switcher-touch: no qmltestrunner" >&2; exit 77; } work=$(mktemp -d) From 4484f17d6970da1b5343142f7e4adf1fc3d73df2 Mon Sep 17 00:00:00 2001 From: "Lefteris @SomniusX" Date: Mon, 9 Nov 2026 22:22:00 +0200 Subject: [PATCH 47/66] omamobile-device-husky 0.1.9, omamobile-audio 0.5.18: the 8 Pro's AoC start with a hang marker, its UCM2 and WirePlumber files (#453) The Pixel 8 Pro's AoC now starts from a packaged unit with a hang marker, as the 7 Pro's does, and its sound card comes up on its own at boot: device-husky ships the start script and unit (Trusty under soc@0, and gs201_aoc_boot blacklisted, which matches only google,gs201-aoc), and omamobile-audio ships the 8 Pro's UCM2 profile and WirePlumber rules. device-husky depends on omamobile-audio 0.5.18, the first with those files. Tested by the contributor on a Pixel 8 Pro: the old unit masked and the hand-copied files moved aside, the card came up by itself (94 services, EP6 and EP1 ids), and a sound check across two cold boots matches the old start within about 1 dB. --- packages/omamobile-audio/install | 3 + packages/omamobile-audio/test/all | 42 ++++++ .../ucm2/Google/husky/HiFi.conf | 108 ++++++++++++++++ .../google,husky-aoc-snd-card.conf | 13 ++ packages/omamobile-audio/version | 2 +- .../wireplumber/55-omamobile-husky-aoc.conf | 54 ++++++++ packages/omamobile-device-husky/PKGBUILD | 2 +- packages/omamobile-device-husky/README.md | 1 + .../bin/omamobile-husky-aoc-start | 120 ++++++++++++++++++ packages/omamobile-device-husky/install | 7 + packages/omamobile-device-husky/test/all | 75 ++++++++++- .../modprobe.d/omamobile-husky-aoc.conf | 25 ++++ .../system/omamobile-husky-aoc.service | 20 +++ packages/omamobile-device-husky/version | 2 +- 14 files changed, 468 insertions(+), 6 deletions(-) create mode 100644 packages/omamobile-audio/ucm2/Google/husky/HiFi.conf create mode 100644 packages/omamobile-audio/ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf create mode 100644 packages/omamobile-audio/wireplumber/55-omamobile-husky-aoc.conf create mode 100755 packages/omamobile-device-husky/bin/omamobile-husky-aoc-start create mode 100644 packages/omamobile-device-husky/vendor/modprobe.d/omamobile-husky-aoc.conf create mode 100644 packages/omamobile-device-husky/vendor/systemd/system/omamobile-husky-aoc.service diff --git a/packages/omamobile-audio/install b/packages/omamobile-audio/install index 05ea84638..7dc4ceb07 100755 --- a/packages/omamobile-audio/install +++ b/packages/omamobile-audio/install @@ -31,6 +31,9 @@ install -Dm644 ucm2/Google/raven/HiFi.conf "$d/usr/share/alsa/ucm2/Google/raven/ install -Dm644 wireplumber/51-omamobile-aoc.conf "$d/usr/share/wireplumber/wireplumber.conf.d/51-omamobile-aoc.conf" install -Dm644 wireplumber/52-omamobile-tegu-aoc.conf "$d/usr/share/wireplumber/wireplumber.conf.d/52-omamobile-tegu-aoc.conf" install -Dm644 wireplumber/53-omamobile-raven-aoc.conf "$d/usr/share/wireplumber/wireplumber.conf.d/53-omamobile-raven-aoc.conf" +install -Dm644 "ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf" "$d/usr/share/alsa/ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf" +install -Dm644 ucm2/Google/husky/HiFi.conf "$d/usr/share/alsa/ucm2/Google/husky/HiFi.conf" +install -Dm644 wireplumber/55-omamobile-husky-aoc.conf "$d/usr/share/wireplumber/wireplumber.conf.d/55-omamobile-husky-aoc.conf" install -Dm644 wireplumber/54-omamobile-no-voice-call-restore.conf "$d/usr/share/wireplumber/wireplumber.conf.d/54-omamobile-no-voice-call-restore.conf" install -Dm644 wireplumber/scripts/omamobile-no-voice-call-restore.lua "$d/usr/share/wireplumber/scripts/omamobile-no-voice-call-restore.lua" install -Dm644 pipewire/60-omamobile-speaker-loudness.conf "$d/usr/share/pipewire/pipewire.conf.d/60-omamobile-speaker-loudness.conf" diff --git a/packages/omamobile-audio/test/all b/packages/omamobile-audio/test/all index 31f1283f1..916949ee8 100755 --- a/packages/omamobile-audio/test/all +++ b/packages/omamobile-audio/test/all @@ -67,6 +67,19 @@ if command -v alsaucm >/dev/null && [[ -r /usr/share/alsa/ucm2/ucm.conf ]]; then [[ $(ucmr get PlaybackPCM/Speaker/HiFi) == *"hw:0,5" ]] || fail "UCM raven: Speaker PCM" [[ $(ucmr get CapturePCM/Mic/HiFi) == *"hw:0,8" ]] || fail "UCM raven: Mic PCM" pass "UCM profile parses: raven HiFi with Speaker and Mic" + # husky: speaker and earpiece on EP6, the microphone on EP1 capture + cp -r ucm2/Google/husky "$u/Google/" + cp "ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf" "$u/conf.virt.d/huskytest.conf" + sed -i -e 's/\${CardId}/0/g' -e 's/\${find-device:[^}]*playback[^}]*}/5/' \ + -e 's/\${find-device:[^}]*capture[^}]*}/8/' "$u/Google/husky/HiFi.conf" + ucmh() { ALSA_CONFIG_UCM2=$u alsaucm -c huskytest "$@" 2>&1; } + [[ $(ucmh list _verbs) == *"0: HiFi"* ]] || fail "UCM husky: the HiFi verb" + out=$(ucmh list _devices/HiFi) + [[ $out == *"0: Speaker"* && $out == *"1: Earpiece"* && $out == *"2: Mic"* ]] || fail "UCM husky: Speaker, Earpiece and Mic devices" + [[ $(ucmh get CapturePCM/Mic/HiFi) == *"hw:0,8" ]] || fail "UCM husky: Mic PCM is EP1 capture (device 8)" + grep -q "BUILDIN MIC ID CAPTURE LIST' 0,-1,-1,-1" ucm2/Google/husky/HiFi.conf || fail "husky records mic id 0 only until the others are mapped" + [[ $(ucmh get PlaybackPCM/Speaker/HiFi) == *"hw:0,5" ]] || fail "UCM husky: Speaker PCM is EP6 (device 5)" + pass "UCM profile parses: husky HiFi with Speaker and Earpiece on EP6" fi grep -c "find-device:type=pcm,stream=playback,field=id,regex='^EP6 playback'" ucm2/Google/cheetah/HiFi.conf >/dev/null || fail "UCM: the Speaker PCM is found by its id" @@ -79,6 +92,35 @@ tegu_card=$(sed -n 's/.*api.alsa.card.name = "\([^"]*\)".*/\1/p' wireplumber/52- [[ -f "ucm2/conf.d/aoc-snd-card/$tegu_card.conf" ]] || fail "tegu long-name UCM file is named exactly $tegu_card.conf" grep -c "channelmix.max-volume = 0.562" wireplumber/52-omamobile-tegu-aoc.conf >/dev/null || fail "the 9a's speaker sink is capped (channelmix.max-volume)" grep -c "CAPTURE LIST' 0,1,-1,-1" ucm2/Google/tegu/HiFi.conf >/dev/null || fail "tegu HiFi must set its own mic list (cheetah's 0,3,2 kills the AoC)" +husky_card=$(sed -n 's/.*api.alsa.card.name = "\([^"]*\)".*/\1/p' wireplumber/55-omamobile-husky-aoc.conf | head -1) +[[ $husky_card == google,husky-aoc-snd-card ]] || fail "55-omamobile-husky-aoc.conf matches husky's card name" +[[ -f "ucm2/conf.d/aoc-snd-card/$husky_card.conf" ]] || fail "husky long-name UCM file is named exactly $husky_card.conf" +! grep -q "husky" ucm2/conf.d/aoc-snd-card/aoc-snd-card.conf || fail "cheetah's shared profile has no husky branch" +! grep -qE "TDM_0_RX Mixer EP1|EP1 playback|Mixer EP1' 1" ucm2/Google/husky/HiFi.conf || fail "husky never binds EP1 playback (it hangs the AoC; EP1 capture is the microphone)" +# the volume ceilings, compared as numbers (a regex let 738 and 739 through) +husky_over() { # husky_over FILE Digital|Analog LIMIT: 0 if any cset is above LIMIT + local v + while read -r v; do ((v > $3)) && return 0; done \ + < <(sed -n "s/.*cset .*$2 PCM Volume' \([0-9][0-9]*\)\".*/\1/p" "$1") + return 1 +} +ceil=$(mktemp); trap 'rm -f "$ceil"' EXIT +for v in 738 739 9999; do + echo "cset \"name='Top Digital PCM Volume' $v\"" > "$ceil" + husky_over "$ceil" Digital 737 || fail "the ceiling check catches digital $v" +done +for v in 737 10; do + echo "cset \"name='Top Digital PCM Volume' $v\"" > "$ceil" + ! husky_over "$ceil" Digital 737 || fail "the ceiling check passes digital $v" +done +for v in 11 12; do + echo "cset \"name='Top Analog PCM Volume' $v\"" > "$ceil" + husky_over "$ceil" Analog 10 || fail "the ceiling check catches analog $v" +done +echo "cset \"name='Top Analog PCM Volume' 10\"" > "$ceil" +! husky_over "$ceil" Analog 10 || fail "the ceiling check passes analog 10" +! husky_over ucm2/Google/husky/HiFi.conf Analog 10 || fail "husky's analog volume stays at 10 or below" +! husky_over ucm2/Google/husky/HiFi.conf Digital 737 || fail "husky's digital volume stays at 737 or below" raven_card=$(sed -n 's/.*api.alsa.card.name = "\([^"]*\)".*/\1/p' wireplumber/53-omamobile-raven-aoc.conf | head -1) [[ $raven_card == google,raven-aoc-snd-card ]] || fail "53-omamobile-raven-aoc.conf matches raven's card name" [[ -f "ucm2/conf.d/aoc-snd-card/$raven_card.conf" ]] || fail "raven long-name UCM file is named exactly $raven_card.conf" diff --git a/packages/omamobile-audio/ucm2/Google/husky/HiFi.conf b/packages/omamobile-audio/ucm2/Google/husky/HiFi.conf new file mode 100644 index 000000000..81ddbca08 --- /dev/null +++ b/packages/omamobile-audio/ucm2/Google/husky/HiFi.conf @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: MIT +# Pixel 8 Pro: speaker (both amps, stereo) and earpiece (top amp) through the +# deep-buffer path EP6, and the bottom microphone (AoC mic id 0) on EP1 +# capture. Never use EP1 for output (UltraLL): it hangs the AoC firmware. +# The amplifiers run the protection firmware the phone's own vendor image +# provides (not part of this package). Levels stay at the Pixel 7 Pro's +# "media" stage or below (digital <= 737, analog <= 10) until the 8 Pro has +# verified ceilings of its own; never the 7 Pro's louder stage. +SectionVerb { + EnableSequence [ + cset "name='Top Digital PCM Volume' 1" + cset "name='Top Analog PCM Volume' 0" + cset "name='Bottom Digital PCM Volume' 1" + cset "name='Bottom Analog PCM Volume' 0" + cset "name='Top PCM Source' DSP" + cset "name='Top DSP1 Firmware' Protection" + cset "name='Top DSP RX1 Source' ASPRX1" + cset "name='Top DSP RX2 Source' ASPRX1" + cset "name='Top ASP TX1 Source' VMON" + cset "name='Top ASP TX2 Source' IMON" + cset "name='Top DSP1 Preload Switch' on" + cset "name='Bottom PCM Source' DSP" + cset "name='Bottom DSP1 Firmware' Protection" + cset "name='Bottom DSP RX1 Source' ASPRX1" + cset "name='Bottom DSP RX2 Source' ASPRX1" + cset "name='Bottom ASP TX1 Source' VMON" + cset "name='Bottom ASP TX2 Source' IMON" + cset "name='Bottom DSP1 Preload Switch' on" + cset "name='TDM_0_RX Chan' Four" + cset "name='TDM_0_RX Format' S32_LE" + cset "name='TDM_0_RX Sample Rate' SR_48K" + cset "name='TDM_0_RX Mixer EP6' 1" + # recording: the bottom microphone (AoC mic id 0, the one that records speech; ids 1 and 2 power up + # too but which hole they are is not settled), the DC blocker and the stock record gain + cset "name='TDM_0_TX Chan' Four" + cset "name='TDM_0_TX Format' S32_LE" + cset "name='TDM_0_TX Sample Rate' SR_48K" + cset "name='BUILDIN MIC ID CAPTURE LIST' 0,-1,-1,-1" + cset "name='MIC DC Blocker' 1" + cset "name='MIC Record Soft Gain (dB)' 22" + cset "name='EP1 TX Mixer INTERNAL_MIC_TX' 1" + ] + DisableSequence [ + cset "name='EP1 TX Mixer INTERNAL_MIC_TX' 0" + + cset "name='Top Digital PCM Volume' 1" + cset "name='Bottom Digital PCM Volume' 1" + cset "name='TDM_0_RX Mixer EP6' 0" + ] + Value { + TQ "HiFi" + } +} + +SectionDevice."Speaker" { + Comment "Stereo speakers: the earpiece speaker (Top amp) is the left channel, the bottom speaker (Bottom amp) the right" + ConflictingDevice [ "Earpiece" ] + EnableSequence [ + # the 7 Pro's "media" stage: digital <= 737, analog <= 10 + cset "name='Bottom Digital PCM Volume' 737" + cset "name='Bottom Analog PCM Volume' 10" + # the Top amp takes TDM slot 0 (left), the Bottom amp slot 1 (right); both at or below the media stage + cset "name='Top Digital PCM Volume' 737" + cset "name='Top Analog PCM Volume' 8" + ] + DisableSequence [ + cset "name='Bottom Digital PCM Volume' 1" + cset "name='Bottom Analog PCM Volume' 0" + cset "name='Top Digital PCM Volume' 1" + cset "name='Top Analog PCM Volume' 0" + ] + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},${find-device:type=pcm,stream=playback,field=id,regex='^EP6 playback'}" + PlaybackChannels 2 + PlaybackRate 48000 + } +} + +SectionDevice."Earpiece" { + Comment "Earpiece (Top amp)" + ConflictingDevice [ "Speaker" ] + EnableSequence [ + cset "name='Top Digital PCM Volume' 657" + cset "name='Top Analog PCM Volume' 0" + ] + DisableSequence [ + cset "name='Top Digital PCM Volume' 1" + cset "name='Top Analog PCM Volume' 0" + ] + Value { + PlaybackPriority 50 + PlaybackPCM "hw:${CardId},${find-device:type=pcm,stream=playback,field=id,regex='^EP6 playback'}" + PlaybackChannels 2 + PlaybackRate 48000 + } +} + +SectionDevice."Mic" { + Comment "Microphone (bottom, AoC mic id 0)" + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},${find-device:type=pcm,stream=capture,field=id,regex='^EP1 capture'}" + CaptureChannels 1 + CaptureRate 48000 + } +} diff --git a/packages/omamobile-audio/ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf b/packages/omamobile-audio/ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf new file mode 100644 index 000000000..281aa2ffa --- /dev/null +++ b/packages/omamobile-audio/ucm2/conf.d/aoc-snd-card/google,husky-aoc-snd-card.conf @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: MIT +# Pixel 8 Pro (husky, zuma): the AoC sound card (card driver name +# "aoc-snd-card", card name "google,husky-aoc-snd-card"; alsa-ucm-conf tries +# conf.d//.conf before conf.d//.conf, so +# this file wins over cheetah's aoc-snd-card.conf). Speaker (both amps, +# stereo) and earpiece (top amp) on the deep-buffer path EP6, plus the bottom +# microphone (AoC mic id 0) on EP1 capture. +Syntax 6 + +SectionUseCase."HiFi" { + File "/Google/husky/HiFi.conf" + Comment "Speaker, earpiece and microphone" +} diff --git a/packages/omamobile-audio/version b/packages/omamobile-audio/version index d8aef8135..b7a8bdf37 100644 --- a/packages/omamobile-audio/version +++ b/packages/omamobile-audio/version @@ -1 +1 @@ -0.5.17 +0.5.18 diff --git a/packages/omamobile-audio/wireplumber/55-omamobile-husky-aoc.conf b/packages/omamobile-audio/wireplumber/55-omamobile-husky-aoc.conf new file mode 100644 index 000000000..03d363e75 --- /dev/null +++ b/packages/omamobile-audio/wireplumber/55-omamobile-husky-aoc.conf @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: MIT +# The AoC sound card on the Pixel 8 Pro (card name "google,husky-aoc-snd-card", +# from the card's aoc-card-name): rules under husky's own card name, so a rule +# for one phone's speakers can't match another's. The deep-buffer playback +# path (EP6) takes only 16-bit integer data and drops what is written before +# the stream starts (the kernel's pointer fix handles the second part): no +# mmap, S16, small periods, and the stream never suspends on idle. No volume +# cap here: the speaker levels are set by the UCM profile's media stage. +monitor.alsa.rules = [ + { + matches = [ + { device.name = "~alsa_card.*", api.alsa.card.name = "google,husky-aoc-snd-card" } + ] + actions = { + update-props = { + device.description = "Built-in Audio" + device.form-factor = "internal" + api.alsa.soft-mixer = true + } + } + } + { + matches = [ + { node.name = "~alsa_output.*", api.alsa.card.name = "google,husky-aoc-snd-card" } + ] + actions = { + update-props = { + node.description = "Built-in Audio Speaker" + audio.format = "S16LE" + audio.rate = 48000 + audio.channels = 2 + api.alsa.disable-mmap = true + api.alsa.period-size = 960 + api.alsa.period-num = 8 + api.alsa.headroom = 6000 + node.pause-on-idle = false + session.suspend-timeout-seconds = 0 + } + } + } + { + matches = [ + { node.name = "~alsa_input.*", api.alsa.card.name = "google,husky-aoc-snd-card" } + ] + actions = { + update-props = { + node.description = "Built-in Audio Microphone" + api.alsa.disable-mmap = true + api.alsa.period-size = 960 + api.alsa.period-num = 4 + } + } + } +] diff --git a/packages/omamobile-device-husky/PKGBUILD b/packages/omamobile-device-husky/PKGBUILD index 42ac9d619..c6dfb1f7e 100644 --- a/packages/omamobile-device-husky/PKGBUILD +++ b/packages/omamobile-device-husky/PKGBUILD @@ -7,7 +7,7 @@ pkgdesc="Omarchy Mobile support for the Google Pixel 8 Pro (husky): storage guar arch=(aarch64) url="https://github.com/derekross/omarchy-mobile" license=(MIT) -depends=(bash systemd omamobile-keyring i2c-tools) +depends=(bash systemd omamobile-keyring i2c-tools 'omamobile-audio>=0.5.18') provides=(omamobile-device) conflicts=(omamobile-device) backup=(etc/pacman.d/omamobile-mirrorlist) diff --git a/packages/omamobile-device-husky/README.md b/packages/omamobile-device-husky/README.md index 40c7ed219..f962de265 100644 --- a/packages/omamobile-device-husky/README.md +++ b/packages/omamobile-device-husky/README.md @@ -12,6 +12,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 8 Pro (codename hu | `vendor/modprobe.d/omamobile-husky-display.conf` | `/usr/lib/modprobe.d` | Blacklists gs_decon's autoload, so the display start loads it after `allow_tx`: gs-decon decides on 120 Hz at probe. Sets `screen_off=2`, as cheetah and tegu do: on DPMS off DECON stops its frames and the panel goes to sleep, and DPMS on wakes it | | `vendor/modprobe.d/omamobile-husky-clk-acpm.conf` | `/usr/lib/modprobe.d` | Lets the GPU's ACPM clock move up to 890 MHz, stock's top (`zuma_gpu_max_khz`, kernel #157). The GPU thermal zone throttles it from 85 C. Without it the GPU stays at the bootloader's 150 MHz | | `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/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 | | `etc/omamobile-mirrorlist` | `/etc/pacman.d/omamobile-mirrorlist` | Where pacman finds the `[omamobile]` repository. Same file as the Pixel 7 Pro package | diff --git a/packages/omamobile-device-husky/bin/omamobile-husky-aoc-start b/packages/omamobile-device-husky/bin/omamobile-husky-aoc-start new file mode 100755 index 000000000..6628adfa2 --- /dev/null +++ b/packages/omamobile-device-husky/bin/omamobile-husky-aoc-start @@ -0,0 +1,120 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Start the AoC (audio DSP) and the speaker amplifiers on the Pixel 8 Pro +# (husky), hang-safe: the same shape as the Pixel 7 Pro's omamobile-aoc-start +# (device-cheetah), with husky's own module list and node. +# +# Order, as tested on the phone (device/husky/AOC-PLAN.md): +# 1. Trusty (trusty_core, trusty_log, trusty_ipc, then trusty_virtio). +# 2. The GSA mailbox (gsa), which authenticates the AoC image. +# 3. The AoC System MMU (gs201_aoc_sysmmu, which also drives zuma's v9 +# block until a zuma file of its own lands), the mailbox and the AoC core, +# with the firmware load off until everything is bound. +# 4. The service front ends and the sound card's driver, then the two +# CS35L41 amplifiers (the card waits for both). +# 5. The firmware load (aoc.bin from the firmware search path), then wait +# for the sound card. +# A marker is written and synced before any of it and removed at the end. If a +# boot hangs here, the next one finds the marker and leaves the AoC off; +# "omamobile-husky-aoc-start --retry" tries again. A second marker in /run +# (gone at reboot) is written just before the firmware write and never removed +# by a failure: the AoC starts once per boot, so a start after a failed one +# (systemctl start, a hand run, --retry) is refused until the next reboot. A kernel without the AoC +# node does nothing. The speaker levels are not set here: the UCM profile +# stays at the 7 Pro's "media" stage (digital 737, analog 10). +# omamobile-husky-aoc-start [--retry] +set -uo pipefail + +state=/var/lib/omamobile +marker=$state/aoc-bringup-started +# Set right before the firmware load, gone after a reboot (tmpfs) +loaded=${OMAMOBILE_AOC_LOADED:-/run/omamobile/aoc-firmware-loaded} +node=${OMAMOBILE_AOC_NODE:-/sys/bus/platform/devices/154b0000.aoc} +cards=${OMAMOBILE_ASOUND_CARDS:-/proc/asound/cards} +# The Trusty node sits at the device-tree root on some boards and under soc@0 on +# the 8 Pro (zuma): use the first status file that exists. +dt=${OMAMOBILE_DT_ROOT:-/proc/device-tree} +trusty_status=${OMAMOBILE_TRUSTY_STATUS:-} +if [[ -z $trusty_status ]]; then + for t in "$dt/trusty/status" "$dt/soc@0/trusty/status"; do + [[ -e $t ]] && trusty_status=$t && break + done +fi + +log() { echo "omamobile-husky-aoc: $*"; } + +for arg; do + case $arg in + --retry) rm -f "$marker" ;; + *) log "unknown argument $arg"; exit 2 ;; + esac +done + +if [[ -e $marker ]]; then + log "the last bring-up ($(cat "$marker" 2>/dev/null)) never finished; the AoC stays off this boot." + log "after checking the previous boot's log, retry with: omamobile-husky-aoc-start --retry" + exit 0 +fi +if [[ ! -e $node ]]; then + log "the AoC is not enabled in this kernel's device tree; nothing to do" + exit 0 +fi +# The AoC starts once per boot: a second firmware load would take the running +# one down. Its services file starts with "Services : N" only while the AoC is +# online (services_show in the driver prints nothing otherwise), the same test +# as the 7 Pro's start. The card being listed is a second sign, not the only one. +if grep -q '^Services : [1-9]' "$node/services" 2>/dev/null; then + log "already online: $(head -1 "$node/services")" + exit 0 +fi +if grep -q aoc-snd-card "$cards" 2>/dev/null; then + log "the sound card is already up" + exit 0 +fi +# A start that got as far as the firmware write but has no online AoC (for +# instance the card never appeared): do not write aoc.bin to it again. +if [[ -e $loaded ]]; then + log "the AoC was already started this boot but is not online; reboot to start it again" + exit 1 +fi +if ! grep -q okay "$trusty_status" 2>/dev/null; then + log "Trusty is not enabled in this device tree; the AoC cannot be started" + exit 1 +fi +fw= +for d in /usr/lib/firmware/updates /usr/lib/firmware; do + [[ -e $d/aoc.bin ]] && fw=$d/aoc.bin && break +done +if [[ -z $fw ]]; then + log "no aoc.bin (install it from the phone's own vendor partition: tools/extract-vendor-firmware)" + exit 1 +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; } +fail() { log "$*"; finish; exit 1; } + +load() { modprobe -i "$@" || fail "modprobe $* failed"; } + +modprobe snd-soc-core +modprobe snd-soc-wm-adsp +for m in trusty_core trusty_log trusty_ipc trusty_virtio; do load "$m"; done +for _ in $(seq 50); do [[ -c /dev/trusty-ipc-dev0 ]] && break; sleep 0.2; done +[[ -c /dev/trusty-ipc-dev0 ]] || fail "no /dev/trusty-ipc-dev0" +for m in gsa gs201_aoc_sysmmu mailbox_wc; do load "$m"; done +# the firmware load waits until the service front ends are bound +load aoc_core aoc_autoload_firmware=0 +for m in aoc_char_dev aoc_channel_dev aoc_alsa_dev_util \ + snd-soc-cs35l41-lib snd-soc-cs35l41 snd-soc-cs35l41-spi aoc_alsa_dev; do + load "$m" +done +[[ -e $node/firmware ]] || fail "no firmware node in $node" +mkdir -p "${loaded%/*}" && date -Is > "$loaded" +echo aoc.bin > "$node/firmware" || fail "the firmware load failed" +for _ in $(seq 40); do grep -q aoc-snd-card "$cards" 2>/dev/null && break; sleep 0.5; done +grep -q aoc-snd-card "$cards" 2>/dev/null || fail "the sound card did not appear" +log "the sound card is up" +finish diff --git a/packages/omamobile-device-husky/install b/packages/omamobile-device-husky/install index a7d75504d..96e245901 100755 --- a/packages/omamobile-device-husky/install +++ b/packages/omamobile-device-husky/install @@ -39,6 +39,13 @@ ln -sfn ../omamobile-usb-rescue.service \ "$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-usb-rescue.service" install -Dm644 vendor/systemd/system/plymouth-quit.service.d/10-omamobile-retain-splash.conf \ "$destination/usr/lib/systemd/system/plymouth-quit.service.d/10-omamobile-retain-splash.conf" +install -Dm755 bin/omamobile-husky-aoc-start "$destination/usr/bin/omamobile-husky-aoc-start" +install -Dm644 vendor/systemd/system/omamobile-husky-aoc.service \ + "$destination/usr/lib/systemd/system/omamobile-husky-aoc.service" +ln -sfn ../omamobile-husky-aoc.service \ + "$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-husky-aoc.service" +install -Dm644 vendor/modprobe.d/omamobile-husky-aoc.conf \ + "$destination/usr/lib/modprobe.d/omamobile-husky-aoc.conf" install -Dm644 device.conf \ "$destination/usr/share/omamobile/device.conf" install -Dm644 etc/omamobile-mirrorlist \ diff --git a/packages/omamobile-device-husky/test/all b/packages/omamobile-device-husky/test/all index ce4c7b1a0..e2178e524 100755 --- a/packages/omamobile-device-husky/test/all +++ b/packages/omamobile-device-husky/test/all @@ -106,12 +106,14 @@ grep -qx 'After=omamobile-husky-display.service' "$tmp/root/usr/lib/systemd/syst || fail "the display manager can start before the display driver" grep -qx 'ConditionPathExists=/sys/bus/platform/devices/19470000.display-controller' "$tmp/root/usr/lib/systemd/system/omamobile-husky-display.service" \ || fail "the display start runs (and fails) on a kernel without DECON0" -# modprobe.d only sets options, except the display file (gs_decon) and the +# modprobe.d only sets options, except the display file (gs_decon), the # MAX77759 file, which keeps the charger and the Type-C driver from loading -# before their bring-up steps (as on the Pixel 7 Pro): blacklist only, so a +# before their bring-up steps (as on the Pixel 7 Pro), and the AoC file, which +# leaves the AoC stack to the hang-safe start script: blacklist only, so a # manual modprobe still works. for conf in vendor/modprobe.d/*.conf; do - [[ $conf == vendor/modprobe.d/omamobile-max77759.conf || $conf == vendor/modprobe.d/omamobile-husky-display.conf ]] && continue + [[ $conf == vendor/modprobe.d/omamobile-max77759.conf || $conf == vendor/modprobe.d/omamobile-husky-display.conf || + $conf == vendor/modprobe.d/omamobile-husky-aoc.conf ]] && continue ! grep -qE '^(install|blacklist) ' "$conf" || fail "$conf only sets options" done conf=vendor/modprobe.d/omamobile-max77759.conf @@ -154,6 +156,73 @@ pass "install stages the udev rule, the USB link, the mirrorlist and the display || fail "husky has no lid: no lid drop-in" pass "no lid drop-in" + +# --- the AoC start: hang marker, nothing without the node ------------------ +bash -n bin/omamobile-husky-aoc-start || fail "the AoC start parses" +grep -q '^ExecStart=/usr/bin/omamobile-husky-aoc-start$' vendor/systemd/system/omamobile-husky-aoc.service \ + || fail "the AoC unit runs the script" +grep -q '^ConditionPathExists=/sys/bus/platform/devices/154b0000.aoc$' vendor/systemd/system/omamobile-husky-aoc.service \ + || fail "the AoC unit needs the AoC node" +[[ $(readlink "$tmp/root/usr/lib/systemd/system/multi-user.target.wants/omamobile-husky-aoc.service") == ../omamobile-husky-aoc.service ]] \ + || fail "the AoC unit is enabled by a vendor wants link" +! grep -qE '^install ' vendor/modprobe.d/omamobile-husky-aoc.conf || fail "the AoC file only blacklists" +! grep -hv '^ *#' bin/omamobile-husky-aoc-start vendor/modprobe.d/omamobile-husky-aoc.conf | grep -q 'speaker_protection' \ + || fail "the AoC start never raises the speaker ceiling" +for m in gsa aoc_core aoc_alsa_dev snd_soc_cs35l41_spi gs201_aoc_boot; do + grep -qx "blacklist $m" vendor/modprobe.d/omamobile-husky-aoc.conf || fail "$m is kept from autoloading" +done +pass "the AoC unit is installed, enabled by a wants link, and only the start script loads the AoC stack" +aoc=$tmp/aoc; mkdir -p "$aoc/bin" "$aoc/state" +printf '#!/bin/sh\necho "$*" >> %s/modprobe.log\n' "$aoc" > "$aoc/bin/modprobe" +printf '#!/bin/sh\nexit 0\n' > "$aoc/bin/sync" +chmod +x "$aoc/bin/modprobe" "$aoc/bin/sync" +# the script writes state to /var/lib/omamobile: run a copy with it pointed at the temp dir +sed "s|^state=/var/lib/omamobile|state=$aoc/state|; s|^loaded=.*|loaded=$aoc/run/aoc-firmware-loaded|" bin/omamobile-husky-aoc-start > "$aoc/start" +runaoc() { PATH=$aoc/bin:$PATH OMAMOBILE_AOC_NODE=$aoc/node OMAMOBILE_ASOUND_CARDS=$aoc/cards \ + OMAMOBILE_TRUSTY_STATUS=$aoc/trusty bash "$aoc/start" "$@" 2>&1; } +: > "$aoc/cards" +out=$(runaoc); rc=$? +[[ $rc -eq 0 && $out == *"nothing to do"* && ! -e $aoc/modprobe.log ]] || fail "without the AoC node nothing is loaded" +mkdir -p "$aoc/node"; echo okay > "$aoc/trusty" +date -Is > "$aoc/state/aoc-bringup-started" +out=$(runaoc); rc=$? +[[ $rc -eq 0 && $out == *"never finished"* && ! -e $aoc/modprobe.log ]] || fail "a marker left by a hung boot keeps the AoC off" +out=$(runaoc --retry) || true +[[ $out != *"never finished"* ]] || fail "--retry clears the marker" +[[ ! -e $aoc/state/aoc-bringup-started ]] || fail "a clean failure removes the marker (no firmware here)" +pass "the AoC start does nothing without the node, honours a hang marker, and --retry tries again" +# the Trusty node is found at the root and under soc@0 (the 8 Pro's layout) +rm -f "$aoc/trusty"; : > "$aoc/cards"; rm -rf "$aoc/dt" "$aoc/state/"* "$aoc/modprobe.log" +mkdir -p "$aoc/dt/soc@0/trusty"; echo okay > "$aoc/dt/soc@0/trusty/status" +out=$(PATH=$aoc/bin:$PATH OMAMOBILE_AOC_NODE=$aoc/node OMAMOBILE_ASOUND_CARDS=$aoc/cards OMAMOBILE_DT_ROOT=$aoc/dt bash "$aoc/start" 2>&1) || true +[[ $out != *"Trusty is not enabled"* ]] || fail "a Trusty node under soc@0 is found" +rm -rf "$aoc/dt"; mkdir -p "$aoc/dt/trusty"; echo okay > "$aoc/dt/trusty/status" +out=$(PATH=$aoc/bin:$PATH OMAMOBILE_AOC_NODE=$aoc/node OMAMOBILE_ASOUND_CARDS=$aoc/cards OMAMOBILE_DT_ROOT=$aoc/dt bash "$aoc/start" 2>&1) || true +[[ $out != *"Trusty is not enabled"* ]] || fail "a Trusty node at the root is found" +rm -rf "$aoc/dt"; mkdir -p "$aoc/dt" +out=$(PATH=$aoc/bin:$PATH OMAMOBILE_AOC_NODE=$aoc/node OMAMOBILE_ASOUND_CARDS=$aoc/cards OMAMOBILE_DT_ROOT=$aoc/dt bash "$aoc/start" 2>&1) || true +[[ $out == *"Trusty is not enabled"* ]] || fail "no Trusty node means the AoC stays off" +echo okay > "$aoc/trusty"; rm -rf "$aoc/state/"* "$aoc/modprobe.log" +pass "the Trusty node is found at the root or under soc@0, and its absence keeps the AoC off" +# the once-per-boot guards: nothing may reach the firmware file +rm -rf "$aoc/state/"* "$aoc/modprobe.log"; : > "$aoc/node/firmware" +mkdir -p "$aoc/run"; date -Is > "$aoc/run/aoc-firmware-loaded" +rc=0; out=$(runaoc) || rc=$? +[[ $rc -eq 1 && $out == *"already started this boot"* ]] || fail "a /run marker refuses a second start" +[[ ! -s $aoc/node/firmware && ! -e $aoc/modprobe.log && ! -e $aoc/state/aoc-bringup-started ]] \ + || fail "a second start in the same boot wrote to firmware or loaded modules" +rc=0; out=$(runaoc --retry) || rc=$? +[[ $rc -eq 1 && ! -s $aoc/node/firmware && ! -e $aoc/modprobe.log ]] || fail "--retry does not get past the /run marker" +rm -f "$aoc/run/aoc-firmware-loaded" +printf 'Services : 94\n0 : "control" mbox 0\n' > "$aoc/node/services" +out=$(runaoc); rc=$? +[[ $rc -eq 0 && $out == *"already online: Services : 94"* && ! -s $aoc/node/firmware && ! -e $aoc/modprobe.log ]] \ + || fail "an AoC that is already online is left alone" +printf 'Services : 0\n' > "$aoc/node/services" +out=$(runaoc) || true; [[ $out != *"already online"* ]] || fail "Services : 0 is not online" +rm -f "$aoc/node/services" +pass "a /run marker or an online AoC stops a second start before anything is loaded or written to firmware" + test/display-start || fail "test/display-start" pass "the display start loads gs_decon after allowing DSI commands for google-hk3 only" diff --git a/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-husky-aoc.conf b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-husky-aoc.conf new file mode 100644 index 000000000..350c3d0c9 --- /dev/null +++ b/packages/omamobile-device-husky/vendor/modprobe.d/omamobile-husky-aoc.conf @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: MIT +# The AoC stack (device/husky/AOC-PLAN.md): only omamobile-husky-aoc-start +# loads these, in order. Explicit modprobe still works for bring-up. +blacklist trusty_core +blacklist trusty_log +blacklist trusty_ipc +blacklist trusty_virtio +blacklist gsa +blacklist gs201_aoc_sysmmu +blacklist mailbox_wc +blacklist aoc_core +blacklist aoc_channel_dev +blacklist aoc_char_dev +# A kernel that carries gs201_aoc_boot (matched by google,zuma-aoc) autoloads +# it and it binds the AoC node ahead of aoc_core: the firmware file is then +# missing and the start stops with "no firmware node" (seen on the 8 Pro). +blacklist gs201_aoc_boot +# The sound card's driver would otherwise load at boot and pull the AoC core, +# GSA and Trusty in ahead of the order above, and the card waits for both +# amplifiers: omamobile-husky-aoc-start loads the card and the amplifiers +# together. No speaker_protection option: the analog ceiling stays at 10 +# until the 8 Pro has verified ceilings of its own. +blacklist aoc_alsa_dev +blacklist aoc_alsa_dev_util +blacklist snd_soc_cs35l41_spi diff --git a/packages/omamobile-device-husky/vendor/systemd/system/omamobile-husky-aoc.service b/packages/omamobile-device-husky/vendor/systemd/system/omamobile-husky-aoc.service new file mode 100644 index 000000000..2377ea247 --- /dev/null +++ b/packages/omamobile-device-husky/vendor/systemd/system/omamobile-husky-aoc.service @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: MIT +# The AoC and the speaker amplifiers on the Pixel 8 Pro at boot. If a start +# hangs, the next boot leaves the AoC off (see the script). Does nothing on a +# kernel that has no AoC node. The AoC modules are blacklisted for autoload +# (modprobe.d/omamobile-husky-aoc.conf), so this hang-safe script is the only +# thing that starts them. +[Unit] +Description=Start the AoC audio DSP and the speaker amplifiers (hang-safe) +After=local-fs.target systemd-modules-load.service +Before=sound.target +ConditionPathExists=/sys/bus/platform/devices/154b0000.aoc + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-husky-aoc-start +RemainAfterExit=yes +TimeoutStartSec=120 + +[Install] +WantedBy=multi-user.target diff --git a/packages/omamobile-device-husky/version b/packages/omamobile-device-husky/version index 699c6c6d4..1a030947e 100644 --- a/packages/omamobile-device-husky/version +++ b/packages/omamobile-device-husky/version @@ -1 +1 @@ -0.1.8 +0.1.9 From 0beb824ebe038bdef6b201b41298b61c0940dbcc Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 14:24:12 -0600 Subject: [PATCH 48/66] tools: print every tool's --help from its header with one helper (#559) Fourteen tools printed --help as a hard-coded line range of their header comment (sed -n '3,NNp'), the pattern that cut kernel-pr-check's header after #287, #288 and #310 each edited it. On #287 the maintainer suggested working the range out from the file; #529 did that for kernel-pr-check alone. This moves all of them onto one helper, tools/lib/usage.sh: usage_from_header prints the comment lines from line 3 up to the first line that isn't a comment (#529's awk line), with "# " taken off or, with --raw, kept. Tools load it only for --help, so the copies the tests make of a tool, with only the lib files it needs, still run. kernel-pr-check moves onto it too. Ten tools print byte for byte what they printed before (cmp of stdout, stderr and exit status, and of phone-demo's and phone-mirror's error usage). Five ranges were already wrong, and print the header now: fetch-toolchain and build-flame-probe printed two lines of code after it; install-phone cut --reinstall, --unsigned and its last paragraph, build-rootfs cut --channel, and release cut its check-bundle stage. build-packages, phone-demo and release print only the start of a longer header, so the helper takes a paragraph count (a bare "#" line ends one) and their output stays what the range meant. install-phone keeps the awk line inline, as nv-backup and phone-provision already do: make-bundle ships these three alone, without tools/lib (review lesson L-497). tests/tools-help fails if any tool still hard-codes the range, and runs --help on every tool that prints its header (the helper's users and the three inline ones): it must print the header, or whole paragraphs from its start, and no code, and a copy whose header has grown by a line must print that line too. It replaces #529's single-tool check in tests/kernel-pr-check. On the base it fails on the range check, and the per-tool check fails for 13 of the 15 tools. Co-authored-by: Claude Opus 5.5 Co-authored-by: Derek Ross --- tests/all | 7 +++--- tests/kernel-pr-check | 17 +++---------- tests/tools-help | 55 +++++++++++++++++++++++++++++++++++++++++ tools/build-flame-probe | 2 +- tools/build-packages | 2 +- tools/build-rootfs | 2 +- tools/fetch-published | 2 +- tools/fetch-toolchain | 2 +- tools/install-phone | 3 ++- tools/kernel-pr-check | 2 +- tools/lib/usage.sh | 26 +++++++++++++++++++ tools/make-bundle | 2 +- tools/phone-demo | 2 +- tools/phone-mirror | 2 +- tools/phone-smoke | 2 +- tools/publish-kernel | 2 +- tools/release | 2 +- tools/release-upload | 2 +- tools/repo-publish | 2 +- 19 files changed, 104 insertions(+), 32 deletions(-) create mode 100755 tests/tools-help create mode 100644 tools/lib/usage.sh diff --git a/tests/all b/tests/all index bd3c7143c..21dd14c4f 100755 --- a/tests/all +++ b/tests/all @@ -26,12 +26,13 @@ # tools/repo-publish's staging, tools/extract-vendor-firmware's output # generations (made-up files, no factory image), the callers of # tools/alpine-fetch.py stopping when it fails, and its dependency -# resolution against synthetic indexes. +# resolution against synthetic indexes, and the tools' --help from their +# header comments (tools/lib/usage.sh). set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." for f in tools/install-phone tools/phone-provision tools/nv-backup tools/build-rootfs tools/build-packages tools/make-bundle \ tools/local-key-init tools/fetch-published tools/fetch-toolchain tools/repo-publish tools/repo-build tools/release tools/release-upload tools/server/releases-nginx.sh \ - tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/signing.sh tools/lib/bundle-tar.sh rootfs/build-inside rootfs/resolve.sh tests/*; do + tools/lib/alarm.sh tools/lib/alarm-setup tools/lib/signing.sh tools/lib/bundle-tar.sh tools/lib/usage.sh rootfs/build-inside rootfs/resolve.sh tests/*; do [[ -f $f ]] || continue # tests/owl is the OWL conformance suite's folder [[ $f == *.py ]] && continue bash -n "$f" || { echo "not ok - $f parses" >&2; exit 1; } @@ -43,7 +44,7 @@ sh -n device/flame/initramfs/build bash -n tools/build-flame-probe echo "ok - scripts parse" python3 tests/bt-uart-gpio.py -for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch; do +for t in tests/pr-check tests/kernel-pr-check tests/phone-smoke tests/alarm-wake-test tests/install-phone tests/build-rootfs tests/rootfs-resolve tests/phone-provision tests/nv-backup tests/initramfs-grow tests/images-layout tests/boot-update-parity tests/stage-boot-files tests/initramfs-reproducible tests/device-overlays tests/simplefb-trigger tests/initramfs-steps tests/storage-guard tests/usb-product tests/grep-q-pipes tests/boot-method tests/modules-push tests/make-bundle-keys tests/make-bundle tests/release-signing tests/pinned-packages tests/flame-probe packages/omamobile-firstboot/test/all packages/omamobile-device-felix/test/all packages/omamobile-device-lynx/test/all packages/omamobile-device-panther/test/all tests/local-builds tests/phone-install-package tests/publish-kernel tests/fetch-toolchain tests/release-upload tests/extract-camera-data tests/release tests/lineage-ref tests/repo-publish tests/repo-publish-stage tests/extract-vendor-firmware tests/alpine-fetch-callers tests/alpine-fetch tests/tools-help; do echo "# $t" "$t" done diff --git a/tests/kernel-pr-check b/tests/kernel-pr-check index 079588d51..47457d38c 100755 --- a/tests/kernel-pr-check +++ b/tests/kernel-pr-check @@ -3,26 +3,15 @@ # tools/kernel-pr-check's commit checks against a stand-in kernel tree (a # git repository with a fake scripts/checkpatch.pl): sign-offs, prefixes, # checkpatch errors and warnings, and a checker that is missing or doesn't -# run to the end, and --help. Its device-tree comparison runs against a -# second stand-in whose make prints the messages each board file asks for; -# the real builds (clang, dtc, dt-validate) need a real tree and are run by hand. +# run to the end. Its device-tree comparison runs against a second +# stand-in whose make prints the messages each board file asks for; the +# real builds (clang, dtc, dt-validate) need a real tree and are run by hand. set -euo pipefail here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) t=$(mktemp -d) trap 'rm -rf "$t"' EXIT fail() { echo "not ok - $*" >&2; exit 1; } -# --help prints the whole header comment and no code, from a copy whose -# header has grown by a line: a hard-coded range cut its last line after -# #287, #288 and #310 each edited the header. -h=$t/help/tools/kernel-pr-check -mkdir -p "${h%/*}" -sed '3a\# A line added to the header.' "$here/tools/kernel-pr-check" > "$h" -chmod +x "$h" -diff <("$h" --help) <(sed -n '3,/^set -uo pipefail$/p' "$h" | sed '$d') \ - || fail "--help isn't the header comment, from line 3 to the line before set -uo pipefail" -echo "ok - --help prints the whole header comment, however long it grows, and no code" - k=$t/linux mkdir -p "$k/scripts" "$k/drivers" # checkpatch's stand-in: an ERROR for any added line with "BADSTYLE", a diff --git a/tests/tools-help b/tests/tools-help new file mode 100755 index 000000000..cb27c288f --- /dev/null +++ b/tests/tools-help @@ -0,0 +1,55 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# The tools' --help: no tool hard-codes the line range of its header +# comment, and every tool that prints its header with usage_from_header +# (tools/lib/usage.sh), or with the same awk line inline (the tools the +# bundle ships alone), prints all of it, or whole paragraphs from its start, +# and no code, also from a copy whose header has grown by a line. A +# hard-coded range cut the last line of a header that grew and printed code +# after one that shrank (#287). +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +t=$(mktemp -d) +trap 'rm -rf "$t"' EXIT +fail() { echo "not ok - $*" >&2; exit 1; } + +hard=$(grep -s -d skip -lE "sed -n '3,[0-9]+" tools/* || true) +[[ -z $hard ]] || fail "a hard-coded --help range in: ${hard//$'\n'/ }" +echo "ok - no tool hard-codes its --help line range" + +# --help's output, from stdout or stderr (phone-mirror's usage goes to +# stderr and exits 2) +help_of() { "$1" --help 2>&1 || true; } +# The header comment: line 3 up to the first line that isn't a comment +header() { awk 'NR > 2 && !/^#/ { exit } NR > 2' "$1"; } +# whole_paras HELP TEXT: HELP is TEXT, or TEXT's lines up to a blank comment line +whole_paras() { + [[ -n $1 ]] || return 1 + [[ $1 == "$2" ]] && return 0 + [[ $2 == "$1"$'\n'* ]] || return 1 + local rest=${2#"$1"$'\n'} + [[ ${rest%%$'\n'*} =~ ^#?[[:space:]]*$ ]] +} +# is_header FILE HELP: HELP is FILE's header, kept as it is or with "# " off +is_header() { + local h + h=$(header "$1") + whole_paras "$2" "$h" || whole_paras "$2" "$(sed 's/^# \{0,1\}//' <<<"$h")" +} + +mapfile -t tools < <(grep -s -d skip -lE 'usage_from_header|awk .NR > 2 && !/\^#/ \{ exit \}' tools/* || true) +((${#tools[@]})) || fail "no tool prints its header as --help" +mkdir -p "$t/r/tools" +cp -r tools/lib "$t/r/tools/" +for f in "${tools[@]}"; do + out=$(help_of "$PWD/$f") + is_header "$f" "$out" || fail "$f --help isn't its header comment (or whole paragraphs of it)" + g=$t/r/$f + sed '3a\# A line added to the header.' "$f" > "$g" + chmod +x "$g" + grown=$(help_of "$g") + is_header "$g" "$grown" || fail "$f --help isn't its header comment once the header grows by a line" + (($(wc -l <<<"$grown") == $(wc -l <<<"$out") + 1)) \ + || fail "$f --help doesn't follow its header when it grows by a line" +done +echo "ok - ${#tools[@]} tools print their header comment as --help, however long it grows, and no code" diff --git a/tools/build-flame-probe b/tools/build-flame-probe index c4f4ed058..4f05498f9 100755 --- a/tools/build-flame-probe +++ b/tools/build-flame-probe @@ -26,7 +26,7 @@ while (($#)); do --ssh-key) key=${2:?}; shift ;; --mkbootimg) mkbootimg=${2:?}; shift ;; --out) out=${2:?}; shift ;; - -h|--help) sed -n '3,18p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source "$ROOT/tools/lib/usage.sh"; usage_from_header "$0"; exit 0 ;; *) die "unknown argument: $1" ;; esac shift diff --git a/tools/build-packages b/tools/build-packages index fe3e2549f..388e52945 100755 --- a/tools/build-packages +++ b/tools/build-packages @@ -83,7 +83,7 @@ while (($#)); do --resign) resign=1 ;; --import) imports+=("${2:?--import needs a directory}"); shift ;; --local) local_name=${2:?--local needs a device codename}; shift ;; - -h|--help) sed -n '3,33p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0" 2; exit 0 ;; -*) alarm_die "unknown option $1" ;; *) dirs+=("${1%/}") ;; esac diff --git a/tools/build-rootfs b/tools/build-rootfs index b8c0fd06d..43ca1c753 100755 --- a/tools/build-rootfs +++ b/tools/build-rootfs @@ -84,7 +84,7 @@ while (($#)); do --keep-raw) KEEP_RAW=1 ;; --local) LOCAL=${2:?}; shift ;; --channel) CHANNEL=${2:?}; shift ;; - -h|--help) sed -n '3,54p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0"; exit 0 ;; *) alarm_die "unknown argument $1" ;; esac shift diff --git a/tools/fetch-published b/tools/fetch-published index a96ad2d02..824764c75 100755 --- a/tools/fetch-published +++ b/tools/fetch-published @@ -19,7 +19,7 @@ channel=development dir="" while (($#)); do case $1 in --channel) channel=${2:?}; shift ;; - -h|--help) sed -n '3,13p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0"; exit 0 ;; -*) die "unknown option $1" ;; *) [[ -z $dir ]] || die "one DIR only"; dir=$1 ;; esac diff --git a/tools/fetch-toolchain b/tools/fetch-toolchain index 67dea7181..4aeca482f 100755 --- a/tools/fetch-toolchain +++ b/tools/fetch-toolchain @@ -76,7 +76,7 @@ while (($#)); do --lock) lock=${2:?--lock needs a file}; shift ;; --verify) verify=1 ;; --digest) tree_digest "${2:?--digest needs a directory}"; exit ;; - -h|--help) sed -n '3,33p' "$self" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source "$ROOT/tools/lib/usage.sh"; usage_from_header "$self"; exit 0 ;; *) die "unknown argument $1" ;; esac shift diff --git a/tools/install-phone b/tools/install-phone index 0339dca95..28f808952 100755 --- a/tools/install-phone +++ b/tools/install-phone @@ -82,7 +82,8 @@ while (($#)); do --bootloader-slots-match) slots_match=${2:?}; shift ;; --reinstall) reinstall=1 ;; --unsigned) unsigned=1 ;; - -h|--help) sed -n '3,50p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;; + # Not tools/lib/usage.sh: the bundle ships this file alone, as install + -h|--help) awk 'NR > 2 && !/^#/ { exit } NR > 2 { sub(/^# ?/, ""); print }' "${BASH_SOURCE[0]}"; exit 0 ;; *) die "unknown argument $1 (see --help)" ;; esac shift diff --git a/tools/kernel-pr-check b/tools/kernel-pr-check index 47f94a0ac..cb82011f0 100755 --- a/tools/kernel-pr-check +++ b/tools/kernel-pr-check @@ -69,7 +69,7 @@ while (($#)); do --merge) merge=1; shift ;; --no-checkpatch) checkpatch=0; shift ;; --strict-trailers) shift ;; # no longer stricter; see above - -h|--help) awk 'NR > 2 && !/^#/ { exit } NR > 2' "$self"; exit 0 ;; + -h|--help) source "$repo/tools/lib/usage.sh"; usage_from_header --raw "$self"; exit 0 ;; -*) echo "kernel-pr-check: unknown option $1" >&2; exit 2 ;; *) break ;; esac diff --git a/tools/lib/usage.sh b/tools/lib/usage.sh new file mode 100644 index 000000000..63299f273 --- /dev/null +++ b/tools/lib/usage.sh @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: MIT +# A tool's --help from its own header comment: the comment lines from line 3 +# (after the shebang and the SPDX line) up to the first line that isn't a +# comment. The range comes from the file, so it can't drift from the header +# the way hard-coded line ranges did (#287): a header that gained a line cut +# its last one, and one that lost a line printed code. Tools load it only +# for --help, so a copy of a tool runs without it; the ones the bundle +# ships alone (install-phone, phone-provision, nv-backup) keep the same awk +# line inline. tests/tools-help checks them all. +# +# source tools/lib/usage.sh +# usage_from_header [--raw] FILE [PARAGRAPHS] +# prints FILE's header with each line's "#" and one space after it taken +# off (--raw keeps them). With PARAGRAPHS, only that many paragraphs of +# it (a bare "#" line ends one), for a tool whose help is the first part +# of a longer header. + +usage_from_header() { + local raw=0 + [[ ${1:-} == --raw ]] && { raw=1; shift; } + awk -v raw="$raw" -v paras="${2:-0}" ' + NR <= 2 { next } + !/^#/ { exit } + /^#[ \t]*$/ && ++blank == paras { exit } + { if (!raw) sub(/^# ?/, ""); print }' "${1:?usage_from_header FILE [PARAGRAPHS]}" +} diff --git a/tools/make-bundle b/tools/make-bundle index fd08dec68..375cdfe45 100755 --- a/tools/make-bundle +++ b/tools/make-bundle @@ -67,7 +67,7 @@ while (($#)); do --unsigned) unsigned=1 ;; --label) label=${2:?}; shift ;; --base-url) base_url=${2:?}; shift ;; - -h|--help) sed -n '3,47p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0"; exit 0 ;; *) die "unknown argument $1" ;; esac shift diff --git a/tools/phone-demo b/tools/phone-demo index 3cec85915..8a9721186 100755 --- a/tools/phone-demo +++ b/tools/phone-demo @@ -47,7 +47,7 @@ # person holding the phone will notice. set -uo pipefail -usage() { sed -n '3,12p' "$0" | sed 's/^# \{0,1\}//'; exit "${1:-0}"; } +usage() { source "$(dirname -- "${BASH_SOURCE[0]}")/lib/usage.sh"; usage_from_header "$0" 2; exit "${1:-0}"; } here=0 if [[ ${1:-} == --here ]]; then here=1; shift; fi diff --git a/tools/phone-mirror b/tools/phone-mirror index 05260f30d..3821b4540 100755 --- a/tools/phone-mirror +++ b/tools/phone-mirror @@ -25,7 +25,7 @@ TITLE="Omarchy Mobile phone" PHONE_W=1440 PHONE_H=3120 # the panel in pixels, what wayvnc sends (portrait): read from the phone below KEEP=0 FIT=0 VIEWER= HEIGHT=900 -usage() { sed -n '3,19s/^# \{0,1\}//p' "$0" >&2; exit 2; } +usage() { source tools/lib/usage.sh; usage_from_header "$0" >&2; exit 2; } die() { echo "phone-mirror: $*" >&2; exit 1; } while [[ $# -gt 0 ]]; do case $1 in diff --git a/tools/phone-smoke b/tools/phone-smoke index 3ac3b4925..13784226a 100755 --- a/tools/phone-smoke +++ b/tools/phone-smoke @@ -29,7 +29,7 @@ while (($#)); do --json) json=1 ;; # tests only: the kernel health rows for a saved error log, then exit --errors-from) errors_from=${1:?--errors-from FILE}; shift; here=1 ;; - -h|--help) sed -n '3,21p' "$0"; exit 0 ;; + -h|--help) source "$(dirname -- "${BASH_SOURCE[0]}")/lib/usage.sh"; usage_from_header --raw "$0"; exit 0 ;; *) echo "phone-smoke: unknown option $a" >&2; exit 2 ;; esac done diff --git a/tools/publish-kernel b/tools/publish-kernel index 3f34410da..757b17a4b 100755 --- a/tools/publish-kernel +++ b/tools/publish-kernel @@ -37,7 +37,7 @@ while (($#)); do case $1 in -n|--dry-run) dry=1; shift ;; --tag) tag=${2:?--tag needs a name}; shift 2 ;; - -h|--help) sed -n '3,30p' "$self"; exit 0 ;; + -h|--help) source "$repo/tools/lib/usage.sh"; usage_from_header --raw "$self"; exit 0 ;; -*) echo "publish-kernel: unknown option $1" >&2; echo "$usage" >&2; exit 2 ;; *) break ;; esac diff --git a/tools/release b/tools/release index 4ed441e16..acc0aa5be 100755 --- a/tools/release +++ b/tools/release @@ -115,7 +115,7 @@ while (($#)); do --dry-run|-n) dry=1 ;; --version) version=${2:?--version needs a value}; shift ;; --kernel-tag) kernel_tag=${2:?--kernel-tag needs a value}; shift ;; - -h|--help) sed -n '3,60p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0" 3; exit 0 ;; -*) die "unknown option $1 (see --help)" ;; *) break ;; esac diff --git a/tools/release-upload b/tools/release-upload index 36ddbb70e..33db26a39 100755 --- a/tools/release-upload +++ b/tools/release-upload @@ -81,7 +81,7 @@ while (($#)); do --verify-only) verify_only=1 ;; --latest) latest=1 ;; --allow-older) allow_older=1 ;; - -h|--help) sed -n '3,61p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0"; exit 0 ;; -*) die "unknown option $1" ;; *) [[ -z $bundle ]] || die "one bundle at a time"; bundle=$1 ;; esac diff --git a/tools/repo-publish b/tools/repo-publish index e87ee3045..89b3646bf 100755 --- a/tools/repo-publish +++ b/tools/repo-publish @@ -70,7 +70,7 @@ while (($#)); do --yes) yes=1 ;; --expect-index) expect_index=${2:?--expect-index needs a SHA-256}; args+=("$expect_index"); shift ;; --remind) remind=1 ;; - -h|--help) sed -n '3,45p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; + -h|--help) source tools/lib/usage.sh; usage_from_header "$0"; exit 0 ;; *) die "unknown argument $1" ;; esac shift From a0535aface1f4d42b4041cbe09ced7946f8f18ca Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 14:25:41 -0600 Subject: [PATCH 49/66] AGENTS.md, MODEM-PLAN: stop the modem before a push or a reboot-to; the 7 Pro's modem starts at boot by default (#574) * AGENTS.md: stop the modem before a push or a reboot-to reboot-to is a raw reboot syscall and bin/omamobile push ends in it, so neither stops omamobile-modem.service. Its clean stop never runs, the modem-up marker stays, and on the 7 Pro, where the modem starts at boot, the next boot skips the modem once as if the last one had hung; a second unclean end in a row holds it off until --retry. That happened on 2026-11-08 after a reboot-to bootloader taken to charge a flat battery. Add a bullet to the push notes in section 2: stop the unit first, under the human's go for the reboot, or use systemctl reboot when no reason is needed; what the stop costs today (about 40 s, logged as failed, marker still removed); why this is not the restart the modem gotchas forbid; and that the open #403 would make reboot-to count as a clean stop. The reboot-to gotcha and the NV overlay note in section 4 point to it; the NV note keeps nv-overlay capture as the narrower alternative. Part of #532 (its docs request only; the watcher and SIGTERM fixes are package changes). Co-Authored-By: Claude Opus 5.5 * AGENTS.md, MODEM-PLAN: modem at boot by default, #403's reach, B4 Addresses the review on #574. - AGENTS.md, the modem restart gotcha: it still called the 7 Pro's stack at boot opt-in (`systemctl enable omamobile-modem-boot.target`), which stopped being true with #398. It now says the stack starts by default since device-cheetah 0.1.43 (MODEM-PLAN M4.6b), and that `systemctl mask` keeps it off from the next boot, as the target, the package's install message and the device README say: `disable` doesn't remove device-cheetah's vendor wants link. - AGENTS.md section 2: #403 doesn't make `reboot-to` a clean stop. Its note lets the next boot's start clear a `modem-up` marker from the boot `reboot-to` ended, but the CP's ordered power-off and the NV capture still run only in the unit's stop, so the advice to stop the modem first stands with #403 merged too. - MODEM-PLAN M4.6 B4 rebooted with `reboot-to omamobile` and expected the clean stop's "modem stopped (...): modem-up removed", which a raw reboot syscall can't produce. The step is there to show that a reboot's stop clears the marker, so it now reboots through systemd, as N5 does, and its pass line takes today's "timeout" result (#532). The recorded results are unchanged. Co-Authored-By: Claude Opus 5.5 * MODEM-PLAN: M4.6b B8 and B9b reboot through systemd, as B4 now does Part of the review on #574. B8 plants another boot's modem-up marker so that "the reboot's clean stop keeps a marker that isn't this boot's", and its pass line reads the previous boot's "is another boot's ... kept"; B9b's planted reboot rests on the same stop hook, and its last "clean reboot" checks that `--stopped` removed the refused copies. All three rebooted with `reboot-to omamobile`, which stops no unit, so the stop hook they test never ran: the same gap as B4. They now reboot with `systemctl reboot`. The recorded results are unchanged. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- AGENTS.md | 7 ++++--- device/cheetah/MODEM-PLAN.md | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8174b5699..636a77ad3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -58,6 +58,7 @@ Omarchy Mobile runs native Omarchy (Arch Linux ARM, Hyprland, Omarchy's packages This leaves other people's staged and unstaged changes alone. - **Moving a feature from bring-up into a package:** bump the package `version`, enable nothing that isn't hang-safe, and delete the bring-up files from `/etc/modprobe.d` on the phone (`omamobile-*-bringup.conf`, and any hand-copied package file). A file in `/etc/modprobe.d` replaces the package's `/usr/lib/modprobe.d` file of the same name, so a stale `omamobile-aoc.conf` there hid the package's new blacklist. - **Kernel releases change with every push** (`7.3.0-rc6-omamobile-push1-NNNNN-g`). `bin/omamobile push` runs `modules-push` when the tarball's checksum differs. Without its modules a new kernel boots without its drivers, the GPU among them. `modules-push` replaces `/usr/lib/modules/` as a whole; on the 9a that once took a hand-installed panel driver with it, and the display stayed on the boot logo. It now refuses when the folder holds modules added or swapped by hand since the last push (it records what each push installed in `.omamobile-modules.sha256`), and `OMAMOBILE_MODULES_REPLACE=1` overrides that, wiping them. Pin a daily release whose folder carries hand-installed modules (`/usr/lib/modules/.omamobile-pinned`), and keep a copy before overriding (`tar -C /usr/lib/modules -cf … `). +- **Stop the modem before a `push` or a `reboot-to`.** `push` ends in `reboot-to`, a raw reboot syscall that stops no unit, so `omamobile-modem.service` never runs its clean stop and its `modem-up` marker stays. On the 7 Pro, where the modem starts at boot (device-cheetah 0.1.43+), the next boot then skips the modem once ("ended without a clean stop: a hang or a reset"), and a second such end before a clean stop holds it off until `omamobile-modem-start --retry`. This happened on 2026-11-08 after a `reboot-to bootloader` taken to charge a flat battery. So run `systemctl stop omamobile-modem` first, as part of the reboot the human said yes to; a reboot that needs no reason can be `systemctl reboot` instead, which stops it. The stop powers the CP off (one recovered UFS error-handler pass, as any reboot with the modem up costs) and, with the NV overlay on, captures its writes. For now it takes about 40 s and ends as "failed", with the CP's power-off logged as a crash; the marker is still removed ([#532](https://github.com/derekross/omarchy-mobile/issues/532)). This is not the restart the modem notes below forbid: nothing starts the modem again before the reboot. [#403](https://github.com/derekross/omarchy-mobile/pull/403), still open, would let the next boot start the modem after a `reboot-to`; the CP's ordered power-off and the NV capture would still come only from the unit's stop. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6b ## 3. How the tools fit together @@ -125,7 +126,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - **ABL picks the base DTB by `soc_id`:** `bin/omamobile images` ships both silicon revisions. It also needs an empty `/ect` node and `/chosen/bootargs`, and applies a DPM overlay that needs label stubs (build with `-@`). - **Pixel 7 Pro: once slot B has booted with AVB footers, it needs them.** A stock install's `vbmeta_b` chains `boot` and `init_boot`. After one boot of #104's footer-carrying images, ABL refused footer-less ones (images built by any tool from before #104, or a saved older image set): it stopped in fastboot or used up B's tries and fell back to stock, whose recovery offered "Try again" or "Factory data reset". Build every image with the current `bin/omamobile`, keep rollback sets built the same way, and on that recovery screen choose neither: hold Volume Down + Power about 20 s for fastboot. A stock boot rewrites `efs`, `persist` and `modem_userdata`, so take a fresh read-only backup after one. [NOTES](device/cheetah/NOTES.md#2026-10-30-the-charger-reads-offline-at-full-and-slot-b-now-needs-its-avb-footers) - **Pixel 9a: a fallback to slot A costs the Linux root.** `fastboot --set-active=b` (which `bin/omamobile flash` runs) clears B's successful flag and gives B three ABL tries. A fastboot flash of slot B's images without `--set-active` clears the flag too: on 2026-10-31, `slot-successful:b` read `yes` before five suffixed flashes and `no` after, and the next boot started with `retry-count` 2 ([tegu NOTES](device/tegu/NOTES.md#2026-10-31-a-fastboot-flash-of-slot-b-cleared-its-successful-mark-and-b-was-marked-again)). Every boot uses one try, and the initramfs USB safety net (no USB host in about 65 s: panic) uses them fast. At zero ABL boots stock on slot A, and stock overwrote `userdata` on 10-28, and most likely on 10-26, before anyone could choose anything in recovery. So: `flash` only a known-good image set, and on the 9a ask the maintainer before any `flash` or fastboot write to slot B, because it unmarks B. Marking B successful is a `devinfo` write, and on the 9a it is on hold until the maintainer decides how it's done: don't mark B, and don't run `omamobile-bootctl` or anything that makes `devinfo` writable. With B marked, try new images with `push`, which doesn't call `--set-active` and leaves the mark alone; ABL then no longer falls back, so a broken pushed image means fastboot by the buttons, and the fastboot recovery leaves B unmarked: from then on every boot spends a try, so keep reboots few and ask the maintainer before marking B. With B unmarked, every boot spends one of the three tries: keep reboots few and don't test new images. [tegu NOTES](device/tegu/NOTES.md#2026-10-26-and-2026-10-28-slot-a-fallbacks-that-cost-userdata); the operation approved on 2026-10-22, now on hold: [NOTES](device/tegu/NOTES.md#approved-b-success-operation-after-layout-review-2026-10-22). -- **`reboot -f` and busybox `reboot` hang:** use `reboot-to ` (`LINUX_REBOOT_CMD_RESTART2`). ABL often ignores the `bootloader` reason anyway. +- **`reboot -f` and busybox `reboot` hang:** use `reboot-to ` (`LINUX_REBOOT_CMD_RESTART2`). ABL often ignores the `bootloader` reason anyway. It stops no unit, so stop the modem first (section 2). - **Reserved memory on gs201 is `#address-cells = <2>`, `#size-cells = <1>`,** so each `reg`/`alloc-ranges` entry is 12 bytes. A 16-byte value is silently ignored, and the pool lands anywhere. The display pool's `alignment` must be two cells too, or `of_reserved_mem` rejects it. `/proc/device-tree` shows the raw property, so it *looks* right. [WIFI-BATTERY-PLAN](device/cheetah/WIFI-BATTERY-PLAN.md) 9.x, [NOTES](device/cheetah/NOTES.md) - **Check every stock `reserved-memory` region against `/proc/iomem`:** five were plain System RAM in our kernel, and firmware writes into them at runtime. - **Don't make a driver depend on device-tree node order.** The AoC sound card numbered its PCMs in DAI link order, and the PCM number is the AoC entry point ID. Rewriting the overlay's node order changed nothing on the phone (`fdtoverlay` in our tree kept the source order), so the card driver now sorts its links by link id itself. [AOC-PLAN](device/cheetah/AOC-PLAN.md) C7d-5 @@ -193,8 +194,8 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - **Volume Up is the one key without an internal pull** (`PUD` 0x0, as on stock), and the first freeze woke 3 s in from it with nobody touching it. It didn't recur in the 51 RTC cycles of S4 and S5c, and it isn't proven to be a false edge; if spurious wakes recur, check gpa8-5's power-down pull before blaming the wake path. - **UFS ran its error handler around modem power changes** (PA LINERESET indications, recovered without a reset). Stock's DT shows no shared rail, clock or pin. M2.5 narrowed it down: power-on and a running link are clean, but every modem power-off is followed by one recovered UFS error-handler pass (a PA LINERESET, no I/O errors or resets). Stock powers the modem off only at shutdown, so the modem stays on once it is up (M2.6 is open), and a reboot with the modem up costs one such pass. Keep modem tests attended, don't power-cycle the modem, and check `dmesg | grep ufshcd_err_handler` after each step. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M2, M2.5, M2.6 - **Suspend with the modem on has never run on the 7 Pro, and is unqualified on the 9a**: its one try (2026-10-27) also had NFC polling, which alone resets the 9a in s2idle, so the modem's part is unknown. CPIF's PM paths are wake-armed in code, but M6 is design only and no SIM test has happened (M4.2). Keep modem tests on the charger, so upower's critical action doesn't suspend the phone mid-test. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) 6.3, [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" -- **Never `systemctl restart omamobile-modem` (or stop and start it) to recover a crashed modem.** An in-place restart left raven's CP in BOOTING, and a bring-up that never reaches ONLINE sets a latch that makes the next boot skip the modem. Reboot instead. If a boot skipped it, remove the latch (`rm /var/lib/omamobile/modem-bringup-started`) and `systemctl start omamobile-modem`; `/usr/lib/omamobile-vendor/omamobile-modem-start --retry` also clears it, but run by hand it brings the modem up outside the unit (a stray `rfsd` in your shell's session). From `omamobile-modem` 0.1.13 there is a second marker, `/var/lib/omamobile/modem-up`, written at ONLINE and removed by the unit's clean stop: a boot that hung or reset with the modem up leaves it, and the next boot refuses with "ended without a clean stop" until it is removed the same way (cheetah [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6). On the 7 Pro the stack at boot is `systemctl enable omamobile-modem-boot.target`, opt-in; it also holds a sleep inhibitor until the reboot. [raven MODEM-PLAN](device/raven/MODEM-PLAN.md) D4. The same on the 9a: after the modem profile has stopped, starting it again in the same boot reset the palmtop silently, a watchdog reset with nothing in pstore (the one try was in the rfsd stage). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) G3. **From `omamobile-modem` 0.1.10, `omamobile-vendor-chroot modem check` refuses once the profile has started this boot** ("the modem profile already started this boot"), so it is no longer a post-install health check while the modem is up: it is read-only and safe to run, but a refusal means the profile ran, not that anything is wrong. After a reboot it says "preconditions met" again. -- **Linux never writes the modem's NV partitions.** The modem chroot profile (cbd, rfsd) refuses to start unless the NV partitions read `ro=1` and none is mounted, and works on checksum-verified RAM copies only. What the modem writes is lost at stop, except its writes to `efs/nv_normal.bin` (expected to hold the carrier profile, network and IMS data; the runbook confirms it) when the NV overlay is on (section 1): those are captured every 30 minutes and at the unit's stop, after the CP is off, and laid over the verified copy at the next start. `reboot-to` (and `bin/omamobile push`) stops no unit, so run `omamobile-modem nv-overlay capture` first, or use `systemctl reboot`. Don't give the chroot a real block device. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) "NV overlay" +- **Never `systemctl restart omamobile-modem` (or stop and start it) to recover a crashed modem.** An in-place restart left raven's CP in BOOTING, and a bring-up that never reaches ONLINE sets a latch that makes the next boot skip the modem. Reboot instead. If a boot skipped it, remove the latch (`rm /var/lib/omamobile/modem-bringup-started`) and `systemctl start omamobile-modem`; `/usr/lib/omamobile-vendor/omamobile-modem-start --retry` also clears it, but run by hand it brings the modem up outside the unit (a stray `rfsd` in your shell's session). From `omamobile-modem` 0.1.13 there is a second marker, `/var/lib/omamobile/modem-up`, written at ONLINE and removed by the unit's clean stop: a boot that hung or reset with the modem up leaves it, and the next boot refuses with "ended without a clean stop" until it is removed the same way (cheetah [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6). On the 7 Pro the stack starts at boot by default since device-cheetah 0.1.43 ([MODEM-PLAN](device/cheetah/MODEM-PLAN.md) M4.6b); to keep it off from the next boot, `systemctl mask omamobile-modem-boot.target` (`unmask` turns it back on; `disable` doesn't remove device-cheetah's vendor wants link); it also holds a sleep inhibitor until the reboot. [raven MODEM-PLAN](device/raven/MODEM-PLAN.md) D4. The same on the 9a: after the modem profile has stopped, starting it again in the same boot reset the palmtop silently, a watchdog reset with nothing in pstore (the one try was in the rfsd stage). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) G3. **From `omamobile-modem` 0.1.10, `omamobile-vendor-chroot modem check` refuses once the profile has started this boot** ("the modem profile already started this boot"), so it is no longer a post-install health check while the modem is up: it is read-only and safe to run, but a refusal means the profile ran, not that anything is wrong. After a reboot it says "preconditions met" again. +- **Linux never writes the modem's NV partitions.** The modem chroot profile (cbd, rfsd) refuses to start unless the NV partitions read `ro=1` and none is mounted, and works on checksum-verified RAM copies only. What the modem writes is lost at stop, except its writes to `efs/nv_normal.bin` (expected to hold the carrier profile, network and IMS data; the runbook confirms it) when the NV overlay is on (section 1): those are captured every 30 minutes and at the unit's stop, after the CP is off, and laid over the verified copy at the next start. `reboot-to` (and `bin/omamobile push`) skips that stop, so stop the modem first (section 2) or run `omamobile-modem nv-overlay capture`. Don't give the chroot a real block device. [MODEM-PLAN](device/cheetah/MODEM-PLAN.md) "NV overlay" ### USB diff --git a/device/cheetah/MODEM-PLAN.md b/device/cheetah/MODEM-PLAN.md index 2bd62cd81..3299dbfa2 100644 --- a/device/cheetah/MODEM-PLAN.md +++ b/device/cheetah/MODEM-PLAN.md @@ -2802,13 +2802,16 @@ tools/phone-ssh 'nmcli -f DEVICE,TYPE,STATE device | grep -c gsm; omamobile-sit # rollback: as B2 # B4 the second reboot: the clean stop clears the modem-up marker, and the next boot starts again -# (asks the human; risk: medium: one UFS pass) -tools/phone-ssh 'sync; (sleep 1; reboot-to omamobile) >/dev/null 2>&1 &' +# (asks the human; risk: medium: one UFS pass). Through systemd: `reboot-to` stops no unit, so the stop +# hook wouldn't run (AGENTS.md section 2) +tools/phone-ssh 'systemctl reboot' +# once the phone is back on USB (the modem's stop takes about 40 s, #532): tools/phone-ssh 'sleep 240; journalctl -b -1 -u omamobile-modem -o cat | grep -E "CP OFFLINE|stopped|removed|kept" | tail -3; systemctl is-active omamobile-modem omamobile-sitd omamobile-sit-data omamobile-mmd; omamobile-sit status | head -3; ls -l /var/lib/omamobile/modem-* 2>&1; dmesg | grep -c ufshcd_err_handler' -# pass: the previous boot's journal ends with "CP OFFLINE" and "modem stopped (success): ... modem-up -# removed"; active x4 and registered again; only this boot's modem-up; err_handler 0 on this boot +# pass: the previous boot's journal has "CP OFFLINE" and ends with "modem stopped (): ... modem-up +# removed" (the result is "timeout" until #532 is fixed; the removal is what counts); active x4 and +# registered again; only this boot's modem-up; err_handler 0 on this boot # stop: the modem unit refused with "ended without a clean stop" (the stop hook didn't run or ran on # another boot's marker: the -1 journal says which; the fix is in the package, not on the phone: # `systemctl disable omamobile-modem-boot.target`, remove the marker, and reboot); "never reached @@ -2955,7 +2958,7 @@ tools/phone-ssh 'sleep 240; systemctl list-units --no-pager "omamobile-modem*" o # keeps a marker that isn't this boot's (--stopped), so the next boot finds a stale one, refuses once, # moves it aside, and the boot after starts the modem again. No forced reset needed. tools/phone-ssh 'cat /var/lib/omamobile/modem-up; printf "%s boot %s\n" "$(date -Is)" 00000000-0000-0000-0000-000000000000 > /var/lib/omamobile/modem-up; sync; cat /var/lib/omamobile/modem-up' -tools/phone-ssh 'sync; (sleep 1; reboot-to omamobile) >/dev/null 2>&1 &' +tools/phone-ssh 'systemctl reboot' # through systemd, so the stop hook runs (B4); after it, once back on USB: tools/phone-ssh 'sleep 120; journalctl -b -1 -u omamobile-modem -o cat | tail -3; systemctl is-active omamobile-modem omamobile-sitd omamobile-sit-data omamobile-mmd; journalctl -b -u omamobile-modem -o cat; ls -l /var/lib/omamobile/modem-* 2>&1; cat /run/omamobile/modem-refused; systemd-inhibit --list --no-legend | grep -c omamobile-modem; dmesg | grep -c ufshcd_err_handler' @@ -2989,7 +2992,7 @@ tools/phone-ssh 'sleep 240; systemctl is-active omamobile-modem omamobile-sitd o # another boot's id again. The reboot's stop hook keeps the planted marker and the copy (not this boot's), # so the next boot finds both: the one automatic retry is used up, and it holds. tools/phone-ssh 'ls -l /var/lib/omamobile/modem-*; printf "%s boot %s\n" "$(date -Is)" 00000000-0000-0000-0000-000000000000 > /var/lib/omamobile/modem-up; sync' -tools/phone-ssh 'sync; (sleep 1; reboot-to omamobile) >/dev/null 2>&1 &' +tools/phone-ssh 'systemctl reboot' # through systemd, so the stop hook runs (B4); after it, once back on USB: tools/phone-ssh 'sleep 120; systemctl is-active omamobile-modem omamobile-sitd omamobile-sit-data omamobile-mmd; journalctl -b -u omamobile-modem -o cat | grep -E "clean stop|used up|moved"; ls -l /var/lib/omamobile/modem-* 2>&1; cat /run/omamobile/modem-refused; systemd-inhibit --list --no-legend | grep -c omamobile-modem; dmesg | grep -c ufshcd_err_handler' @@ -3001,9 +3004,9 @@ tools/phone-ssh 'sleep 120; systemctl is-active omamobile-modem omamobile-sitd o # -1 journal and the ls before the plant); the modem started (the planted marker was removed) # then: rm -f /var/lib/omamobile/modem-up*; reboot (asks the human); after 240 s: as B9's pass (active x4, # "CP ONLINE", this boot's modem-up, no refused copy, no modem-refused) -# then: one more clean reboot (asks the human; one UFS pass): the modem starts, this boot's modem-up, -# and ls /var/lib/omamobile/modem-up.refused-* finds nothing (the streak reset by --stopped at the -# reboot before: the copies are removed with this boot's marker) +# then: one more clean reboot, `systemctl reboot` (asks the human; one UFS pass): the modem starts, this +# boot's modem-up, and ls /var/lib/omamobile/modem-up.refused-* finds nothing (the streak reset by +# --stopped at the reboot before: the copies are removed with this boot's marker) # stop: a refused copy after the clean reboot (--stopped didn't remove them: journalctl -b -1 -u # omamobile-modem, "modem stopped"); refused on either boot # rollback: as B8 From e20b212a0c3293bccb9e282e91fbc7b94540ceab Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:55:01 +0100 Subject: [PATCH 50/66] omamobile-shell 0.2.109: keep the shade viewport stable while sliding (#516) Calculate notification capacity from the sheet's resting position instead of its animated position. The shade still follows sheet movement, while expansion and screen geometry continue to update its available room. Exercise the production geometry expressions under real Qt bindings. The baseline changes room and height during reveal; the candidate keeps both stable and preserves final portrait, landscape and short-screen geometry. A control restoring the old calculation fails the assertions. Keep the change independent of host interfaces, safe-area extensions, backend scheduling and hardware support. The package increment is proposed from the current public main and can be adjusted by the maintainer at merge. No phone frame-rate or runtime qualification is claimed. Co-authored-by: Codex Co-authored-by: Derek Ross --- .../omamobile.quicksettings/QuickSettings.qml | 5 +- packages/omamobile-shell/test/all | 13 ++ .../test/quicksettings-shade-layout.py | 100 +++++++++++++ .../test/quicksettings-shade-layout.qml.in | 136 ++++++++++++++++++ packages/omamobile-shell/version | 2 +- 5 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 packages/omamobile-shell/test/quicksettings-shade-layout.py create mode 100644 packages/omamobile-shell/test/quicksettings-shade-layout.qml.in diff --git a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml index 4b2d2f86f..6541ca6c8 100644 --- a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml +++ b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml @@ -1926,7 +1926,10 @@ Item { // Not "top": every Item already has a FINAL top anchor line, and // Qt 6.12 refuses to load a file that redeclares it. readonly property real shadeTop: root.wide ? sheet.y : sheet.y + sheet.height + Style.spacing.lg - readonly property real room: window.height - shadeTop - Style.gapsOut + // Sliding changes position, not the settled notification viewport. + // Expansion still updates the available room through sheet.height. + readonly property real restingTop: root.wide ? Style.gapsOut : Style.gapsOut + sheet.height + Style.spacing.lg + readonly property real room: window.height - restingTop - Style.gapsOut readonly property real insets: shade.contentTopInset + shade.contentBottomInset readonly property real listHeight: root.notifications.length > 0 ? shadeList.contentHeight : shadeEmpty.implicitHeight // The media card and the gap under it, when a player is up. diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 9e19f2609..d82ecdedd 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -685,6 +685,19 @@ elif [[ $rc != 0 ]]; then else pass "the shade under touch: a swipe forgets one, a short one springs back, a tap taps, a drag scrolls" fi +# The notification viewport keeps its settled height during sheet motion. +rc=0 +out=$(python3 -B test/quicksettings-shade-layout.py \ + plugins/omamobile.quicksettings/QuickSettings.qml 2>&1) || rc=$? +if [[ $rc == 77 ]]; then + pass "stable notification viewport # SKIP no qmltestrunner" +elif [[ $rc != 0 ]]; then + printf '%s\n' "$out" >&2 + fail "stable notification viewport (test/quicksettings-shade-layout.py)" +else + pass "notification viewport stays stable while sliding and follows expansion" +fi + # The shade's media card (MPRIS): which player shows, what each control # calls, the seek bar, the card's tap. test/media-touch drives it; the art # rule and the order are in test/media-model.js; test/quicksettings-render diff --git a/packages/omamobile-shell/test/quicksettings-shade-layout.py b/packages/omamobile-shell/test/quicksettings-shade-layout.py new file mode 100644 index 000000000..ca228bff5 --- /dev/null +++ b/packages/omamobile-shell/test/quicksettings-shade-layout.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Exercise actual QuickSettings geometry expressions under real Qt bindings.""" + +import argparse +import os +from pathlib import Path +import re +import shutil +import subprocess +import tempfile + + +def expression(section, name): + pattern = r"^ readonly property real " + name + r": (.+)$" + match = re.search(pattern, section, re.MULTILINE) + if not match: + raise RuntimeError("Missing production property " + name) + return match[1].replace("Style.", "style.") + + +def fixture(source, baseline): + section = source[source.index(" // ---------- The notification shade:"):] + position = re.search(r"^ y: (Style.gapsOut.+)$", source, re.MULTILINE) + if not position: + raise RuntimeError("Missing production sheet position") + + if baseline: + resting = ( + "root.wide ? style.gapsOut : " + "style.gapsOut + sheet.height + style.spacing.lg" + ) + churn = "verify(root.roomChanges > 3);\n verify(root.heightChanges > 3);" + drag = "compare(shade.height, before + 50);" + else: + resting = expression(section, "restingTop") + churn = "compare(root.roomChanges, 0);\n compare(root.heightChanges, 0);" + drag = "compare(shade.height, before);" + + replacements = { + "POSITION": position[1].replace("Style.", "style."), + "SHADETOP": expression(section, "shadeTop"), + "RESTING": resting, + "ROOM": expression(section, "room"), + "CHURN": churn, + "DRAG": drag, + } + template = Path(__file__).with_name("quicksettings-shade-layout.qml.in").read_text() + for placeholder, value in replacements.items(): + if template.count(placeholder) != 1: + raise RuntimeError("Unexpected template placeholder " + placeholder) + template = template.replace(placeholder, value) + return template + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("source", type=Path) + parser.add_argument("--baseline", action="store_true") + args = parser.parse_args() + runner = ( + shutil.which("qmltestrunner6") + or shutil.which("/usr/lib/qt6/bin/qmltestrunner") + or shutil.which("qmltestrunner") + ) + if not runner: + print("quicksettings-shade-layout: no qmltestrunner") + return 77 + qml = fixture(args.source.read_text(), args.baseline) + + with tempfile.TemporaryDirectory(prefix="public-shade-") as directory: + root = Path(directory) + runtime = root / "runtime" + runtime.mkdir(mode=0o700) + test = root / "tst_shade.qml" + test.write_text(qml) + + environment = os.environ.copy() + environment.update( + QT_QPA_PLATFORM="offscreen", + QT_QUICK_BACKEND="software", + QT_QPA_PLATFORMTHEME="generic", + GSETTINGS_BACKEND="memory", + XDG_RUNTIME_DIR=str(runtime), + ) + environment.pop("QT_QPA_GENERIC_PLUGINS", None) + environment.pop("QT_PLUGIN_PATH", None) + result = subprocess.run( + [runner, "-input", str(test)], + env=environment, + capture_output=True, + text=True, + timeout=5, + ) + print(result.stdout + result.stderr, end="") + return result.returncode + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packages/omamobile-shell/test/quicksettings-shade-layout.qml.in b/packages/omamobile-shell/test/quicksettings-shade-layout.qml.in new file mode 100644 index 000000000..f3f4703c2 --- /dev/null +++ b/packages/omamobile-shell/test/quicksettings-shade-layout.qml.in @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtTest + +TestCase { + id: test + name: "PublicShadeViewport" + when: windowShown + visible: true + width: 120 + height: 120 + QtObject { + id: style + readonly property real gapsOut: 24 + readonly property var spacing: ({ + lg: 20 + }) + } + QtObject { + id: window + property real height: 935 + } + Item { + id: root + property bool wide: false + property bool editing: false + property real reveal: 0 + property real baseHeight: 400 + property int roomChanges: 0 + property int heightChanges: 0 + QtObject { + id: drag + property real offset: 0 + } + Item { + id: sheet + height: root.baseHeight + y: POSITION + } + Item { + id: shade + readonly property real shadeTop: SHADETOP + readonly property real restingTop: RESTING + readonly property real room: ROOM + property real natural: 900 + y: shadeTop + height: Math.min(natural, room) + onRoomChanged: root.roomChanges++ + onHeightChanged: root.heightChanges++ + } + NumberAnimation { + id: slide + target: root + property: "reveal" + from: 0 + to: 1 + duration: 220 + } + } + function init() { + slide.stop(); + root.wide = false; + window.height = 935; + root.baseHeight = 400; + drag.offset = 0; + root.reveal = 0; + shade.natural = 900; + wait(10); + root.roomChanges = 0; + root.heightChanges = 0; + } + function test_animationLayoutChurn() { + slide.start(); + tryVerify(function () { + return !slide.running; + }, 600); + console.log("REVEAL_GEOMETRY_UPDATES", root.roomChanges, root.heightChanges); + CHURN; + compare(shade.room, window.height - style.gapsOut - sheet.height - style.spacing.lg - style.gapsOut); + } + function test_endStateAndExpansion() { + root.reveal = 1; + var cases = [ + { + wide: false, + h: 935, + sheet: 400, + n: 100 + }, + { + wide: false, + h: 935, + sheet: 400, + n: 900 + }, + { + wide: true, + h: 420, + sheet: 320, + n: 900 + }, + { + wide: false, + h: 300, + sheet: 280, + n: 900 + } + ]; + for (var i = 0; i < cases.length; i++) { + var v = cases[i]; + root.wide = v.wide; + window.height = v.h; + root.baseHeight = v.sheet; + shade.natural = v.n; + var room = v.h - (v.wide ? style.gapsOut : style.gapsOut + v.sheet + style.spacing.lg) - style.gapsOut; + compare(shade.room, room); + compare(shade.height, Math.min(v.n, room)); + compare(shade.y, v.wide ? style.gapsOut : style.gapsOut + v.sheet + style.spacing.lg); + } + root.wide = false; + window.height = 935; + root.baseHeight = 400; + shade.natural = 900; + var old = shade.height; + root.baseHeight = 500; + verify(shade.height < old); + } + function test_dragKeepsLayout() { + root.reveal = 1; + var before = shade.height; + var y = shade.y; + drag.offset = -50; + compare(shade.y, y - 50); + DRAG; + } +} diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index aa7ceeb16..386f42156 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.108 +0.2.109 From e5ba01e4b08d6b0e41523b06bd559157542e5d55 Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 01:01:54 +0100 Subject: [PATCH 51/66] omamobile-shell 0.2.110: stagger Quick Settings status refreshes (#518) * omamobile-shell 0.2.102: defer open-time backend refresh until settled Opening Quick Settings starts eleven backend reads together while the sheet animates. Queue those existing read entry points after reveal and tracked sheet interactions settle, with one start per 48 ms. Coalesce unfinished open requests and cancel pending work when the sheet closes. Keep direct actions and their confirmation reads immediate. Exercise the production queue declarations under real Qt bindings for settling, staggering, cancellation, coalescing and scroll/edit gates. A synchronous burst control fails the timing and coalescing assertions. The queue tracks reveal animation, background drag, the four Flickables and edit mode. It does not track slider presses or serialize process completion. Existing polling and in-flight completion remain unchanged. No physical frame-rate improvement is claimed. The proposed package version must be allocated again at merge. Co-Authored-By: Codex * omamobile-shell: prioritize visible Quick Settings reads Dispatch notifications first, then DND and brightness, so the shade does not wait behind less visible status reads on every open. Editing itself no longer blocks the queue until Done; actual reveal, drag and scrolling still pause it. Keep action readbacks immediate and preserve close cancellation/coalescing. Actual Qt tests cover first-screen order and idle edit-mode opens as well as spacing and gesture gates. Restoring either old behavior fails its test. Co-Authored-By: Codex * omamobile-shell: name refresh probes in the scheduler fixture Record refresh entry points by name instead of their former numeric slots. This makes the notification-first order and immediate DND assertions readable without changing the production scheduler, its timing or gesture gates. The real offscreen Qt fixture passes all nine entries. The synchronous burst, old ordering and restored edit gate still fail their targeted assertions. Co-Authored-By: Codex --------- Co-authored-by: Codex Co-authored-by: Derek Ross --- .../omamobile.quicksettings/QuickSettings.qml | 65 +++++- packages/omamobile-shell/test/all | 13 ++ .../test/quicksettings-refresh.py | 46 ++++ .../test/quicksettings-refresh.qml.in | 213 ++++++++++++++++++ packages/omamobile-shell/version | 2 +- 5 files changed, 326 insertions(+), 13 deletions(-) create mode 100644 packages/omamobile-shell/test/quicksettings-refresh.py create mode 100644 packages/omamobile-shell/test/quicksettings-refresh.qml.in diff --git a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml index 6541ca6c8..29da95201 100644 --- a/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml +++ b/packages/omamobile-shell/plugins/omamobile.quicksettings/QuickSettings.qml @@ -73,17 +73,58 @@ Item { expanded = payload.expanded === true if (payload.page === "edit") startEditing() opened = true - refreshProbe() - refreshDnd() - brightness.refresh() - torch.refresh() - rotationLock.refresh() - location.refresh() - nfc.refresh() - fingerprint.refresh() - keyboard.refresh() - refreshNotifications() - clockFormatRead.running = true + scheduleOpenRefresh() + } + + // Open-time reads wait for presentation to settle. Action confirmation + // reads remain immediate; closing cancels only work not started yet. + property int openRefreshIndex: -1 + readonly property bool openRefreshMoving: revealAnimation.running || drag.pressed + || sheetFlick.moving || pager.moving || editFlick.moving || shadeList.moving + + function scheduleOpenRefresh() { + if (openRefreshIndex < 0) openRefreshIndex = 0 + resumeOpenRefresh() + } + + function resumeOpenRefresh() { + openRefreshTimer.stop() + if (opened && !openRefreshMoving && openRefreshIndex >= 0) + openRefreshTimer.start() + } + + function cancelOpenRefresh() { + openRefreshTimer.stop() + openRefreshIndex = -1 + } + + function runOpenRefresh() { + if (!opened || openRefreshMoving || openRefreshIndex < 0) return + var index = openRefreshIndex++ + switch (index) { + // Prioritize what is visible immediately on the first screen. + case 0: refreshNotifications(); break + case 1: refreshDnd(); break + case 2: brightness.refresh(); break + case 3: refreshProbe(); break + case 4: torch.refresh(); break + case 5: rotationLock.refresh(); break + case 6: location.refresh(); break + case 7: nfc.refresh(); break + case 8: fingerprint.refresh(); break + case 9: keyboard.refresh(); break + case 10: if (!clockFormatRead.running) clockFormatRead.running = true; break + } + if (openRefreshIndex >= 11) openRefreshIndex = -1 + else resumeOpenRefresh() + } + + onOpenRefreshMovingChanged: resumeOpenRefresh() + onOpenedChanged: { if (!opened) cancelOpenRefresh() } + Timer { + id: openRefreshTimer + interval: 48 + onTriggered: root.runOpenRefresh() } // Host-initiated close (`shell hide`). @@ -1374,7 +1415,7 @@ Item { // 0 = tucked above the screen, 1 = fully down. Driving the window's // visibility from this lets the sheet finish sliding up before it unmaps. property real reveal: opened ? 1 : 0 - Behavior on reveal { NumberAnimation { duration: 220; easing.type: Easing.OutCubic } } + Behavior on reveal { NumberAnimation { id: revealAnimation; duration: 220; easing.type: Easing.OutCubic } } readonly property color foreground: Commons.Color.popups.text readonly property int pad: Style.spacing.panelPadding diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index d82ecdedd..0e944b2d0 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -698,6 +698,19 @@ else pass "notification viewport stays stable while sliding and follows expansion" fi +# Open-time backend reads settle and spread out without delaying actions. +rc=0 +out=$(python3 -B test/quicksettings-refresh.py \ + plugins/omamobile.quicksettings/QuickSettings.qml 2>&1) || rc=$? +if [[ $rc == 77 ]]; then + pass "open-refresh queue # SKIP no qmltestrunner" +elif [[ $rc != 0 ]]; then + printf '%s\n' "$out" >&2 + fail "open-refresh queue (test/quicksettings-refresh.py)" +else + pass "open-refresh queue settles, coalesces and cancels pending work" +fi + # The shade's media card (MPRIS): which player shows, what each control # calls, the seek bar, the card's tap. test/media-touch drives it; the art # rule and the order are in test/media-model.js; test/quicksettings-render diff --git a/packages/omamobile-shell/test/quicksettings-refresh.py b/packages/omamobile-shell/test/quicksettings-refresh.py new file mode 100644 index 000000000..6616acfea --- /dev/null +++ b/packages/omamobile-shell/test/quicksettings-refresh.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Exercise the production open-refresh queue with real Qt bindings.""" +import argparse +import os +from pathlib import Path +import shutil +import subprocess +import tempfile + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("source", type=Path) + parser.add_argument("--burst-negative", action="store_true") + args = parser.parse_args() + source = args.source.read_text() + start = source.index(" // Open-time reads wait for presentation to settle.") + end = source.index(" // Host-initiated close", start) + scheduler = source[start:end] + if args.burst_negative: + scheduler = scheduler.replace("openRefreshTimer.start()", "root.runOpenRefresh()") + template = Path(__file__).with_name("quicksettings-refresh.qml.in").read_text() + if template.count("SCHEDULER") != 1: + raise RuntimeError("Unexpected scheduler template") + runner = shutil.which("qmltestrunner6") or shutil.which("/usr/lib/qt6/bin/qmltestrunner") or shutil.which("qmltestrunner") + if not runner: + print("quicksettings-refresh: no qmltestrunner") + return 77 + with tempfile.TemporaryDirectory(prefix="qs-refresh-") as directory: + root = Path(directory) + runtime = root / "runtime" + runtime.mkdir(mode=0o700) + test = root / "tst_queue.qml" + test.write_text(template.replace("SCHEDULER", scheduler)) + env = os.environ.copy() + env.update(QT_QPA_PLATFORM="offscreen", QT_QUICK_BACKEND="software", QT_QPA_PLATFORMTHEME="generic", XDG_RUNTIME_DIR=str(runtime)) + env.pop("QT_PLUGIN_PATH", None) + env.pop("QT_QPA_GENERIC_PLUGINS", None) + result = subprocess.run([runner, "-input", str(test)], env=env, capture_output=True, text=True, timeout=12) + print(result.stdout + result.stderr, end="") + return result.returncode + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packages/omamobile-shell/test/quicksettings-refresh.qml.in b/packages/omamobile-shell/test/quicksettings-refresh.qml.in new file mode 100644 index 000000000..be2a28d65 --- /dev/null +++ b/packages/omamobile-shell/test/quicksettings-refresh.qml.in @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: MIT +import QtQuick +import QtTest + +TestCase { + id: root + name: "OpenRefreshQueue" + when: windowShown + visible: true + width: 100 + height: 100 + property bool opened: false + property bool editing: false + property var calls: [] + property var times: [] + function record(n) { + calls = calls.concat([n]); + times = times.concat([Date.now()]); + } + function refreshProbe() { + record("probe"); + } + function refreshDnd() { + record("dnd"); + } + function refreshNotifications() { + record("notifications"); + } + QtObject { + id: brightness + function refresh() { + root.record("brightness"); + } + } + QtObject { + id: torch + function refresh() { + root.record("torch"); + } + } + QtObject { + id: rotationLock + function refresh() { + root.record("rotationLock"); + } + } + QtObject { + id: location + function refresh() { + root.record("location"); + } + } + QtObject { + id: nfc + function refresh() { + root.record("nfc"); + } + } + QtObject { + id: fingerprint + function refresh() { + root.record("fingerprint"); + } + } + QtObject { + id: keyboard + function refresh() { + root.record("keyboard"); + } + } + QtObject { + id: clockFormatRead + property bool running: false + onRunningChanged: if (running) { + root.record("clockFormat"); + running = false; + } + } + QtObject { + id: drag + property bool pressed: false + } + QtObject { + id: sheetFlick + property bool moving: false + } + QtObject { + id: pager + property bool moving: false + } + QtObject { + id: editFlick + property bool moving: false + } + QtObject { + id: shadeList + property bool moving: false + } + property real reveal: 0 + NumberAnimation { + id: revealAnimation + target: root + property: "reveal" + from: 0 + to: 1 + duration: 100 + } + SCHEDULER + function init() { + cancelOpenRefresh(); + revealAnimation.stop(); + opened = false; + editing = false; + drag.pressed = false; + sheetFlick.moving = false; + pager.moving = false; + editFlick.moving = false; + shadeList.moving = false; + calls = []; + times = []; + } + function test_settleAndSpacing() { + revealAnimation.start(); + opened = true; + scheduleOpenRefresh(); + wait(50); + compare(calls.length, 0); + tryCompare(revealAnimation, "running", false, 300); + tryCompare(root, "openRefreshIndex", -1, 1500); + compare(calls.join(","), "notifications,dnd,brightness,probe,torch,rotationLock,location,nfc,fingerprint,keyboard,clockFormat"); + for (var i = 1; i < times.length; i++) + verify(times[i] - times[i - 1] >= 25); + } + function test_pauseAndResume() { + opened = true; + scheduleOpenRefresh(); + tryVerify(function () { + return calls.length >= 1; + }, 200); + drag.pressed = true; + var n = calls.length; + wait(130); + compare(calls.length, n); + drag.pressed = false; + tryCompare(root, "openRefreshIndex", -1, 1500); + compare(calls.length, 11); + } + function test_cancelAndCoalesce() { + opened = true; + drag.pressed = true; + scheduleOpenRefresh(); + scheduleOpenRefresh(); + compare(openRefreshIndex, 0); + opened = false; + drag.pressed = false; + wait(150); + compare(calls.length, 0); + compare(openRefreshIndex, -1); + opened = true; + scheduleOpenRefresh(); + scheduleOpenRefresh(); + tryCompare(root, "openRefreshIndex", -1, 1500); + compare(calls.length, 11); + } + function test_actionIsImmediate() { + opened = true; + drag.pressed = true; + scheduleOpenRefresh(); + refreshDnd(); + compare(calls.join(","), "dnd"); + cancelOpenRefresh(); + } + function test_firstScreenReadsAreFirst() { + var started = Date.now(); + revealAnimation.start(); + opened = true; + scheduleOpenRefresh(); + tryVerify(function () { return calls.length >= 3; }, 450); + compare(calls.slice(0, 3).join(","), "notifications,dnd,brightness"); + verify(times[0] - started < 350); + verify(times[0] - started >= 100); + cancelOpenRefresh(); + } + function test_editOpenDoesNotWaitForDone() { + editing = true; + revealAnimation.start(); + opened = true; + scheduleOpenRefresh(); + tryVerify(function () { return calls.length >= 3; }, 450); + compare(calls.slice(0, 3).join(","), "notifications,dnd,brightness"); + verify(editing); + tryCompare(root, "openRefreshIndex", -1, 1500); + compare(calls.length, 11); + } + function test_scrollGates() { + opened = true; + editFlick.moving = true; + scheduleOpenRefresh(); + wait(70); + compare(calls.length, 0); + editFlick.moving = false; + pager.moving = true; + wait(70); + compare(calls.length, 0); + pager.moving = false; + shadeList.moving = true; + wait(70); + compare(calls.length, 0); + shadeList.moving = false; + tryCompare(root, "openRefreshIndex", -1, 1500); + compare(calls.length, 11); + } +} diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 386f42156..22566e5bb 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.109 +0.2.110 From f7c3e6e1b3a0c9631e07e50396490e5a2a1fdf21 Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 01:09:29 +0100 Subject: [PATCH 52/66] omamobile-shell 0.2.111: tick once when the Back gesture arms (#521) * omamobile-shell: tick once when the Back gesture arms Use the same optional feedbackd button-pressed event as the launcher hold. Latch feedback per drag activation so crossing the threshold repeatedly does not request repeated ticks. Recognition, Escape dispatch, retreat semantics, fullscreen exclusion and compositor lock exclusion remain unchanged. Exercise exact source signal handlers in offscreen Qt without invoking feedbackd. Include both edges, inactive changes, re-crossing and retreat. Co-Authored-By: Codex * omamobile-shell: make the Back haptic fixture readable Use normal Python indentation, separate statements and explicit imports. Remove unused json without changing the extracted QML handlers or tested gesture behavior. Six Qt entries pass and removing the latch still fails the once-per-gesture case. Co-Authored-By: Codex * omamobile-shell 0.2.111: the version this lands as --------- Co-authored-by: Codex Co-authored-by: Derek Ross --- .../plugins/omamobile.back/Back.qml | 18 +++- packages/omamobile-shell/test/all | 10 +++ packages/omamobile-shell/test/back-haptic.py | 84 +++++++++++++++++++ packages/omamobile-shell/version | 2 +- 4 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 packages/omamobile-shell/test/back-haptic.py diff --git a/packages/omamobile-shell/plugins/omamobile.back/Back.qml b/packages/omamobile-shell/plugins/omamobile.back/Back.qml index 460094d30..9e1c6d615 100644 --- a/packages/omamobile-shell/plugins/omamobile.back/Back.qml +++ b/packages/omamobile-shell/plugins/omamobile.back/Back.qml @@ -42,6 +42,11 @@ Item { return "ok" } + // Optional feedback uses the same event as the launcher's voice hold. + function haptic() { + Quickshell.execDetached(["sh", "-c", "command -v fbcli >/dev/null 2>&1 && exec fbcli -E button-pressed"]) + } + // `shell call omamobile.back state ''` function state() { return JSON.stringify({ fullscreen: fullscreenOnScreen, strips: !fullscreenOnScreen, edge: edge, threshold: BackModel.THRESHOLD }) @@ -147,9 +152,18 @@ Item { property real atY: 0 property bool wasArmed: false onCentroidChanged: if (active) atY = centroid.position.y - onArmedChanged: if (active) wasArmed = armed + // One threshold tick per gesture, even if the finger crosses back. + property bool feedbackSent: false + onArmedChanged: { + if (!active) return + wasArmed = armed + if (armed && !feedbackSent) { + feedbackSent = true + root.haptic() + } + } onActiveChanged: { - if (active) { atY = centroid.position.y; wasArmed = false; return } + if (active) { atY = centroid.position.y; wasArmed = false; feedbackSent = false; return } console.log("omamobile-back: swipe", win.rightEdge ? "right" : "left", wasArmed ? "back" : "") if (wasArmed) root.back() } diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 0e944b2d0..6746e3fc7 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -1156,3 +1156,13 @@ grep -c 'd355bdb2789f7bd1023d88b17f8a2898dc0ffa2b' widgets/OWL.md >/dev/null || pass "install stages the package" test/keys.sh || fail "omamobile-keys volume keys" + +# Back threshold feedback handler state only; never invoke feedbackd. +rc=0; out=$(python3 -B test/back-haptic.py 2>&1) || rc=$? +if [[ $rc == 77 ]]; then + pass "Back threshold feedback # SKIP no qmltestrunner" +elif [[ $rc != 0 ]]; then + printf '%s\n' "$out" >&2; fail "Back threshold feedback" +else + pass "Back threshold feedback: once per gesture, both edges and retreat" +fi diff --git a/packages/omamobile-shell/test/back-haptic.py b/packages/omamobile-shell/test/back-haptic.py new file mode 100644 index 000000000..eae06b798 --- /dev/null +++ b/packages/omamobile-shell/test/back-haptic.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Exercise exact candidate handlers in Qt; never invoke hardware feedback.""" +import argparse +import os +from pathlib import Path +import shutil +import subprocess +import tempfile + +p = Path(__file__).parent +parser = argparse.ArgumentParser() +parser.add_argument("--negative", action="store_true") +args = parser.parse_args() +source = (p.parent / "plugins/omamobile.back/Back.qml").read_text() + + +def handler(name): + start = source.index(name + ": {") + len(name + ": ") + depth = 0 + for end in range(start, len(source)): + if source[end] == "{": + depth += 1 + elif source[end] == "}": + depth -= 1 + if depth == 0: + return source[start:end + 1] + raise AssertionError("unterminated handler") + + +h = {"armed": handler("onArmedChanged"), "active": handler("onActiveChanged")} +if args.negative: + h["armed"] = h["armed"].replace("armed && !feedbackSent", "armed") + +qml='''import QtQuick +import QtTest +TestCase { + id:root;name:"BackThresholdFeedback";when:windowShown;visible:true;width:100;height:100 + property int ticks:0 + property int backs:0 + function haptic(){ticks++} + function back(){backs++} + QtObject {id:win;property bool rightEdge:false} + QtObject {id:centroid;property point position:Qt.point(0,20)} + QtObject { + id:swipe + property bool active:false + property bool armed:false + property bool wasArmed:false + property bool feedbackSent:false + property real atY:0 + onArmedChanged: ARMED + onActiveChanged: ACTIVE + } + function init(){swipe.armed=false;swipe.active=false;ticks=0;backs=0;win.rightEdge=false} + function test_oncePerGesture(){swipe.active=true;swipe.armed=true;compare(ticks,1);swipe.armed=false;swipe.armed=true;compare(ticks,1);swipe.active=false;compare(backs,1)} + function test_unarmedAndInactive(){swipe.active=true;compare(ticks,0);swipe.active=false;compare(backs,0);swipe.armed=true;compare(ticks,0)} + function test_nextGestureAndBothEdges(){for(var edge=0;edge<2;edge++){win.rightEdge=edge===1;swipe.active=true;swipe.armed=true;compare(ticks,edge+1);swipe.active=false;compare(backs,edge+1);swipe.armed=false}} + function test_retreatBeforeRelease(){swipe.active=true;swipe.armed=true;swipe.armed=false;swipe.active=false;compare(ticks,1);compare(backs,0)} +} +'''.replace('ARMED',h['armed']).replace('ACTIVE',h['active']) +runner = (shutil.which("qmltestrunner6") + or shutil.which("/usr/lib/qt6/bin/qmltestrunner")) +if not runner: + raise SystemExit(77) +with tempfile.TemporaryDirectory(prefix="back-feedback-") as temporary: + directory = Path(temporary) + (directory / "runtime").mkdir(mode=0o700) + (directory / "tst_back.qml").write_text(qml) + env = os.environ.copy() + env.update( + QT_QPA_PLATFORM="offscreen", + QT_QUICK_BACKEND="software", + QT_QPA_PLATFORMTHEME="generic", + XDG_RUNTIME_DIR=str(directory / "runtime"), + ) + env.pop("QT_PLUGIN_PATH", None) + env.pop("QT_QPA_GENERIC_PLUGINS", None) + result = subprocess.run( + [runner, "-input", str(directory / "tst_back.qml")], + env=env, capture_output=True, text=True, timeout=5, + ) + print(result.stdout + result.stderr, end="") + raise SystemExit(result.returncode) diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 22566e5bb..f1245817e 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.110 +0.2.111 From 3734c82bb2c62e84a71fa7c75721949af3ecfa79 Mon Sep 17 00:00:00 2001 From: Gr-linkk Date: Mon, 9 Nov 2026 17:16:53 -0700 Subject: [PATCH 53/66] omamobile-shell 0.2.112: serialize overlapping power-key actions (#508) * omamobile-shell 0.2.102: serialize power key actions A second short press can arrive while the first is still locking and powering the panel off. Serialize short actions so the later press sees the completed transition. Use the captured release time for debounce, and close the lock descriptor in the action subprocess so background helpers cannot keep it held. The focused host regression fails against main with the wrong screen state and passes with this fix, covering wake, debounce, brightness preservation and lock descriptor inheritance. Co-Authored-By: Codex * omamobile-shell 0.2.102: bound the power-key lock wait Drop a short press with a diagnostic after five seconds waiting for the previous action. Keep display transitions serialized without queueing later presses indefinitely behind a stuck helper. The regression fails against the previous unbounded wait and passes with the timeout, preserving debounce/display state and recovering after the holder exits. Restrict its PATH to explicit utilities and desktop stubs. Keep the existing draft version; the maintainer will assign it at merge. Co-Authored-By: Codex --------- Co-authored-by: Gr-linkk <280405187+Gr-linkk@users.noreply.github.com> Co-authored-by: Codex Co-authored-by: Derek Ross --- packages/omamobile-shell/bin/omamobile-keys | 14 ++- packages/omamobile-shell/test/all | 1 + .../omamobile-shell/test/power-overlap.sh | 100 ++++++++++++++++++ packages/omamobile-shell/version | 2 +- 4 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 packages/omamobile-shell/test/power-overlap.sh diff --git a/packages/omamobile-shell/bin/omamobile-keys b/packages/omamobile-shell/bin/omamobile-keys index 861436235..6aece0fd0 100644 --- a/packages/omamobile-shell/bin/omamobile-keys +++ b/packages/omamobile-shell/bin/omamobile-keys @@ -180,7 +180,7 @@ short_press() { # brightness of 0, which left the phone dark on the next wake. A press a # few seconds later must still count: it is the wake. local now last - now=$(date +%s%3N); last=$(cat "$state/last-press" 2>/dev/null || echo 0) + now=$1; last=$(cat "$state/last-press" 2>/dev/null || echo 0) echo "$now" >"$state/last-press" (( now - last < 800 )) && return 0 # The press that woke the phone from sleep, if it gets here at all: @@ -312,7 +312,17 @@ case "${1:-}" in elif [[ -f $state/long ]]; then rm -f "$state/long" else - short_press + # Let a second press observe the finished off transition before it + # decides whether to wake. Keep the lock out of background helpers. + released_at=$(now) + exec {short_lock}>"$state/short.lock" + # A stuck action must not queue every later press forever. Drop this + # press after five seconds rather than overlap display transitions. + if ! flock -w 5 "$short_lock"; then + echo 'omamobile-keys: short-press lock wait failed; dropping press' >&2 + exit 0 + fi + ( short_press "$released_at" ) {short_lock}>&- fi ;; wake) diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 6746e3fc7..bac547012 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -1166,3 +1166,4 @@ elif [[ $rc != 0 ]]; then else pass "Back threshold feedback: once per gesture, both edges and retreat" fi +bash test/power-overlap.sh || fail "overlapping power-key presses" diff --git a/packages/omamobile-shell/test/power-overlap.sh b/packages/omamobile-shell/test/power-overlap.sh new file mode 100644 index 000000000..1b24a40da --- /dev/null +++ b/packages/omamobile-shell/test/power-overlap.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Two presses during a slow lock must leave the phone awake at its old brightness. +set -euo pipefail +here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +t=$(mktemp -d); trap 'rm -rf "$t"' EXIT +mkdir -p "$t/bin" "$t/run" +export XDG_RUNTIME_DIR="$t/run" T="$t" +echo 512 >"$t/brightness"; echo true >"$t/dpms" +cat >"$t/bin/hyprctl" <<'STUB' +#!/bin/bash +printf '[{"dpmsStatus":%s}]\n' "$(cat "$T/dpms")" +STUB +cat >"$t/bin/omarchy-shell" <<'STUB' +#!/bin/bash +[[ $2 == isLocked ]] && echo false +exit 0 +STUB +cat >"$t/bin/omarchy-hw-display" <<'STUB' +#!/bin/bash +echo fake-panel +STUB +cat >"$t/bin/brightnessctl" <<'STUB' +#!/bin/bash +if [[ $* == *get* ]]; then cat "$T/brightness"; else echo "${@: -1}" >"$T/brightness"; fi +STUB +cat >"$t/bin/omarchy-brightness-display" <<'STUB' +#!/bin/bash +case $1 in off) echo false >"$T/dpms";; on) echo true >"$T/dpms";; esac +STUB +cat >"$t/bin/omarchy-system-lock" <<'STUB' +#!/bin/bash +for fd in /proc/$$/fd/*; do + [[ $(readlink "$fd" 2>/dev/null) == "$T/run/omamobile-keys/short.lock" ]] && touch "$T/inherited-lock" +done +touch "$T/locking" +sleep "${LOCK_DELAY:-1.5}" +STUB +cat >"$t/bin/pgrep" <<'STUB' +#!/bin/bash +exit 1 +STUB +chmod +x "$t"/bin/* +# Only these host tools are reachable; unstubbed desktop commands must fail. +for tool in bash cat readlink touch sleep mkdir rm seq grep jq flock date stat timeout; do + ln -s "$(command -v "$tool")" "$t/bin/$tool" +done +export PATH="$t/bin" +keys() { bash "$here/bin/omamobile-keys" "$@"; } +run_case() { + local delay=$1 expected=$2 first second + rm -rf "$t/run/omamobile-keys" + echo 512 >"$t/brightness"; echo true >"$t/dpms" + keys power-down; sleep 0.1; keys power-up & first=$! + sleep "$delay"; keys power-down; sleep 0.1; keys power-up & second=$! + wait "$first"; wait "$second" + [[ ! -e $t/inherited-lock ]] || { echo 'not ok - helper inherited the power-key lock' >&2; exit 1; } + [[ $(cat "$t/dpms") == "$expected" && $(cat "$t/brightness") == 512 ]] || { + echo "not ok - delay $delay produced wrong screen state or brightness" >&2 + exit 1 + } +} +run_case 1 true +run_case 0.2 false +echo 'ok - overlapping presses wake after one second and debounce at 0.2 seconds' + +# A hung lock helper must not queue later presses indefinitely. The second +# press is dropped after five seconds without changing debounce or display. +rm -rf "$t/run/omamobile-keys" +rm -f "$t/locking" +echo 512 >"$t/brightness"; echo true >"$t/dpms" +export LOCK_DELAY=8 +keys power-down; sleep 0.1; keys power-up & first=$! +for _ in {1..100}; do + [[ -e $t/locking ]] && break + sleep 0.05 +done +[[ -e $t/locking ]] || { echo 'not ok - slow action never started' >&2; exit 1; } +last=$(cat "$t/run/omamobile-keys/last-press") +keys power-down; sleep 0.1 +start=$(date +%s%3N) +rc=0 +timeout 7 bash "$here/bin/omamobile-keys" power-up 2>"$t/timeout-log" || rc=$? +elapsed=$(( $(date +%s%3N) - start )) +if [[ $rc != 0 || $elapsed -lt 4500 || $elapsed -ge 7000 ]] || + ! grep -q 'short-press lock wait failed; dropping press' "$t/timeout-log" || + [[ $(cat "$t/run/omamobile-keys/last-press") != "$last" || + $(cat "$t/dpms") != true || $(cat "$t/brightness") != 0 ]]; then + wait "$first" + echo 'not ok - blocked press did not time out without acting' >&2 + exit 1 +fi +wait "$first" +unset LOCK_DELAY +# Once the slow action releases the lock, a fresh press still wakes normally. +keys power-down; sleep 0.1; keys power-up +[[ $(cat "$t/dpms") == true && $(cat "$t/brightness") == 512 ]] || { + echo 'not ok - power key failed to recover after lock release' >&2; exit 1; +} +echo 'ok - blocked press is dropped after five seconds; next press works after release' diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index f1245817e..71b776cdf 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.111 +0.2.112 From 67adcb95b405ac1bfc908ccdd1f7a0f58a312c6c Mon Sep 17 00:00:00 2001 From: kloot Date: Tue, 10 Nov 2026 01:26:08 +0100 Subject: [PATCH 54/66] omamobile-shell 0.2.113: the home strip under the keyboard on the home screen and over the drawer (#557) With the keyboard up on the home screen (the dock's search pill) or over the drawer (its search field), the keyboard covers the dock, and with it the swipe up. The strip wasn't mapped there, so the only way out was the keyboard's Hide key first. While the keyboard is up the strip now shows on the home screen and over the open drawer too. Its swipe up hides the keyboard and opens the drawer from the home screen (as the dock's swipe does), or closes the drawer over it. Over the drawer a long swipe or a hold opens no recent apps: in the first version it did, and the drawer stayed half open over the app picked from them. The dock still reserves nothing on the home screen, so the strip is the only reserving bottom window there. test/pill-touch: the keyboard on home brings the strip (alone), a swipe in it on home opens the drawer and hides the keyboard, and over the drawer it closes the drawer with no recent apps. test/all follows the new condition. Claude-Session: https://claude.ai/code/session_01176vSdGN6JWgiwDLYXe1ES Co-authored-by: den-kloot <1522975+den-kloot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 Co-authored-by: Derek Ross --- .../plugins/omamobile.launcher/Launcher.qml | 26 +++++++++++++---- packages/omamobile-shell/test/all | 5 ++-- packages/omamobile-shell/test/pill-touch | 1 + packages/omamobile-shell/test/pill-touch.qml | 29 ++++++++++++++++++- packages/omamobile-shell/version | 2 +- 5 files changed, 54 insertions(+), 9 deletions(-) diff --git a/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml b/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml index 7bf8562e8..8ccbb3505 100644 --- a/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml +++ b/packages/omamobile-shell/plugins/omamobile.launcher/Launcher.qml @@ -470,7 +470,8 @@ Item { // controls apps keep at the very bottom (the Phone app's Favorites, // Recents, Contacts and Keypad tabs). The zone goes with the window: the // strip isn't mapped on the home screen (the dock reserves its own height - // there), with the drawer open, under the lock screen's keyboard, or for + // there) or with the drawer open, unless the keyboard is up and covers the + // dock; nor under the lock screen's keyboard, or for // a fullscreen window (video, the screensaver), which keeps the whole // screen. Under the lock it isn't drawn (no above_lock rule in // hypr/phone.lua), and the session lock's surface covers the whole screen @@ -667,7 +668,10 @@ Item { // The strip is on screen (each screen's window shows with it), and it is // the keyboard's strip: the keyboard is up above it. - readonly property bool stripShown: appOnScreen && !opened && !fullscreenOnScreen && !(oskOpen && sessionLocked) + // While the keyboard is up the strip shows on the home screen too, and + // over the open drawer (its search field): the keyboard covers the dock + // there, and with it the swipe up to the drawer. + readonly property bool stripShown: (appOnScreen || oskOpen) && (!opened || oskOpen) && !fullscreenOnScreen && !(oskOpen && sessionLocked) readonly property bool keyboardStripShown: stripShown && oskOpen Process { @@ -1224,7 +1228,9 @@ Item { property bool recents: false onActiveTranslationChanged: { swipeY = activeTranslation.y - if (recents) return + // Over the open drawer a swipe only closes it: recent apps from + // there left the drawer half open over the next app. + if (recents || root.opened) return if (swipeY < -120) { recents = true hold.stop() @@ -1237,7 +1243,17 @@ Item { if (active) { swipeY = 0; recents = false; return } hold.stop() console.log("omamobile-home-indicator: swipe", Math.round(swipeY), recents ? "recents" : "", "(" + swipeArea.strip + ")") - if (!recents && swipeY < -24) root.goHome() + if (!recents && swipeY < -24 && root.opened) { + // Over the drawer (searching): the keyboard goes and the drawer + // closes, back to the home screen. + root.keyboardCall("hideKeyboard") + root.dismiss(0) + } else if (!recents && swipeY < -24 && !root.appOnScreen) { + // On the home screen (the keyboard's strip, no app): the drawer + // opens, as the dock's swipe does, and the keyboard goes. + root.keyboardCall("hideKeyboard") + root.expand() + } else if (!recents && swipeY < -24) root.goHome() } } @@ -1245,7 +1261,7 @@ Item { id: hold interval: 350 onTriggered: { - if (!swipe.active || swipe.recents) return + if (!swipe.active || swipe.recents || root.opened) return swipe.recents = true root.showRecents() } diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index bac547012..fc58d8298 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -145,7 +145,7 @@ def vis(w): v = re.sub(r"(^|[^.\w])(\w+)", lambda x: x.group(1) + ("root." + x.group(2) if x.group(2) not in ("true", "false") else x.group(2)), d) return v v = vis(strip) -for need in ("root.appOnScreen", "!root.opened", "!root.fullscreenOnScreen", "!(root.oskOpen && root.sessionLocked)"): +for need in ("(root.appOnScreen || root.oskOpen)", "(!root.opened || root.oskOpen)", "!root.fullscreenOnScreen", "!(root.oskOpen && root.sessionLocked)"): assert need in v, (need, v) assert "!root.oskOpen" not in v, "the keyboard doesn't unmap the strip: " + v assert "!root.appOnScreen" in vis(dock), "the dock and the strip never reserve together" @@ -174,7 +174,8 @@ elif [[ $rc != 0 ]]; then else pass "the home pill under touch: a double tap toggles the keyboard, a tap does nothing, swipes go home, the hide key, the reserved strip, the search pill, the hold for voice" fi -grep -c 'if (!recents && swipeY < -24) root.goHome()' "$l" >/dev/null || fail "a short swipe goes home" +grep -c '} else if (!recents && swipeY < -24) root.goHome()' "$l" >/dev/null || fail "a short swipe goes home" +grep -c 'if (recents || root.opened) return' "$l" >/dev/null || fail "over the drawer a swipe opens no recent apps" grep -c 'if (swipeY < -120) {' "$l" >/dev/null || fail "a long swipe opens recent apps" # Drawer: pull down to close, and a pull is not also a tap on an app. grep -c 'if (LauncherModel.drawerEndsOpen(root.progress, speed, true)) root.settleTo(true, speed)' "$l" >/dev/null || fail "pulling the drawer down closes it" diff --git a/packages/omamobile-shell/test/pill-touch b/packages/omamobile-shell/test/pill-touch index cf6ab0185..494d2d6cc 100755 --- a/packages/omamobile-shell/test/pill-touch +++ b/packages/omamobile-shell/test/pill-touch @@ -115,6 +115,7 @@ Item { readonly property string agentName: "" readonly property color foreground: "#c0caf5" function expand() { Quickshell.execDetached(["expand"]) } + function dismiss(speed) { Quickshell.execDetached(["dismiss"]) } %s diff --git a/packages/omamobile-shell/test/pill-touch.qml b/packages/omamobile-shell/test/pill-touch.qml index 01e124c37..6c34f5422 100644 --- a/packages/omamobile-shell/test/pill-touch.qml +++ b/packages/omamobile-shell/test/pill-touch.qml @@ -236,7 +236,14 @@ Item { var z = zones({}) compare(z.total, 0, JSON.stringify(z)) compare(zones({ drawer: true }).total, 0, "nor with the drawer open") - compare(zones({ osk: true }).strip, 0, "nor the strip with the keyboard on home") + } + + function test_the_keyboard_on_home_brings_the_strip() { + // The keyboard covers the dock (and its swipe) on the home screen and + // over the drawer's search, so the strip comes back above it there. + compare(zones({ osk: true }).strip, harness.touch, "the keyboard on home") + compare(zones({ drawer: true, osk: true }).strip, harness.touch, "the keyboard over the drawer") + compare(zones({ osk: true }).reserving, 1, "the strip alone") } function test_a_fullscreen_window_keeps_the_whole_screen() { @@ -297,6 +304,26 @@ Item { compare(calls("hl.dsp.focus"), 0) } + function test_swipe_in_the_keyboard_strip_on_home_opens_the_drawer() { + zones({ osk: true }) + var strip = find(harness, "keyboardStrip") + swipeUp(strip, 60, strip.height / 2) + compare(calls("expand"), 1, JSON.stringify(Quickshell.executed)) + compare(keyboardCalls("hideKeyboard"), 1, "the keyboard goes") + compare(calls("hl.dsp.focus"), 0, "not home: already there") + zones({ app: true, osk: true }) + } + + function test_swipe_in_the_keyboard_strip_over_the_drawer_closes_it() { + zones({ drawer: true, osk: true }) + var strip = find(harness, "keyboardStrip") + swipeUp(strip, 60, strip.height / 2) + compare(calls("dismiss"), 1, JSON.stringify(Quickshell.executed)) + compare(keyboardCalls("hideKeyboard"), 1, "the keyboard goes") + compare(calls("omamobile.switcher"), 0, "no recent apps over the drawer") + zones({ app: true, osk: true }) + } + function test_swipe_in_the_keyboard_strip_goes_home() { var strip = find(harness, "keyboardStrip") swipeUp(strip, 60, strip.height / 2) diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 71b776cdf..4a3b5c363 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.112 +0.2.113 From d47c90bab3f932ad555abff135710b62a7484608 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Mon, 9 Nov 2026 18:30:20 -0700 Subject: [PATCH 55/66] omamobile-gnss 0.2.8: keep the hang marker through shutdown (#462) * omamobile-gnss 0.2.8: keep the hang marker through shutdown Clear the 9a marker only after systemd has stopped the GNSS service cleanly. A failed stop or unexpected exit retains it so a later location request cannot repeat a hang. * omamobile-gnss: on the 9a, --retry by hand clears the marker and says what starts GNSS Run by hand, omamobile-gnss-start --retry cleared the hang marker and then refused with "no systemd invocation ID", and the skip message read as if --retry started GNSS. On the 9a it now says that the marker is cleared and that the next location request starts GNSS, in its unit; the skip message says the same. The 7 Pro's messages are unchanged. The test covers the by-hand retry: marker gone, nothing started. * omamobile-gnss: the skip messages give the retry's full path omamobile-gnss-start lives in /usr/lib/omamobile-vendor, not on PATH, so the two 9a messages that name its --retry now give the path. --- .../omamobile-gnss/lib/omamobile-gnss-start | 54 ++++++++++++++----- packages/omamobile-gnss/test/all | 41 +++++++++++--- .../systemd/system/omamobile-gnss.service | 1 + packages/omamobile-gnss/version | 2 +- 4 files changed, 78 insertions(+), 20 deletions(-) diff --git a/packages/omamobile-gnss/lib/omamobile-gnss-start b/packages/omamobile-gnss/lib/omamobile-gnss-start index e94a31516..b7e42e42a 100755 --- a/packages/omamobile-gnss/lib/omamobile-gnss-start +++ b/packages/omamobile-gnss/lib/omamobile-gnss-start @@ -13,31 +13,57 @@ MARK=/var/lib/omamobile/gnss-bringup-started # The 9a's session of this boot: written with the marker, in /run so that a # reset empties it. SESSION=/run/omamobile-gnss/session +STOP_REQUEST=/run/omamobile-gnss/stop-request say() { printf 'omamobile-gnss: %s\n' "$*" >&2; } # the Pixel 9a (zumapro-tegu) runs the gnss-slsi profile, the Pixel 7 Pro gnss # OMAMOBILE_DT lets the tests run both branches on any machine (as # omamobile-setup-user does). tegu() { tr -d '\0' < "${OMAMOBILE_DT:-/proc/device-tree}/compatible" 2>/dev/null | grep -c 'google,zumapro-tegu' >/dev/null; } -if [[ ${1:-} == --stop ]]; then - # A clean stop is the only place the 9a's marker is cleared: its session - # runs in the foreground until then, so a reset in between leaves the - # marker and the next boot skips GNSS until --retry. Only a session of - # this boot clears it: systemd runs ExecStop after a start that skipped - # on a leftover marker too, and that stop must leave the marker alone. - # The 7 Pro's start clears its own marker once the driver is up. - if [[ -e $SESSION ]]; then - rm -f "$MARK" "$SESSION" - sync +own_session() { + [[ ${INVOCATION_ID:-} =~ ^[0-9a-f]{32}$ && -f $SESSION && ! -L $SESSION ]] && + [[ $(cat "$SESSION") == "$INVOCATION_ID" ]] +} +if [[ ${1:-} == --stopped ]]; then + # ExecStopPost runs after systemd has stopped the service processes. A + # failed start, crash, or timed-out stop must leave the persistent marker. + if tegu && own_session; then + if [[ ${SERVICE_RESULT:-} == success && -f $STOP_REQUEST && ! -L $STOP_REQUEST ]] && + [[ $(cat "$STOP_REQUEST") == "$INVOCATION_ID" ]]; then + rm -f "$MARK" + sync + fi + rm -f "$SESSION" "$STOP_REQUEST" fi + exit 0 +fi +if [[ ${1:-} == --stop ]]; then if tegu; then profile=gnss-slsi; else profile=gnss; fi + # ExecStop also runs after an unexpected exit. Only a still-running main + # process belonging to this invocation can request marker cleanup. + if [[ $profile == gnss-slsi ]] && own_session && + [[ ${SERVICE_RESULT:-} == success && ${MAINPID:-} =~ ^[1-9][0-9]*$ ]]; then + /usr/lib/omamobile-vendor/omamobile-vendor-chroot "$profile" stop + printf '%s\n' "$INVOCATION_ID" > "$STOP_REQUEST" + exit 0 + fi exec /usr/lib/omamobile-vendor/omamobile-vendor-chroot "$profile" stop fi if [[ ${1:-} == --retry ]]; then rm -f "$MARK" + # By hand on the 9a this only clears the marker: GNSS starts inside its + # unit, at the next location request (the session needs the invocation ID). + if tegu && ! [[ ${INVOCATION_ID:-} =~ ^[0-9a-f]{32}$ ]]; then + say "marker cleared; the next location request starts GNSS" + exit 0 + fi elif [[ -e $MARK ]]; then - say "the last bring-up ($(cat "$MARK")) never finished; skipping GNSS (run omamobile-gnss-start --retry)" + if tegu; then + say "the last bring-up ($(cat "$MARK")) never finished; skipping GNSS (/usr/lib/omamobile-vendor/omamobile-gnss-start --retry clears the marker; the next location request then starts GNSS)" + else + say "the last bring-up ($(cat "$MARK")) never finished; skipping GNSS (run /usr/lib/omamobile-vendor/omamobile-gnss-start --retry)" + fi exit 0 fi @@ -53,10 +79,12 @@ if tegu; then # a session on the 9a can still hang the SoC with the modem up # (MODEM-PLAN G3-L1), and socket activation lets any GeoClue client start # one: without the marker a hang could repeat at every boot. It is - # cleared by --stop, not here, since this exec never returns. + # cleared only after a clean stop, not here, since this exec never returns. + [[ ${INVOCATION_ID:-} =~ ^[0-9a-f]{32}$ ]] || { say "no systemd invocation ID; refusing GNSS"; exit 1; } mkdir -p "$(dirname "$MARK")" "$(dirname "$SESSION")" + rm -f "$STOP_REQUEST" date -Is > "$MARK" - : > "$SESSION" + printf '%s\n' "$INVOCATION_ID" > "$SESSION" sync say "starting the 9a's GNSS HAL and client" OMAMOBILE_GNSS_NMEA_OUT=fifo exec /usr/lib/omamobile-vendor/omamobile-vendor-chroot gnss-slsi start diff --git a/packages/omamobile-gnss/test/all b/packages/omamobile-gnss/test/all index c6093a1bd..bf1ec0725 100755 --- a/packages/omamobile-gnss/test/all +++ b/packages/omamobile-gnss/test/all @@ -12,10 +12,9 @@ done python3 -c 'import ast, sys; ast.parse(open(sys.argv[1]).read())' lib/omamobile-gnss-nmea || fail "python: omamobile-gnss-nmea" # The Pixel 9a's path: gnss-slsi from the start script, its FIFO in the bridge and the units. grep -c 'gnss-slsi start' lib/omamobile-gnss-start >/dev/null || fail "the 9a starts gnss-slsi" -# the 9a writes the hang marker before its session and clears it only in --stop +# The 9a writes the hang marker before its session and clears it after a clean stop. s=lib/omamobile-gnss-start [[ $(grep -n 'date -Is > "\$MARK"' $s | head -1 | cut -d: -f1) -lt $(grep -n 'gnss-slsi start' $s | head -1 | cut -d: -f1) ]] || fail "the 9a's marker goes down before gnss-slsi start" -[[ $(grep -n 'rm -f "\$MARK" "\$SESSION"' $s | head -1 | cut -d: -f1) -lt $(grep -n 'profile.*stop' $s | head -1 | cut -d: -f1) ]] || fail "--stop clears the marker" grep -c 'OMAMOBILE_DT:-/proc/device-tree' $s >/dev/null || fail "the compatible is read through an overridable path" # both branches, with a fake device tree and a stub chroot: the 9a path writes # the marker and runs gnss-slsi, the 7 Pro path neither (no SPI5 node here) @@ -24,14 +23,17 @@ printf 'google,zumapro-tegu\0google,zumapro\0' > "$tmp/dt/compatible" cat > "$tmp/stub" <<'EOF' #!/bin/sh echo "chroot $*" >> "${STUB_LOG}" +[ "${STUB_FAIL:-0}" != 1 ] || [ "$2" != stop ] EOF chmod +x "$tmp/stub" run_start() { # $1 dt dir, $2 fake unix table - STUB_LOG="$tmp/log" OMAMOBILE_DT="$1" bash -c ' + STUB_LOG="$tmp/log" OMAMOBILE_DT="$1" INVOCATION_ID="${TEST_INVOCATION_ID-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}" \ + SERVICE_RESULT="${TEST_SERVICE_RESULT:-success}" MAINPID="${TEST_MAINPID-123}" STUB_FAIL="${TEST_STUB_FAIL:-0}" bash -c ' MARKDIR='"$tmp"'/var/lib/omamobile sed -e "s|/var/lib/omamobile/gnss-bringup-started|'"$tmp"'/var/lib/omamobile/gnss-bringup-started|" \ -e "s|/proc/net/unix|'"$2"'|" \ -e "s|/run/omamobile-gnss/session|'"$tmp"'/run/omamobile-gnss/session|" \ + -e "s|/run/omamobile-gnss/stop-request|'"$tmp"'/run/omamobile-gnss/stop-request|" \ -e "s|/sys/firmware/devicetree/base/soc@0/usi@109400c0/spi@10940000/status|'"$tmp"'/no-spi5|" \ -e "s|/usr/lib/omamobile-vendor/omamobile-vendor-chroot|'"$tmp"'/stub|" lib/omamobile-gnss-start > '"$tmp"'/start bash '"$tmp"'/start "$@"' _ "${3:-}" 2>/dev/null @@ -48,21 +50,48 @@ rm -rf "$tmp/run" run_start "$tmp/dt" "$tmp/unix" --stop [[ -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "a stop after a skipped start cleared the leftover marker" grep -c 'chroot gnss-slsi stop' "$tmp/log" >/dev/null || fail "9a branch: --stop stops gnss-slsi" -# a session of this boot: --stop clears the marker and the session file +# A clean stop keeps the marker until the processes have actually stopped. run_start "$tmp/dt" "$tmp/unix" --retry [[ -e "$tmp/run/omamobile-gnss/session" ]] || fail "9a branch: the session file is written with the marker" run_start "$tmp/dt" "$tmp/unix" --stop -[[ ! -e "$tmp/var/lib/omamobile/gnss-bringup-started" && ! -e "$tmp/run/omamobile-gnss/session" ]] || fail "--stop after a session clears the marker" +[[ -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "--stop cleared the marker before service exit" +run_start "$tmp/dt" "$tmp/unix" --stopped +[[ ! -e "$tmp/var/lib/omamobile/gnss-bringup-started" && ! -e "$tmp/run/omamobile-gnss/session" ]] || fail "clean stop did not clear the marker" +# A timeout or an unexpected exit leaves the marker, including on the next start. +run_start "$tmp/dt" "$tmp/unix" +run_start "$tmp/dt" "$tmp/unix" --stop +TEST_SERVICE_RESULT=timeout run_start "$tmp/dt" "$tmp/unix" --stopped +[[ -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "timed-out stop cleared the marker" +TEST_INVOCATION_ID=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb run_start "$tmp/dt" "$tmp/unix" +TEST_INVOCATION_ID=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb run_start "$tmp/dt" "$tmp/unix" --stop +TEST_INVOCATION_ID=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb run_start "$tmp/dt" "$tmp/unix" --stopped +[[ -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "a later skipped start cleared the marker" +run_start "$tmp/dt" "$tmp/unix" --retry +TEST_MAINPID= run_start "$tmp/dt" "$tmp/unix" --stop +run_start "$tmp/dt" "$tmp/unix" --stopped +[[ -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "an unexpected exit cleared the marker" +run_start "$tmp/dt" "$tmp/unix" --retry +if TEST_STUB_FAIL=1 run_start "$tmp/dt" "$tmp/unix" --stop; then fail "failed profile stop succeeded"; fi +TEST_SERVICE_RESULT=exit-code run_start "$tmp/dt" "$tmp/unix" --stopped +[[ -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "a failed profile stop cleared the marker" +# --retry by hand on the 9a (no invocation ID) only clears the marker; the +# next location request starts GNSS in its unit, so nothing starts here. +: > "$tmp/log" +TEST_INVOCATION_ID= run_start "$tmp/dt" "$tmp/unix" --retry || fail "9a branch: --retry by hand failed" +[[ ! -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "9a branch: --retry by hand left the marker" +grep -c 'gnss-slsi start' "$tmp/log" >/dev/null && fail "9a branch: --retry by hand started GNSS outside its unit" +rm -f "$tmp/var/lib/omamobile/gnss-bringup-started" : > "$tmp/log"; printf 'google,gs201-cheetah\0google,gs201\0' > "$tmp/dt/compatible" run_start "$tmp/dt" "$tmp/unix" grep -c 'gnss-slsi' "$tmp/log" >/dev/null && fail "7 Pro branch: must not touch gnss-slsi" [[ ! -e "$tmp/var/lib/omamobile/gnss-bringup-started" ]] || fail "7 Pro branch: no SPI5 node here, so no marker" rm -rf "$tmp" -echo "ok - the 9a's start writes the marker, --stop clears it, both branches behave" +echo "ok - the 9a's marker survives failed stops and clears only after a clean stop" grep -c 'OMAMOBILE_GNSS_NMEA_OUT=fifo' lib/omamobile-gnss-start >/dev/null || fail "the 9a's NMEA goes to the FIFO" grep -c 'gnss-slsi/data/vendor/gps/nmea_out' lib/omamobile-gnss-nmea >/dev/null || fail "the bridge reads the 9a's FIFO" grep -c '^ConditionPathExists=|/usr/lib/omamobile-vendor/gnss-slsi/root$' vendor/systemd/system/omamobile-gnss.service >/dev/null || fail "the service runs with the 9a's image" grep -c '^ExecStop=/usr/lib/omamobile-vendor/omamobile-gnss-start --stop$' vendor/systemd/system/omamobile-gnss.service >/dev/null || fail "stop picks the profile" +grep -qx '^ExecStopPost=/usr/lib/omamobile-vendor/omamobile-gnss-start --stopped$' vendor/systemd/system/omamobile-gnss.service || fail "post-stop checks the marker" grep -c 'gnss-slsi/data/vendor/gps' vendor/systemd/system/omamobile-gnss-nmea.service >/dev/null || fail "the bridge may open the 9a's FIFO" # --stop comes before the hang marker, so a leftover marker never skips a stop [[ $(grep -n -- '--stop' lib/omamobile-gnss-start | head -1 | cut -d: -f1) -lt $(grep -n 'elif \[\[ -e \$MARK' lib/omamobile-gnss-start | cut -d: -f1) ]] || fail "--stop before the marker" diff --git a/packages/omamobile-gnss/vendor/systemd/system/omamobile-gnss.service b/packages/omamobile-gnss/vendor/systemd/system/omamobile-gnss.service index db62762d2..355a6e6fc 100644 --- a/packages/omamobile-gnss/vendor/systemd/system/omamobile-gnss.service +++ b/packages/omamobile-gnss/vendor/systemd/system/omamobile-gnss.service @@ -19,4 +19,5 @@ ExecStart=/usr/bin/systemd-inhibit --what=sleep --mode=block "--who=Omarchy Mobi # Before the stop signal: ask gpsd to end its request, so it saves its # state (gldata.sto) for the next start. Bounded at ~4 s. ExecStop=/usr/lib/omamobile-vendor/omamobile-gnss-start --stop +ExecStopPost=/usr/lib/omamobile-vendor/omamobile-gnss-start --stopped TimeoutStopSec=15 diff --git a/packages/omamobile-gnss/version b/packages/omamobile-gnss/version index b0032849c..a45be4627 100644 --- a/packages/omamobile-gnss/version +++ b/packages/omamobile-gnss/version @@ -1 +1 @@ -0.2.7 +0.2.8 From 8c7bf83b08b9f125c530cdd49843930717732efe Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:30:24 +0100 Subject: [PATCH 56/66] omamobile-modem 0.1.17: a device-provided, data-only ordered link stack (#568) A device package can give omamobile-modem its own ordered list of link modules (link.conf). The file is read as data, never sourced: it is refused, before the sleep inhibitor and the bring-up latch, when it is a symlink, holds a NUL or other binary byte, or names anything but module names and their parameters. Without the file the starter loads what it loaded before; the Pixel 7 Pro's path is unchanged (pcie-gs201-cp allow_hw=1). --- packages/omamobile-modem/README.md | 34 +++ packages/omamobile-modem/install | 4 + .../omamobile-modem/lib/omamobile-modem-start | 61 +++++- packages/omamobile-modem/test/all | 11 +- packages/omamobile-modem/test/test_link.py | 204 ++++++++++++++++++ packages/omamobile-modem/version | 2 +- 6 files changed, 304 insertions(+), 12 deletions(-) create mode 100644 packages/omamobile-modem/README.md create mode 100644 packages/omamobile-modem/test/test_link.py diff --git a/packages/omamobile-modem/README.md b/packages/omamobile-modem/README.md new file mode 100644 index 000000000..30405c55d --- /dev/null +++ b/packages/omamobile-modem/README.md @@ -0,0 +1,34 @@ + +# Modem link modules + +The default link remains `modprobe pcie-gs201-cp allow_hw=1` when no device +configuration exists. The Pixel 9 Pro XL needs a separate PHY before its PCIe +host; its device package may supply the ordered list as +`/usr/lib/omamobile-modem/link.conf`. This directory is staged by this package +and is separate from extracted vendor files. This package does not install +link.conf or enable another device's drivers. The device package owns its file. + +The file is data, never a shell fragment. Each nonempty, noncomment line is: + +``` +module key=value key=value +``` + +A module starts with an ASCII letter and contains only letters, digits, +underscores and hyphens. Parameter names start with a letter or underscore; +remaining characters are letters, digits or underscores. Values are nonempty +and contain only letters, digits, underscore, period, comma, colon, plus, +slash or hyphen. Arguments are separated by spaces or tabs; a module without +parameters is valid. Blank lines and whole-line comments are allowed. Shell +quotes, substitutions, assignments, functions, options and inline comments +are refused, as are empty configurations, symlinks and unreadable/nonregular +files. A raw ASCII-text check rejects NUL and other non-text bytes before +Bash reads lines; both passes use the same opened file. A missing file preserves the default; a present invalid file refuses. + +All entries are validated before checking already-loaded parameters, checking +the sleep inhibitor, creating the bring-up latch or loading modules. Missing +or mismatched parameters on loaded modules still require a reboot; the +configuration cannot reassign MARK/HOLD or redefine refuse. The normal marker, +unclean-stop and hold decisions remain unchanged. Device-specific configuration +does not authorize starting a modem or replace its watchdog/backup/recovery +qualification. The maintainer allocates the package version at merge. diff --git a/packages/omamobile-modem/install b/packages/omamobile-modem/install index 91a1006d4..ebf06f7e1 100755 --- a/packages/omamobile-modem/install +++ b/packages/omamobile-modem/install @@ -12,6 +12,9 @@ set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")" d=${1:?Usage: ./install DESTDIR} [[ $d == /* && $d != "/" ]] || { echo "Use an absolute staging directory" >&2; exit 1; } +# Device packages may install a data-only link.conf here. Vendor extraction +# never populates this directory; no config is needed for the gs201 default. +install -dm755 "$d/usr/lib/omamobile-modem" v=$d/usr/lib/omamobile-vendor install -Dm755 lib/omamobile-modem-start "$v/omamobile-modem-start" install -Dm755 lib/omamobile-modem-cp "$v/omamobile-modem-cp" @@ -25,5 +28,6 @@ for u in omamobile-modem.service omamobile-modem-inhibit.service omamobile-modem done install -Dm644 udev/60-omamobile-modem-nv-ro.rules "$d/usr/lib/udev/rules.d/60-omamobile-modem-nv-ro.rules" install -Dm644 udev/61-omamobile-vendor-udisks-ignore.rules "$d/usr/lib/udev/rules.d/61-omamobile-vendor-udisks-ignore.rules" +install -Dm644 README.md "$d/usr/share/doc/omamobile-modem/README.md" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-modem/LICENSE" install -Dm644 version "$d/usr/share/omamobile/modem/version" diff --git a/packages/omamobile-modem/lib/omamobile-modem-start b/packages/omamobile-modem/lib/omamobile-modem-start index aea70393d..8b90ad187 100755 --- a/packages/omamobile-modem/lib/omamobile-modem-start +++ b/packages/omamobile-modem/lib/omamobile-modem-start @@ -151,13 +151,57 @@ if [[ ${OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS:-} == 1 ]]; then exit 0 fi +# The Pixel 9 Pro XL needs its PHY loaded before its PCIe host. Device +# packages can provide this ordered, data-only list outside vendor extraction. +# Without a file, retain the Pixel 7 Pro's existing gs201 invocation. +LINK_CONFIG=/usr/lib/omamobile-modem/link.conf +LINK_MODULES=("pcie-gs201-cp allow_hw=1") +read_link_config() { + local path=$1 entry config_fd LC_ALL=C + [[ -e $path || -L $path ]] || return 0 + [[ -f $path && -r $path && ! -L $path ]] || refuse "Off: invalid link configuration" + # Bash read discards NUL bytes. Reject binary/non-ASCII bytes first, + # through the same opened file, before read can normalize their contents. + exec {config_fd}< "$path" || refuse "Off: invalid link configuration" + if LC_ALL=C grep -aq '[^[:print:][:blank:]]' "/proc/self/fd/$config_fd"; then + refuse "Off: invalid link configuration" + else + [[ $? == 1 ]] || refuse "Off: invalid link configuration" + fi + LINK_MODULES=() + while IFS= read -r entry || [[ -n $entry ]]; do + [[ $entry =~ ^[[:blank:]]*$ || $entry =~ ^[[:blank:]]*# ]] && continue + # A module followed by zero or more key=value arguments. No shell syntax, + # quotes, substitutions, options or inline comments are accepted. + [[ $entry =~ ^[a-zA-Z][a-zA-Z0-9_-]*([[:blank:]]+[a-zA-Z_][a-zA-Z0-9_]*=[a-zA-Z0-9_.,:+/-]+)*[[:blank:]]*$ ]] || + refuse "Off: invalid link configuration" + LINK_MODULES+=("$entry") + done <&"$config_fd" + exec {config_fd}<&- + ((${#LINK_MODULES[@]})) || refuse "Off: empty link configuration" +} +read_link_config "$LINK_CONFIG" + # The link driver must allow hardware access, or cbd's power-on is refused -# (-EPERM). allow_hw is fixed at load time: a copy loaded without it (by -# hand, M3.3-B) needs a reboot. -if [[ -d /sys/module/pcie_gs201_cp ]]; then - [[ $(cat /sys/module/pcie_gs201_cp/parameters/allow_hw) == Y ]] || - { say "pcie_gs201_cp is loaded without allow_hw=1: reboot first"; refuse "Off: reboot needed"; } -fi +# (-EPERM), and parameters are fixed at load time: a copy already loaded +# with other values (by hand, M3.3-B, or a hardware-disabled test this boot) +# needs a reboot. Booleans read back as Y/N. +link_param_ok() { + local mod=$1 kv=$2 key val have + key=${kv%%=*} val=${kv#*=} + [[ -r /sys/module/$mod/parameters/$key ]] || return 1 + have=$(cat "/sys/module/$mod/parameters/$key") + [[ $have == "$val" ]] || { [[ $val == 1 && $have == Y ]]; } || { [[ $val == 0 && $have == N ]]; } +} +for entry in "${LINK_MODULES[@]}"; do + read -r -a words <<< "$entry" + mod=${words[0]//-/_} + [[ -d /sys/module/$mod ]] || continue + for kv in "${words[@]:1}"; do + link_param_ok "$mod" "$kv" || + { say "$mod is loaded without $kv: reboot first"; refuse "Off: reboot needed"; } + done +done # The sleep inhibitor before the drivers: the unit requires and orders after # omamobile-modem-inhibit.service, but a Type=simple unit is "started" at @@ -178,7 +222,10 @@ sync # CPIF and the regions are blacklisted by the device's modem policy (the # package providing omamobile-modem-policy): only this loads them. Never # unload cpif (it is permanent by design). -modprobe pcie-gs201-cp allow_hw=1 +for entry in "${LINK_MODULES[@]}"; do + read -r -a words <<< "$entry" + modprobe "${words[@]}" +done modprobe shm_ipc modprobe cpif # The link to the modem with ASPM off, as every link test so far ran diff --git a/packages/omamobile-modem/test/all b/packages/omamobile-modem/test/all index 1676089a0..239a8d599 100755 --- a/packages/omamobile-modem/test/all +++ b/packages/omamobile-modem/test/all @@ -16,6 +16,7 @@ if command -v shellcheck >/dev/null; then shellcheck -S warning lib/omamobile-modem-start install || fail "shellcheck" fi pass "scripts parse" +python3 test/test_link.py || fail "device link module parameters and load order" # spawn_optional keeps its job alive whatever the daemon's exit: run the # function from modem.conf under the library's errexit and pipefail with a @@ -84,7 +85,9 @@ pass "NV checksums" stage=$t/stage ./install "$stage" -for f in usr/lib/omamobile-vendor/omamobile-modem-start usr/lib/omamobile-vendor/omamobile-modem-cp \ +[[ -d $stage/usr/lib/omamobile-modem ]] || fail "package-owned link configuration directory" +[[ ! -e $stage/usr/lib/omamobile-modem/link.conf ]] || fail "default needs no device link configuration" +for f in usr/share/doc/omamobile-modem/README.md usr/lib/omamobile-vendor/omamobile-modem-start usr/lib/omamobile-vendor/omamobile-modem-cp \ usr/lib/omamobile-vendor/profiles/modem.conf usr/lib/omamobile-vendor/modem/props.conf \ usr/lib/systemd/system/omamobile-modem.service usr/lib/udev/rules.d/60-omamobile-modem-nv-ro.rules \ usr/lib/omamobile-vendor/omamobile-modem-nv-overlay usr/bin/omamobile-modem \ @@ -165,7 +168,7 @@ s=lib/omamobile-modem-start lineof() { grep -n "$1" $s | head -1 | cut -d: -f1; } l_prov_refuse=$(lineof "isn't provisioned"); l_mark_refuse=$(lineof 'never reached ONLINE; skipping'); l_up_refuse=$(lineof 'refuse_unclean$') l_inhibit=$(lineof 'no sleep inhibitor held'); l_latch=$(lineof '> "\$MARK"'); l_latch_sync=$(awk -v n="$l_latch" 'NR == n + 1' $s) -l_modprobe=$(lineof '^modprobe '); l_check=$(lineof 'omamobile-vendor-chroot" modem check'); l_rm=$(lineof '^ rm -f "\$MARK"') +l_modprobe=$(lineof '^[[:space:]]*modprobe '); l_check=$(lineof 'omamobile-vendor-chroot" modem check'); l_rm=$(lineof '^ rm -f "\$MARK"') l_ready=$(lineof 'systemd-notify --ready'); l_exec=$(lineof 'exec "\$LIB/omamobile-vendor-chroot" modem start') l_reason_rm=$(lineof '^rm -f "\$REFUSED"') for v in l_prov_refuse l_mark_refuse l_up_refuse l_inhibit l_reason_rm l_latch l_modprobe l_check l_rm l_ready l_exec; do @@ -175,7 +178,7 @@ done [[ $l_prov_refuse -lt $l_mark_refuse && $l_mark_refuse -lt $l_up_refuse && $l_up_refuse -lt $l_inhibit && $l_inhibit -lt $l_reason_rm && $l_reason_rm -lt $l_latch && $l_latch -lt $l_modprobe && $l_modprobe -lt $l_check && $l_check -lt $l_rm && $l_rm -lt $l_ready && $l_ready -lt $l_exec ]] || fail "start script order: refuse($l_prov_refuse,$l_mark_refuse,$l_up_refuse) inhibit($l_inhibit) reason-rm($l_reason_rm) latch($l_latch) modprobe($l_modprobe) check($l_check) rm($l_rm) ready($l_ready) exec($l_exec)" -[[ $(grep -c '^modprobe ' $s) -eq 3 && $(grep -c 'modprobe' <(sed -n "1,${l_latch}p" $s) ) -eq 0 ]] || +[[ $(grep -c '^[[:space:]]*modprobe ' $s) -eq 3 && $(grep -c 'modprobe' <(sed -n "1,${l_latch}p" $s) ) -eq 0 ]] || fail "no modprobe before the latch" grep -q 'OMAMOBILE_MODEM_MARK=\$MARK OMAMOBILE_MODEM_UP_MARK=\${INVOCATION_ID:+\$UP} exec' $s || fail "both markers go to the profile's watcher (the modem-up one only under the unit)" grep -q "OMAMOBILE_MODEM_UP_MARK" $cp || fail "the watcher writes the modem-up marker" @@ -201,7 +204,7 @@ past() { OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS=1 start "$@"; } stop_line='past the marker checks, stopping here (test only)' ! grep -rq 'OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS' systemd install || fail "the test stop point is set by no unit or install step" l_stop=$(lineof 'OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS:-') -[[ $l_up_refuse -lt $l_stop && $l_stop -lt $(lineof '/sys/module/pcie_gs201_cp') && $l_stop -lt $l_inhibit && $l_stop -lt $l_latch ]] || +[[ $l_up_refuse -lt $l_stop && $l_stop -lt $(lineof '^link_param_ok()') && $l_stop -lt $l_inhibit && $l_stop -lt $l_latch ]] || fail "the test stop point sits after the marker decision and before the sysfs read, the inhibitor and the latch (stop=$l_stop)" # Not provisioned (a fresh install before tools/phone-provision): one line # per missing file, no latch, the reason says so. The unit itself is skipped diff --git a/packages/omamobile-modem/test/test_link.py b/packages/omamobile-modem/test/test_link.py new file mode 100644 index 000000000..c7893dd42 --- /dev/null +++ b/packages/omamobile-modem/test/test_link.py @@ -0,0 +1,204 @@ +# SPDX-License-Identifier: MIT +"""Run the starter's link checks with synthetic sysfs and inert module loads.""" +from pathlib import Path +import re +import os +import subprocess +import tempfile +import unittest + +SOURCE = (Path(__file__).resolve().parents[1] / 'lib/omamobile-modem-start').read_text() + + +class LinkTests(unittest.TestCase): + def setUp(self): + self.directory = tempfile.TemporaryDirectory() + self.addCleanup(self.directory.cleanup) + self.root = Path(self.directory.name) + self.function = re.search(r'^link_param_ok\(\) \{\n.*?^\}', SOURCE, re.M | re.S).group() + self.function = self.function.replace('/sys/module/', str(self.root) + '/') + + def run_value(self, value, wanted): + parameter = self.root / 'test/parameters/flag' + parameter.parent.mkdir(parents=True, exist_ok=True) + if value is not None: + parameter.write_text(value + '\n') + return subprocess.run(['bash', '-c', 'set -euo pipefail\n' + self.function + + '\nlink_param_ok test flag=' + wanted], capture_output=True).returncode + + def test_missing_parameter_refuses(self): + self.assertNotEqual(self.run_value(None, '1'), 0) + + def test_boolean_and_literal_values(self): + for value, wanted in [('Y', '1'), ('N', '0'), ('1', '1'), ('0', '0'), ('42', '42')]: + self.assertEqual(self.run_value(value, wanted), 0) + + def test_mismatched_values_refuse(self): + for value, wanted in [('N', '1'), ('Y', '0'), ('unknown', '1')]: + self.assertNotEqual(self.run_value(value, wanted), 0) + + def test_device_modules_load_in_order_with_arguments(self): + loop = re.search(r'for entry in "\$\{LINK_MODULES\[@\]\}"; do\n read -r -a words <<< "\$entry"\n modprobe "\$\{words\[@\]\}"\ndone', SOURCE).group() + script = ('LINK_MODULES=("first allow_hw=1" "second cpif=1")\n' + 'modprobe() { printf "%s " "$@"; printf "\\n"; }\n' + loop) + result = subprocess.run(['bash', '-c', script], text=True, capture_output=True, check=True) + self.assertEqual(result.stdout, 'first allow_hw=1 \nsecond cpif=1 \n') + + def test_default_keeps_existing_gs201_parameters(self): + self.assertIn('LINK_MODULES=("pcie-gs201-cp allow_hw=1")', SOURCE) + + def test_loaded_module_mismatch_refuses_before_loading(self): + block = SOURCE[SOURCE.index('link_param_ok() {'):SOURCE.index('# The sleep inhibitor before the drivers:')] + block = block.replace('/sys/module/', str(self.root) + '/') + parameter = self.root / 'second/parameters/cpif' + parameter.parent.mkdir(parents=True) + for value in [None, 'N', 'Y']: + if value is not None: + parameter.write_text(value + '\n') + script = ('set -euo pipefail\nLINK_MODULES=("first allow_hw=1" "second cpif=1")\n' + 'say() { :; }; refuse() { exit 7; }\n' + block + '\necho load-reached\n') + result = subprocess.run(['bash', '-c', script], text=True, capture_output=True) + self.assertEqual(result.returncode, 0 if value == 'Y' else 7) + self.assertEqual('load-reached' in result.stdout, value == 'Y') + + def run_starter(self, config, loaded=None): + """Run actual starter with only paths redirected and inert external tools.""" + config_path = self.root / 'link.conf' + if config is not None: + if isinstance(config, bytes): + config_path.write_bytes(config) + else: + config_path.write_text(config) + vendor = self.root / 'vendor' + vendor.mkdir() + profile = vendor / 'omamobile-vendor-chroot' + profile.write_text('#!/bin/bash\necho profile-$2 >> "$TRACE"\nexit 1\n') + profile.chmod(0o700) + sysfs = self.root / 'sys' + sysfs.mkdir() + if loaded is not None: + parameter = sysfs / 'second/parameters/cpif' + parameter.parent.mkdir(parents=True) + if loaded != 'missing': + parameter.write_text(loaded + '\n') + tools = self.root / 'bin' + tools.mkdir() + for name, body in { + 'systemd-inhibit': 'echo inhibitor >> "$TRACE"; echo "omamobile-modem held"', + 'sync': ':', + 'modprobe': 'test -f "$OMAMOBILE_MODEM_LATCH" || exit 23; echo "load:$*" >> "$TRACE"', + }.items(): + tool = tools / name + tool.write_text('#!/bin/bash\n' + body + '\n') + tool.chmod(0o700) + provision = self.root / 'provisioned' + provision.touch() + starter = self.root / 'starter' + starter.write_text(SOURCE.replace('LIB=/usr/lib/omamobile-vendor', + 'LIB=' + str(vendor)).replace( + 'LINK_CONFIG=/usr/lib/omamobile-modem/link.conf', + 'LINK_CONFIG=' + str(config_path)).replace( + '/sys/module/', str(sysfs) + '/')) + trace = self.root / 'trace' + env = os.environ.copy() + env.update(PATH=str(tools) + ':' + env['PATH'], TRACE=str(trace), + OMAMOBILE_MODEM_LATCH=str(self.root / 'latch'), + OMAMOBILE_MODEM_UP_MARK=str(self.root / 'up'), + OMAMOBILE_MODEM_HOLD=str(self.root / 'hold'), + OMAMOBILE_MODEM_REFUSED=str(self.root / 'refused'), + OMAMOBILE_MODEM_CHROOT=str(provision), + OMAMOBILE_MODEM_NV_SUMS=str(provision), + OMAMOBILE_MODEM_PROPS=str(provision)) + env.pop('OMAMOBILE_MODEM_TEST_STOP_AFTER_CHECKS', None) + result = subprocess.run(['bash', str(starter)], env=env, + capture_output=True, text=True, timeout=5) + return result, trace.read_text().splitlines() if trace.exists() else [] + + def test_data_list_reaches_inhibitor_then_ordered_loads_with_latch(self): + result, trace = self.run_starter('# device list\nfirst allow_hw=1\nsecond cpif=1', 'Y') + self.assertEqual(result.returncode, 1) # inert profile check deliberately refuses + self.assertEqual(trace, ['inhibitor', 'inhibitor', 'load:first allow_hw=1', + 'load:second cpif=1', 'load:shm_ipc', 'load:cpif', 'profile-check']) + + def test_no_config_preserves_real_default_load(self): + result, trace = self.run_starter(None) + self.assertEqual(result.returncode, 1) + self.assertEqual(trace[2], 'load:pcie-gs201-cp allow_hw=1') + + def test_data_substitution_refuses_without_executing_marker(self): + marker = self.root / 'injected' + result, trace = self.run_starter('first allow_hw=$(touch ' + str(marker) + ')\n') + self.assertFalse(marker.exists()) + self.assertEqual(result.returncode, 1) + self.assertEqual(trace, []) + self.assertFalse((self.root / 'latch').exists()) + self.assertEqual((self.root / 'refused').read_text().strip(), + 'Off: invalid link configuration') + + def assert_binary_config_refused(self, raw): + result, trace = self.run_starter(raw) + self.assertEqual(trace, []) + self.assertEqual(result.returncode, 1) + self.assertFalse((self.root / 'latch').exists()) + self.assertEqual((self.root / 'refused').read_text().strip(), + 'Off: invalid link configuration') + + def test_nul_inside_module_cannot_normalize_to_valid_load(self): + self.assert_binary_config_refused(b'fi\x00rst allow_hw=1\n') + + def test_nul_inside_parameter_cannot_normalize_to_valid_load(self): + self.assert_binary_config_refused(b'first allow_hw=\x001\n') + + def test_nul_only_configuration_is_invalid(self): + self.assert_binary_config_refused(b'\x00') + + def test_invalid_data_cannot_override_guards(self): + # Execute the actual parser once per hostile data sample, never source it. + function = re.search(r'^read_link_config\(\) \{\n.*?^\}', SOURCE, re.M | re.S).group() + for text in ['MARK=/wrong', 'HOLD=/wrong', 'refuse() { :; }', + 'first a=`true`', 'first a="1"', '-r first', + 'first a=1; true', 'first a=', 'first ../a=1', + 'first a=1 # inline', '', '# comment only\n']: + path = self.root / 'invalid.conf' + path.write_text(text) + result = subprocess.run(['bash', '-c', + 'set -euo pipefail\nrefuse() { exit 7; }\n' + function + + '\nread_link_config "$1"\necho accepted', 'test', str(path)], + capture_output=True, text=True) + self.assertEqual(result.returncode, 7, text) + self.assertNotIn('accepted', result.stdout) + + def test_full_starter_loaded_parameter_refuses_before_inhibitor_or_latch(self): + result, trace = self.run_starter('first allow_hw=1\nsecond cpif=1\n', 'missing') + self.assertEqual(result.returncode, 1) + self.assertEqual(trace, []) + self.assertFalse((self.root / 'latch').exists()) + self.assertEqual((self.root / 'refused').read_text().strip(), 'Off: reboot needed') + + def test_parser_accepts_only_named_module_arguments_and_refuses_symlink(self): + function = re.search(r'^read_link_config\(\) \{\n.*?^\}', SOURCE, re.M | re.S).group() + path = self.root / 'valid.conf' + path.write_text('first\nsecond\tflag=1,2 value=a/b:c+_-.\n') + script = ('set -euo pipefail\nrefuse() { exit 7; }\n' + function + + '\nread_link_config "$1"\nprintf "%s\\n" "${LINK_MODULES[@]}"') + result = subprocess.run(['bash', '-c', script, 'test', str(path)], + capture_output=True, text=True) + self.assertEqual(result.returncode, 0) + self.assertEqual(result.stdout.splitlines(), ['first', 'second\tflag=1,2 value=a/b:c+_-.']) + link = self.root / 'alias.conf' + link.symlink_to(path) + result = subprocess.run(['bash', '-c', script, 'test', str(link)], + capture_output=True, text=True) + self.assertEqual(result.returncode, 7) + + def test_config_read_precedes_parameter_check_inhibitor_and_latch(self): + self.assertLess(SOURCE.index('read_link_config "$LINK_CONFIG"'), + SOURCE.index('link_param_ok() {')) + self.assertLess(SOURCE.index('link_param_ok() {'), + SOURCE.index('# The sleep inhibitor before the drivers:')) + self.assertLess(SOURCE.index('# The sleep inhibitor before the drivers:'), + SOURCE.index("printf '%s boot %s")) + + +if __name__ == '__main__': + unittest.main() diff --git a/packages/omamobile-modem/version b/packages/omamobile-modem/version index e8e277f2f..04c5555c6 100644 --- a/packages/omamobile-modem/version +++ b/packages/omamobile-modem/version @@ -1 +1 @@ -0.1.16 +0.1.17 From 38fbef24986ecaa0c5af243b094a496f6873d0aa Mon Sep 17 00:00:00 2001 From: azazelpy Date: Mon, 9 Nov 2026 22:30:28 -0300 Subject: [PATCH 57/66] omamobile-waydroid 0.1.2: allow binder by path, check the render node's numbers (#541) binderfs's major is assigned when the kernel boots (507 on the cheetah kernel), so lxc-omamobile.conf carried `c 507:*` and omamobile-waydroid-check compared it with /proc/devices before every start. LXC 7 can take the nodes by path instead (`device_cgroup_rule_parse_devpath()` in cgfsng.c): it stat()s the path when the container starts and uses that major and minor. The conf now has `/dev/binderfs/binder`, `/dev/binderfs/vndbinder` and `/dev/binderfs/hwbinder` and no hard-coded major. This is also narrower: the old line allowed every minor of the binder major, including binder-control. If a node is missing when the container starts, lxc-start fails with "Failed to parse device rule" instead of starting an Android that cannot boot. binderfs is mounted by Waydroid only when the container starts, so the check cannot stat the nodes; it wants the three lines in the conf instead. omamobile-waydroid-check also does for the render node what it did for binder: it reads the Panthor node's major:minor from sysfs and wants the matching `c MAJ:MIN rwm` line (`c 226:128` today). While doing that it stopped printing a wrong path (/dev/renderD128; the node is /dev/dri/renderD128). test/all covers the three path lines (each one deleted in turn, and the old `c 507:*` form not satisfying it), no hard-coded `c N:*` besides tty and pts, and the render node matching and not matching. With the check limited to binder, the render comparison never failing, or a binder major put back in the conf, the suite fails. Tested on a Pixel 7 Pro (GE2AE) running `7.3.0-rc6-omamobile-push1-g4cdfc1aa4b6b`, one session start each (the package's files copied to the phone for the run, then the originals put back, with matching sha256): - With the files of the previous head (`c 507:*`): container and session running, sys.boot_completed=1, servicemanager, hwservicemanager and vndservicemanager running. - With this change: the same. surfaceflinger running, ro.hardware.egl is mesa, the check passes with the render node 226:128 and the three binder lines. - Inside the container with this change, `toybox mknod` (mknod only, nodes never read or opened): refused for `b 7:0`, `c 1:1`, `c 507:4` (binder-control) and `c 507:8`; allowed for `c 507:5`, `c 507:6` and `c 507:7`, which are binder, hwbinder and vndbinder on this boot. Not covered: only one boot of one kernel; a start after a kernel update that moves the binder major; a start where binderfs is not yet mounted (the expected failure, not provoked); suspend and wake, and apps, with the session running. Co-authored-by: Claude Sonnet 5.5 --- device/cheetah/WAYDROID-PLAN.md | 13 ++++-- .../omamobile-waydroid/lib/lxc-omamobile.conf | 13 ++++-- .../lib/omamobile-waydroid-check | 45 ++++++++++++++----- packages/omamobile-waydroid/test/all | 44 +++++++++++------- packages/omamobile-waydroid/version | 2 +- 5 files changed, 81 insertions(+), 36 deletions(-) diff --git a/device/cheetah/WAYDROID-PLAN.md b/device/cheetah/WAYDROID-PLAN.md index 0fb053168..387e7548f 100644 --- a/device/cheetah/WAYDROID-PLAN.md +++ b/device/cheetah/WAYDROID-PLAN.md @@ -179,7 +179,7 @@ Waydroid 1.6.3 does three things that are wrong on this phone: drop-in) drops any such lines from the generated `config_nodes` and appends `lxc.include = /usr/share/omamobile-waydroid/lxc-omamobile.conf`, which allows the character devices Android uses (`c 1:3` for `/dev/null`, - the standard nodes, binderfs's major) and denies every block device with + the standard nodes, the binderfs nodes by path) and denies every block device with `lxc.cgroup2.devices.deny = b *:* rwm`, whoever makes the node. With LXC 7 the filter starts in "block everything" mode and leaves deny rules out of the device program, so a list with only the deny rule allows nothing and @@ -189,9 +189,14 @@ Waydroid 1.6.3 does three things that are wrong on this phone: placed before our include (a hand-edit) switches LXC to "allow everything", and the `b *:*` deny keeps block devices out. An `allow = a` placed after the include would clear every rule before it and open everything, so - `test/all` fails if the file has one. The binder major is assigned at boot - (507 on cheetah); `omamobile-waydroid-check` compares it with the line in - the file before every start. + `test/all` fails if the file has one. binderfs's major is assigned at boot + (507 on cheetah), so `binder`, `vndbinder` and `hwbinder` are allowed by + path (`lxc.cgroup2.devices.allow = /dev/binderfs/binder rwm`): LXC reads + each node's major and minor with `stat()` when the container starts, after + Waydroid has mounted binderfs, and `lxc-start` fails if a node is missing. + `binder-control` is not allowed. `omamobile-waydroid-check` wants the + three lines, and that the Panthor render node's `major:minor` (from + sysfs) is the one the file allows (`c 226:128`), before every start. - `verify` (`ExecStartPre` too) refuses to start the container unless all of it is in place. `waydroid upgrade` regenerates the config, so this runs before every start. diff --git a/packages/omamobile-waydroid/lib/lxc-omamobile.conf b/packages/omamobile-waydroid/lib/lxc-omamobile.conf index 4a5ae0513..ed13c6086 100644 --- a/packages/omamobile-waydroid/lib/lxc-omamobile.conf +++ b/packages/omamobile-waydroid/lib/lxc-omamobile.conf @@ -43,8 +43,13 @@ lxc.cgroup2.devices.allow = c 10:200 rwm lxc.cgroup2.devices.allow = c 10:229 rwm lxc.cgroup2.devices.allow = c 226:128 rwm # binderfs (binder, vndbinder, hwbinder). Its major is assigned when the -# kernel boots, not fixed: 507 on the cheetah kernel. omamobile-waydroid-check -# compares this line with the "binder" line of /proc/devices before every -# container start and refuses to start when they differ. -lxc.cgroup2.devices.allow = c 507:* rwm +# kernel boots, not fixed (507 on the cheetah kernel), so these are given as +# paths: LXC reads each node's major and minor with stat() when the container +# starts, after Waydroid has mounted binderfs on /dev/binderfs. If one of the +# nodes is missing then, lxc-start fails ("Failed to parse device rule") +# instead of starting an Android that cannot boot. binder-control is not +# allowed. omamobile-waydroid-check refuses to start without these three lines. +lxc.cgroup2.devices.allow = /dev/binderfs/binder rwm +lxc.cgroup2.devices.allow = /dev/binderfs/vndbinder rwm +lxc.cgroup2.devices.allow = /dev/binderfs/hwbinder rwm lxc.cgroup2.devices.deny = b *:* rwm diff --git a/packages/omamobile-waydroid/lib/omamobile-waydroid-check b/packages/omamobile-waydroid/lib/omamobile-waydroid-check index 574e74eaf..f7817e7d7 100755 --- a/packages/omamobile-waydroid/lib/omamobile-waydroid-check +++ b/packages/omamobile-waydroid/lib/omamobile-waydroid-check @@ -64,12 +64,20 @@ done if [[ -z ${CONFIG_FILE:-} ]]; then if grep -qw binder /proc/filesystems; then echo "ok binderfs in /proc/filesystems"; else echo "MISS binderfs not registered"; missing=1; fi if [[ -e /proc/pressure/memory ]]; then echo "ok /proc/pressure/memory"; else echo "MISS /proc/pressure/memory (psi=0 on the command line?)"; missing=1; fi - render= + render= render_rdev= for r in /sys/class/drm/renderD*; do [[ -e $r/device/driver ]] || continue - if [[ $(basename "$(readlink -f "$r/device/driver")") == panthor ]]; then render=/dev/$(basename "$r"); fi + if [[ $(basename "$(readlink -f "$r/device/driver")") == panthor ]]; then + render=/dev/dri/$(basename "$r") + # Its major:minor, as sysfs gives it, to check against lxc-omamobile.conf below + read -r render_rdev < "$r/dev" || render_rdev= + fi done - if [[ -n $render ]]; then echo "ok $render is panthor"; else echo "MISS no panthor render node (GPU-PLAN.md)"; missing=1; fi + if [[ -n $render ]]; then + echo "ok $render is panthor" + else + echo "MISS no panthor render node (GPU-PLAN.md)"; missing=1 + fi if mountpoint -q /sys/fs/cgroup && [[ $(stat -fc %T /sys/fs/cgroup) == cgroup2fs ]]; then echo "ok cgroup2 on /sys/fs/cgroup" else @@ -77,16 +85,29 @@ if [[ -z ${CONFIG_FILE:-} ]]; then fi fi -# The binder major is assigned at boot and lxc-omamobile.conf allows one: -# compare them. Runs on the live kernel, or against a test DEVICES_FILE and -# LXC_CONF (test/all) so the comparison itself is tested. -if [[ -z ${CONFIG_FILE:-} || -n ${DEVICES_FILE:-} ]]; then - binder_major=$(awk '$2 == "binder" { print $1 }' "${DEVICES_FILE:-/proc/devices}") +# The device rules in lxc-omamobile.conf Android needs to boot. Runs on the +# live kernel, or against a test LXC_CONF (and RENDER_RDEV for the render node; +# test/all) so the comparisons themselves are tested. +if [[ -z ${CONFIG_FILE:-} || -n ${LXC_CONF:-} ]]; then lxc_conf=${LXC_CONF:-/usr/share/omamobile-waydroid/lxc-omamobile.conf} - if [[ -n $binder_major ]] && grep -qx "lxc.cgroup2.devices.allow = c $binder_major:\* rwm" "$lxc_conf" 2>/dev/null; then - echo "ok binder major $binder_major is allowed in lxc-omamobile.conf" - else - echo "MISS binder major ${binder_major:-unset} is not allowed in $lxc_conf (Android would not boot)"; missing=1 + # binderfs's major is assigned at boot: the rules name the nodes by path and + # LXC reads their numbers when the container starts (binderfs is mounted + # by then, not yet at this check) + for n in binder vndbinder hwbinder; do + if grep -qx "lxc.cgroup2.devices.allow = /dev/binderfs/$n rwm" "$lxc_conf" 2>/dev/null; then + echo "ok /dev/binderfs/$n is allowed in lxc-omamobile.conf" + else + echo "MISS /dev/binderfs/$n is not allowed in $lxc_conf (Android would not boot)"; missing=1 + fi + done + # The render node's numbers are fixed in the file: they must be the panthor node's + render_rdev=${RENDER_RDEV:-${render_rdev:-}} + if [[ -n $render_rdev ]]; then + if grep -qx "lxc.cgroup2.devices.allow = c $render_rdev rwm" "$lxc_conf" 2>/dev/null; then + echo "ok render node $render_rdev is allowed in lxc-omamobile.conf" + else + echo "MISS render node $render_rdev is not allowed in $lxc_conf (no GPU in Android)"; missing=1 + fi fi fi diff --git a/packages/omamobile-waydroid/test/all b/packages/omamobile-waydroid/test/all index 19bb88168..180ed7bd6 100755 --- a/packages/omamobile-waydroid/test/all +++ b/packages/omamobile-waydroid/test/all @@ -49,23 +49,37 @@ for o in NETFILTER_XT_MARK NETFILTER_XT_CONNMARK NETFILTER_XT_MATCH_OWNER NETFIL echo "CONFIG_$o=m" >> "$t/config" done CONFIG_FILE=$t/config lib/omamobile-waydroid-check > "$t/ok.log" || { cat "$t/ok.log"; fail "check rejects a complete config"; } -# The binder major comes from /proc/devices at boot and the check compares it -# with the allow line: run that comparison against a test devices file. The -# conf's other "c N:*" lines (5, 136) must not be able to satisfy it. -printf 'Character devices:\n 1 mem\n 5 /dev/tty\n136 pts\n507 binder\n\nBlock devices:\n 8 sd\n' > "$t/devices" -CONFIG_FILE=$t/config DEVICES_FILE=$t/devices LXC_CONF=lib/lxc-omamobile.conf lib/omamobile-waydroid-check > "$t/binder.log" \ - || { cat "$t/binder.log"; fail "check rejects the shipped binder allow line"; } -grep -q '^ok binder major 507 is allowed' "$t/binder.log" || fail "check does not report the binder major" -grep -v '^lxc.cgroup2.devices.allow = c 507:' lib/lxc-omamobile.conf > "$t/no-binder.conf" -if CONFIG_FILE=$t/config DEVICES_FILE=$t/devices LXC_CONF=$t/no-binder.conf lib/omamobile-waydroid-check > "$t/binder.log"; then - fail "check passes with the binder line deleted" +# binderfs's major is assigned at boot, so the conf names binder, vndbinder and +# hwbinder by path (LXC reads their numbers when the container starts) and the +# check wants those three lines. A hard-coded binder major must not come back, +# and a "c N:*" line (5, 136, or a stale binder major) must not satisfy it. +for n in binder vndbinder hwbinder; do + grep -qx "lxc.cgroup2.devices.allow = /dev/binderfs/$n rwm" lib/lxc-omamobile.conf || fail "lxc-omamobile.conf: $n is not allowed by path" +done +[[ $(grep -Ec '^lxc.cgroup2.devices.allow = c [0-9]+:\* rwm$' lib/lxc-omamobile.conf) == 2 ]] \ + || fail "lxc-omamobile.conf has a 'c N:*' line besides tty (5) and pts (136): a hard-coded binder major?" +CONFIG_FILE=$t/config LXC_CONF=lib/lxc-omamobile.conf RENDER_RDEV=226:128 lib/omamobile-waydroid-check > "$t/binder.log" \ + || { cat "$t/binder.log"; fail "check rejects the shipped binder and render allow lines"; } +for n in binder vndbinder hwbinder; do + grep -q "^ok /dev/binderfs/$n is allowed" "$t/binder.log" || fail "check does not report $n" + grep -v "^lxc.cgroup2.devices.allow = /dev/binderfs/$n rwm\$" lib/lxc-omamobile.conf > "$t/no-binder.conf" + if CONFIG_FILE=$t/config LXC_CONF=$t/no-binder.conf RENDER_RDEV=226:128 lib/omamobile-waydroid-check > "$t/binder.log"; then + fail "check passes with the $n line deleted" + fi + grep -q "^MISS /dev/binderfs/$n is not allowed" "$t/binder.log" || fail "check does not name the missing $n line" +done +# the old form, a binder major, is not enough +sed 's|^lxc.cgroup2.devices.allow = /dev/binderfs/binder rwm$|lxc.cgroup2.devices.allow = c 507:* rwm|' lib/lxc-omamobile.conf > "$t/old-binder.conf" +if CONFIG_FILE=$t/config LXC_CONF=$t/old-binder.conf RENDER_RDEV=226:128 lib/omamobile-waydroid-check > /dev/null; then + fail "check passes with a binder major instead of the binder path" fi -grep -q '^MISS binder major 507 is not allowed' "$t/binder.log" || fail "check does not name the missing binder major" -sed 's/^507 binder/508 binder/' "$t/devices" > "$t/devices-moved" -if CONFIG_FILE=$t/config DEVICES_FILE=$t/devices-moved LXC_CONF=lib/lxc-omamobile.conf lib/omamobile-waydroid-check > "$t/binder.log"; then - fail "check passes when the binder major moved" +# The render node: its major and minor must be the ones the conf allows +CONFIG_FILE=$t/config LXC_CONF=lib/lxc-omamobile.conf RENDER_RDEV=226:128 lib/omamobile-waydroid-check | grep -q '^ok render node 226:128 is allowed' \ + || fail "check does not report the render node" +if CONFIG_FILE=$t/config LXC_CONF=lib/lxc-omamobile.conf RENDER_RDEV=226:129 lib/omamobile-waydroid-check > "$t/binder.log"; then + fail "check passes when the render node is not the allowed one" fi -grep -q '^MISS binder major 508 is not allowed' "$t/binder.log" || fail "check does not name the moved binder major" +grep -q '^MISS render node 226:129 is not allowed' "$t/binder.log" || fail "check does not name the render node that is not allowed" grep -v '^CONFIG_NETFILTER_XTABLES_LEGACY=' "$t/config" > "$t/bad" if CONFIG_FILE=$t/bad lib/omamobile-waydroid-check > "$t/bad.log"; then fail "check accepts a config without legacy xtables"; fi grep -q '^MISS NETFILTER_XTABLES_LEGACY=unset' "$t/bad.log" || fail "check does not name the missing option" diff --git a/packages/omamobile-waydroid/version b/packages/omamobile-waydroid/version index 17e51c385..d917d3e26 100644 --- a/packages/omamobile-waydroid/version +++ b/packages/omamobile-waydroid/version @@ -1 +1 @@ -0.1.1 +0.1.2 From 5385ee7dbf9e334615a3e980167565175cffdfc2 Mon Sep 17 00:00:00 2001 From: solfredag <98718480+nosmokinghere@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:30:31 +0100 Subject: [PATCH 58/66] device/kodiak: note OrangeFox install method, partition mapping and vbmeta source (#511) The Xiaomi 14's notes record how the phone was installed (OrangeFox, slot B only: the installer's own console shows it, so slot A was never written), the partition mapping, where vbmeta came from, that the installer dropped vendor_boot's AVB footer on slot B, and the plan for the next backup from the guarded initramfs. --- device/kodiak/BRINGUP-NOTES.md | 16 +++++++++++----- device/kodiak/NOTES.md | 18 +++++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/device/kodiak/BRINGUP-NOTES.md b/device/kodiak/BRINGUP-NOTES.md index e1c1343a7..3e94bd0ed 100644 --- a/device/kodiak/BRINGUP-NOTES.md +++ b/device/kodiak/BRINGUP-NOTES.md @@ -5,17 +5,22 @@ Tracking: https://github.com/derekross/omarchy-mobile/pull/231 ## Current state - Bootloader unlocked -- Stock CD1A.260905.001.B1 on slot B (factory flash-all.sh) +- Stock CD1A.260905.001.B1 on slot B (factory flash-all.sh). On 2026-11-01 OrangeFox’s recovery replaced slot B’s vendor_boot (stock copy saved by the installer at backup/20261101-151204/vendor_boot_b before the rebuild). +- Stock recovery did not provide adb root, so OrangeFox was installed on slot B to take the read-only calibration backup. - Slot A is the safety slot (do not flash) - device.conf has partition sizes, AVB values, and confirmed board id/rev - Critical calibration partitions backed up off-device with SHA-256 checksums (persist, modem_a/b, nvdata, nvram, devinfo, trusty_userdata). - Taken from OrangeFox recovery (read-only `dd` of the by-name nodes, pulled off-device). - Images and SHA256SUMS live in a local `kodiak-critical/` directory (not in the repository). - No classic efs*/modem_userdata nodes exist on this device. +- Calibration backup taken from OrangeFox recovery (read-only `dd` of the by-name nodes, pulled off-device, contents at that time; recovery may have mounted persist/metadata). Not a clean stock baseline. +- OrangeFox was installed via the AIO installer (`install-desktop.sh`) after the factory flash and OTA sideload, and before the calibration backup. +- The installer replaced only the recovery part of `vendor_boot` on slot B. Slot A remains stock. +- It did not write `vbmeta`, `boot`, or `init_boot`. +- No plan to restore stock `vendor_boot` on slot A (it was never changed). +- Images and SHA256SUMS live in a local `kodiak-critical/` directory (not in the repository). +- No classic efs*/modem_userdata nodes exist on this device. ## Still needed -- [x] Slot-B backup of stock boot images +- [x] Slot-B backup of stock boot images (taken before OrangeFox install; stock vendor_boot_b also saved by the installer at backup/20261101-151204/vendor_boot_b) - [x] Calibration partition backup (see above) - [ ] First Omarchy build / flash to slot B @@ -29,3 +34,4 @@ Tracking: https://github.com/derekross/omarchy-mobile/pull/231 - DTB lives in vendor_kernel_boot.img - DTBO entry 37: id=0x80406 rev=0x10000 - Bootloader: spacecraft-17.4-16238327 (both slots) +- Partition mapping (from recovery sysfs/by-name): all on sda — boot_b (sda23), init_boot_b (sda24), vendor_boot_b (sda25), vendor_kernel_boot_b (sda26), dtbo_b (sda27), userdata (sda42). diff --git a/device/kodiak/NOTES.md b/device/kodiak/NOTES.md index 2f919309c..e62cc3434 100644 --- a/device/kodiak/NOTES.md +++ b/device/kodiak/NOTES.md @@ -26,15 +26,25 @@ Tracking issue: https://github.com/derekross/omarchy-mobile/issues/199 - Display: Verisilicon DC9x00 DPU + MIPI DSI2 (stock DTB) - dtbo_idx: 37 (`adb shell getprop ro.boot.dtbo_idx`) - DTBO entry 37: id=0x80406 rev=0x10000 (`mkdtboimg dump` on factory `dtbo.img`) +- AVB values: `avbtool info_image` on the factory `vbmeta.img` (from the official factory image for CD1A.260905.001.B1), plus `boot.img` and `init_boot.img`. Rollback index and security patch match the factory image; vbmeta chains boot (loc 2) and init_boot (loc 4). Same values present on slot B after the factory flash. - Bootloader unlocked: yes - Current confirmed bootable slots: both (factory flash + full OTA sideload) - ABL still appends `console=null` (`adb shell cat /proc/cmdline`) +## Slots + +- OrangeFox was installed via the AIO installer (`install-desktop.sh`) after the factory flash and OTA sideload, and before the calibration backup. +- Flash output not kept; the installer was set to slot b only. +- The installer replaced only the recovery part of `vendor_boot` on slot B. Slot A remains stock. +- The installer dropped the AVB footer from slot B’s vendor_boot (grown ramdisk + old footer would overflow the partition). Slot B’s vendor_boot currently has no AVB footer. +- It did not write `vbmeta`, `boot`, or `init_boot`. +- No plan to restore stock `vendor_boot` on slot A (it was never changed). + ## Partition and AVB sources - Partition sizes: `fastboot getvar partition-size:boot_b`, `partition-size:init_boot_b`, etc. - Partition names and by-name → block mapping: from recovery (sysfs/by-name) -- AVB values: `avbtool info_image` on stock `vbmeta_b`, `boot`, and `init_boot` (rollback index, security patch, chaining) +- AVB values: see Stock facts above (factory `vbmeta.img`) ## Hardware from stock DTB (vendor_kernel_boot) @@ -61,6 +71,8 @@ Tracking issue: https://github.com/derekross/omarchy-mobile/issues/199 ## Status -Stock facts collected and both slots restored to factory. +Stock facts collected and both slots restored to factory. On 2026-11-01 OrangeFox’s recovery replaced slot B’s vendor_boot (stock copy saved by the installer at backup/20261101-151204/vendor_boot_b before the rebuild). Device descriptor added in `device/kodiak/device.conf`. -Critical calibration partitions backed up off-device with SHA-256 checksums (persist, modem_a/b, nvdata, nvram, devinfo, trusty_userdata). Taken from OrangeFox recovery (read-only `dd` of the by-name nodes, pulled off-device). +Critical calibration partitions backed up off-device with SHA-256 checksums (persist, modem_a/b, nvdata, nvram, devinfo, trusty_userdata). Taken from OrangeFox recovery on slot B (contents at that time; recovery may have mounted persist/metadata). Not a clean stock baseline. + +Next calibration backup will be taken from the Omarchy initramfs on first slot B boot (read-only dd). Checksums and file/folder timestamps will be compared with the OrangeFox backup to see if persist or other calibration partitions changed. From 0050c115c4fe73209df280bb2098cdf0ab917d75 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 9 Nov 2026 19:30:35 -0600 Subject: [PATCH 59/66] tools: --help finds its header by a relative path from another directory (#586) Run by a relative path from somewhere other than the repository root (cd ..; omarchy-mobile/tools/build-packages --help, or ./release --help from tools/), the eight tools that cd to the repository before they read their options failed --help: they passed "$0", which is relative to the directory they had just left, and awk couldn't open it (exit 2). Derek pointed this out on #559 and suggested usage_from_header as the place to fix it. usage_from_header now takes only FILE's name and reads that tool from the tools directory above tools/lib/usage.sh. The helper's own path is still valid when it runs, because every caller has just sourced it from its current directory, so this fixes all eight callers in one place with no call site changed. The tools that resolve their own path first (fetch-toolchain, kernel-pr-check, publish-kernel) or don't cd before --help (build-flame-probe, phone-smoke, phone-demo), and the bundle's inline-awk tools (install-phone, nv-backup, phone-provision), already worked; their files are unchanged. phone-smoke and phone-demo still load the helper only on the help path. tests/tools-help now runs every tool's --help from the repository's parent and from tools/ by a relative path and compares the output and exit code with a run from the root. On main it fails at tools/build-packages. --help from the root is byte-identical before and after for all 17 tools (16 exit 0, phone-mirror exit 2). Tested: tests/tools-help, tools/pr-check origin/main, tests/kernel-pr-check, tests/install-phone, tests/make-bundle, and tests/all, which passes except tests/release-upload. That suite fails the same way on main because the worktree path contains "/.". Co-authored-by: Claude Opus 5.5 --- tests/tools-help | 13 +++++++++++++ tools/lib/usage.sh | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/tools-help b/tests/tools-help index cb27c288f..cb19063bf 100755 --- a/tests/tools-help +++ b/tests/tools-help @@ -53,3 +53,16 @@ for f in "${tools[@]}"; do || fail "$f --help doesn't follow its header when it grows by a line" done echo "ok - ${#tools[@]} tools print their header comment as --help, however long it grows, and no code" + +# The same --help, output and exit code, run by a relative path from the +# repository's parent and from tools/: a tool that cds to the repository +# first must not look for its header at "$0" from the directory it left +# (#559). +help_from() { (cd -- "$1" && "$2" --help 2>&1; echo "exit $?"); } +repo=$PWD +for f in "${tools[@]}"; do + out=$(help_from "$repo" "$f") + [[ $(help_from "$repo/.." "${repo##*/}/$f") == "$out" ]] || fail "$f --help differs run from the repository's parent" + [[ $(help_from "$repo/tools" "./${f#tools/}") == "$out" ]] || fail "$f --help differs run from tools/" +done +echo "ok - ${#tools[@]} tools print the same --help by a relative path from another directory" diff --git a/tools/lib/usage.sh b/tools/lib/usage.sh index 63299f273..b5cbc6d9f 100644 --- a/tools/lib/usage.sh +++ b/tools/lib/usage.sh @@ -10,17 +10,25 @@ # # source tools/lib/usage.sh # usage_from_header [--raw] FILE [PARAGRAPHS] -# prints FILE's header with each line's "#" and one space after it taken +# prints the header of the tool named FILE, in the tools directory +# above this file, with each line's "#" and one space after it taken # off (--raw keeps them). With PARAGRAPHS, only that many paragraphs of # it (a bare "#" line ends one), for a tool whose help is the first part # of a longer header. +# +# Only FILE's name is used. A tool that cds to the repository first and +# passes "$0" passes a path relative to the directory it left +# (`cd ..; omarchy-mobile/tools/build-packages --help`, #559), while this +# file's own path is still good: the tool has just sourced it from where it +# is now. usage_from_header() { local raw=0 [[ ${1:-} == --raw ]] && { raw=1; shift; } + local name=${1:?usage_from_header FILE [PARAGRAPHS]} awk -v raw="$raw" -v paras="${2:-0}" ' NR <= 2 { next } !/^#/ { exit } /^#[ \t]*$/ && ++blank == paras { exit } - { if (!raw) sub(/^# ?/, ""); print }' "${1:?usage_from_header FILE [PARAGRAPHS]}" + { if (!raw) sub(/^# ?/, ""); print }' "$(dirname -- "${BASH_SOURCE[0]}")/../${name##*/}" } From 1d53a9ba96b7425dfc4d702819c72f8fdcdaf9de Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:30:39 +0100 Subject: [PATCH 60/66] extract-camera-data: enable SVE access in the HAL emulator (#589) CPU_MAX advertises SVE but still traps ADDVL before the HAL builder can run. Enable CPACR_EL1 ZEN and general FP/SIMD access plus CPTR_EL3 EZ, preserving unrelated bits and leaving vector length and EL2 state unchanged. Exercise the actual Emu constructor with an entirely synthetic ELF containing ADDVL, RDVL and RET. The unchanged extractor raises UC_ERR_EXCEPTION; the patched extractor returns the vector-length-dependent result. Keep optional dependency skips explicit and distinguish integer SVE from FP access in separate gate fixtures. Co-authored-by: Codex --- tests/extract-camera-data | 2 + tests/extract-camera-sve.py | 104 ++++++++++++++++++++++++++++++++++++ tools/extract-camera-data | 10 ++++ 3 files changed, 116 insertions(+) create mode 100644 tests/extract-camera-sve.py diff --git a/tests/extract-camera-data b/tests/extract-camera-data index c26f49e01..f95d10a18 100755 --- a/tests/extract-camera-data +++ b/tests/extract-camera-data @@ -192,3 +192,5 @@ if failures: sys.exit(f"not ok - {len(failures)} adrp decoding check(s) failed") print("ok - adrp page displacements are signed in every finder") PY + +python3 -I -B tests/extract-camera-sve.py diff --git a/tests/extract-camera-sve.py b/tests/extract-camera-sve.py new file mode 100644 index 000000000..395147b71 --- /dev/null +++ b/tests/extract-camera-sve.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Real Emu with a synthetic ELF and own ADDVL/RDVL code; no HAL or phone.""" +import gc +import importlib.machinery +import importlib.util +from pathlib import Path +import struct +import sys +import tempfile + +try: + import unicorn + from unicorn import arm64_const as A + import elftools.elf.elffile +except ImportError: + print('ok - extractor SVE execution # SKIP requires unicorn and pyelftools') + raise SystemExit(0) + +source = Path(sys.argv[1]) if len(sys.argv) == 2 else Path(__file__).resolve().parents[1] / 'tools/extract-camera-data' +loader = importlib.machinery.SourceFileLoader('camera_sve_test', str(source)) +tool = importlib.util.module_from_spec(importlib.util.spec_from_loader(loader.name, loader)) +loader.exec_module(tool) + + +def fixture(path): + # Minimal ELF64/AArch64: one load segment, empty relocation/symbol tables. + # Own assembly: addvl x0, x0, #1; rdvl x1, #1; ret. + data = bytearray(1024) + ident = b'\x7fELF\x02\x01\x01' + bytes(9) + struct.pack_into('<16sHHIQQQIHHHHHH', data, 0, ident, 3, 183, 1, + 0x100, 64, 0x300, 0, 64, 56, 1, 64, 4, 1) + struct.pack_into('= 16 and vector_bytes % 16 == 0 + assert value == 100 + vector_bytes + finally: + emu.elf.stream.close() + del emu + gc.collect() + + +def gates(missing): + # Independent instruction fixture: distinguish integer SVE from FP access. + uc = unicorn.Uc(unicorn.UC_ARCH_ARM64, unicorn.UC_MODE_ARM) + uc.ctl_set_cpu_model(A.UC_CPU_ARM64_MAX) + uc.mem_map(0x10000, 4096) + uc.mem_write(0x10000, struct.pack('= 16 and vector_bytes % 16 == 0 + assert uc.reg_read(A.UC_ARM64_REG_X0) == 100 + vector_bytes + + +with tempfile.TemporaryDirectory(prefix='camera-sve-') as root: + path = Path(root) / 'fixture.so' + fixture(path) + execute(path) + print('ok - actual Emu executes synthetic ELF ADDVL/RDVL') + for gate in (None, 'ZEN', 'EL3', 'FPEN'): + gates(gate) + print(f'ok - independent integer SVE gate {gate}') diff --git a/tools/extract-camera-data b/tools/extract-camera-data index 22b2b8a96..ab7f393a8 100755 --- a/tools/extract-camera-data +++ b/tools/extract-camera-data @@ -111,6 +111,16 @@ class Emu: # The library uses Armv8.3 RCpc loads (LDAPR) on its static-guard # bytes; the default CPU model faults on them. self.uc.ctl_set_cpu_model(A.UC_CPU_ARM64_MAX) + # CPU_MAX advertises SVE, but Unicorn 2.1.4's sve_exception_el() + # still checks CPACR_EL1.ZEN and CPTR_EL3.EZ. Enable those gates + # and general FP/SIMD access here, preserving unrelated register bits. + # The integer ADDVL/RDVL fixture also passes without FPEN. + # Leave ZCR/VL and EL2 unchanged. + cpacr = self.uc.reg_read(A.UC_ARM64_REG_CPACR_EL1) + self.uc.reg_write(A.UC_ARM64_REG_CPACR_EL1, + cpacr | (3 << 16) | (3 << 20)) + cptr = self.uc.cpr_read(3, 6, 1, 1, 2) # CPTR_EL3 + self.uc.cpr_write(3, 6, 1, 1, 2, cptr | (1 << 8)) top = 0 for seg in self.elf.iter_segments(): if seg["p_type"] == "PT_LOAD": From da85b5254964724205c75c24b53541180a57f198 Mon Sep 17 00:00:00 2001 From: GrendelRTG Date: Mon, 9 Nov 2026 20:30:43 -0500 Subject: [PATCH 61/66] device/enchilada: name the 11-08 boot's kernel build (#588) The 2026-11-08 entry gave only the release, 7.1.0-rc1-sdm845, and the header of these notes describes two builds of it. The boot used the first-light kernel: the initramfs was packed against the build from 2026-11-04, not the netfilter build from 2026-11-05. Co-authored-by: Claude Opus 5.5 --- device/enchilada/NOTES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/enchilada/NOTES.md b/device/enchilada/NOTES.md index 990d7efe8..a3b456784 100644 --- a/device/enchilada/NOTES.md +++ b/device/enchilada/NOTES.md @@ -105,8 +105,8 @@ active slot, A, which is the rescue. `fastboot boot` of an initramfs built from commit 2331a85 (the `UFS_RW_LUNS` pull request, with `UFS_RW_LUNS=sde` in this descriptor), -kernel `7.1.0-rc1-sdm845`; nothing written. From the init's log and -`/sys/block`: +the first-light kernel (`7.1.0-rc1-sdm845`); nothing written. From the +init's log and `/sys/block`: - allowlist `boot_b userdata`; LUNs with allowlisted partitions `sda sde`; - `/dev/sda` and `/dev/sde` removed; From 10c48cc4a23e975b8983630f825a41c978599942 Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:30:46 +0100 Subject: [PATCH 62/66] omamobile-modem-sit: explain the SMSC probe failure policy (#583) Document why a failed or empty SMSC reply is incomplete with a present SIM, while the no-SIM error remains an expected result. Follow up on the review of #569 without changing probe behavior or its package version. Co-authored-by: OpenAI Codex --- packages/omamobile-modem-sit/lib/service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/omamobile-modem-sit/lib/service.py b/packages/omamobile-modem-sit/lib/service.py index df2dc7dfb..62a737100 100644 --- a/packages/omamobile-modem-sit/lib/service.py +++ b/packages/omamobile-modem-sit/lib/service.py @@ -842,7 +842,11 @@ def serve_one(service, connection, clients): def probe(): """Read-only first contact (MODEM-PLAN M4.1): SIM card and application states, radio state, packet registration, NR mode, whether an SMSC is - set. No identifiers are printed; nothing is changed.""" + set. No identifiers are printed; nothing is changed. + + A failed/empty SMSC reply with a present SIM leaves SMS configuration + unverified; SMSC error 11 is expected only when no SIM is present. + """ client = Sit() failed = False try: From 64fdd416c6b289eb1ff18c5abffec7cf8854f39a Mon Sep 17 00:00:00 2001 From: quatrixone <57962558+quatrixone@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:30:50 +0100 Subject: [PATCH 63/66] CONTRIBUTING: the Xiaomi Mi 8's single-slot entry (boot only) (#499) * CONTRIBUTING: add Dipper single-slot recovery entry Name the sole boot partition the installer may write and the physical fastboot button path, as required before any single-slot port is flashed. * CONTRIBUTING: group single-slot recovery entries * CONTRIBUTING: record Dipper forced restart * CONTRIBUTING: identify Dipper restart test context * CONTRIBUTING: record Dipper power-hold outcome * CONTRIBUTING: confirm Dipper restart under RAM kernel --- CONTRIBUTING.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43d63d13d..c41462101 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,6 +73,12 @@ Keeping stock on slot A is how we avoid bricking phones during development, not - **The initramfs's no-USB-host panic needs a review for the phone.** On an A/B phone it hands over to stock on slot A; on a single-slot phone it would restart into the same image. The device's descriptor and plan say what happens instead (stay up with the screen lit, or reboot into fastboot) before the first boot. - **Everything else in this section still applies:** never relock with a non-stock image, never flash an older factory image, the backup rules, the hang safety nets. +Phones with an entry: + +| Device | Boot partition the installer may write | Fastboot by buttons | Forced restart | +| --- | --- | --- | --- | +| Xiaomi Mi 8 (`dipper`) | `boot` only; stock `dtbo` stays untouched | Power off, then hold Volume Down + Power until FASTBOOT appears. | Hold Power alone for 10 seconds; confirmed to restart into Android under the Omarchy Mobile kernel. | + ### 3.2 The read-only storage guard UFS holds the per-device calibration. The initramfs ([`initramfs/init`](initramfs/init)) guards it before anything else runs: From 58863fab5ca65f0ca948757b2d409a6b3fc3e2e0 Mon Sep 17 00:00:00 2001 From: marselnenaj <201385099+marselnenaj@users.noreply.github.com> Date: Tue, 10 Nov 2026 02:34:23 +0100 Subject: [PATCH 64/66] omamobile-omarchy 0.1.39: select 4.0.6 and 4.5 patch families (#471) Omarchy 4.5 changed the files most of our patches touch, so one series no longer fits both. omamobile-omarchy now carries two families and picks by the installed Omarchy version: patches/ is the 26-patch port to Omarchy 4.5.0, and legacy-4.0.6/ is the 4.0.6 series as it was, 29 patches with #420's double tap to wake (0029). Any other Omarchy version is refused, so a new Omarchy never gets a half-applied series. Checked against the signed aarch64 packages: 29 apply on omarchy 4.0.6-1 and 26 on 4.5.0-3, each with --fuzz=0, and the package's tests pass on both. The 4.5 family ran on a contributor's Pixel 7 Pro on Omarchy 4.5.0-3. On the maintainer's Pixel 7 Pro (Omarchy 4.0.6, 0.1.37 installed), the upgrade to 0.1.39 on 2026-11-09 rewrote no Omarchy file: status and verify report 29 patches from legacy-4.0.6, the log says "series already applied", and the shell didn't restart. Co-Authored-By: Codex --- AGENTS.md | 4 +- README.md | 2 +- docs/RELEASES.md | 6 +- packages/omamobile-omarchy/LICENSE.omarchy | 20 + .../bin/omamobile-omarchy-patches | 27 +- packages/omamobile-omarchy/install | 4 + ...latform-skip-the-keybindings-welcome.patch | 15 + ...ck-number-pad-for-touch-only-devices.patch | 278 ++++ ...icker-and-hold-the-desktop-for-style.patch | 76 ++ ...rsor-and-hide-the-on-screen-keyboard.patch | 158 +++ ...-the-user-returns-to-the-screensaver.patch | 40 + ...ess-panels-with-bl-power-follow-dpms.patch | 37 + ...0009-lock-ipc-wake-for-hardware-keys.patch | 24 + ...-leave-the-on-screen-keyboard-usable.patch | 63 + ...ock-and-polkit-pin-or-password-input.patch | 305 +++++ ...-omarchy-update-to-the-phone-wrapper.patch | 30 + ...ke-a-locked-display-through-the-lock.patch | 20 + ...rgency-call-button-for-touch-devices.patch | 54 + .../0015-notifications-inline-reply.patch | 232 ++++ ...he-channel-switch-and-pacman-refresh.patch | 50 + ...-to-dismiss-and-a-touch-close-button.patch | 261 ++++ ...ck-button-and-swipe-right-to-go-back.patch | 113 ++ ...tions-forget-one-notification-by-ipc.patch | 73 ++ ...hrasing-for-keyboard-and-click-hints.patch | 70 ++ ...-turn-the-display-off-before-suspend.patch | 53 + ...print-only-when-a-finger-is-enrolled.patch | 186 +++ ...a-glance-view-for-touch-only-devices.patch | 1058 ++++++++++++++++ ...0024-app-icons-keep-the-largest-size.patch | 39 + ...5-launch-no-toast-for-shell-surfaces.patch | 30 + .../0026-lock-battery-status.patch | 238 ++++ .../0027-lock-media-controls.patch | 623 +++++++++ ...a-stacked-logo-for-a-narrow-terminal.patch | 60 + ...e-tap-to-wake-for-touch-only-devices.patch | 0 ...ove-the-modules-in-a-narrow-terminal.patch | 0 .../bridge-4.0.4-menu-first-frame.patch | 0 ...latform-skip-the-keybindings-welcome.patch | 15 +- ...ck-number-pad-for-touch-only-devices.patch | 148 ++- ...icker-and-hold-the-desktop-for-style.patch | 47 +- ...rsor-and-hide-the-on-screen-keyboard.patch | 19 +- ...-the-user-returns-to-the-screensaver.patch | 7 +- ...ess-panels-with-bl-power-follow-dpms.patch | 7 +- ...0009-lock-ipc-wake-for-hardware-keys.patch | 9 +- ...-leave-the-on-screen-keyboard-usable.patch | 15 +- ...ock-and-polkit-pin-or-password-input.patch | 72 +- ...-omarchy-update-to-the-phone-wrapper.patch | 36 +- ...ke-a-locked-display-through-the-lock.patch | 8 +- ...rgency-call-button-for-touch-devices.patch | 8 +- .../0015-notifications-inline-reply.patch | 335 +++-- ...he-channel-switch-and-pacman-refresh.patch | 43 +- ...-to-dismiss-and-a-touch-close-button.patch | 285 +---- ...ck-button-and-swipe-right-to-go-back.patch | 39 +- ...tions-forget-one-notification-by-ipc.patch | 81 +- ...hrasing-for-keyboard-and-click-hints.patch | 5 +- ...-turn-the-display-off-before-suspend.patch | 8 +- ...print-only-when-a-finger-is-enrolled.patch | 174 +-- ...a-glance-view-for-touch-only-devices.patch | 1077 ++++++++++++++-- ...0024-app-icons-keep-the-largest-size.patch | 7 +- ...5-launch-no-toast-for-shell-surfaces.patch | 16 +- .../patches/0026-lock-battery-status.patch | 5 +- .../patches/0027-lock-media-controls.patch | 3 + ...a-stacked-logo-for-a-narrow-terminal.patch | 3 + packages/omamobile-omarchy/test/all | 9 +- packages/omamobile-omarchy/test/lock-glance | 5 + .../omamobile-omarchy/test/lock-glance.qml | 8 +- .../test/mobile-pam-preserve.py | 59 + .../test/notification-store45.cjs | 53 + packages/omamobile-omarchy/test/patches.py | 30 +- packages/omamobile-omarchy/test/port45.py | 115 ++ .../Quickshell/Hyprland/Hyprland.qml | 10 + .../test/qml-stubs/Quickshell/Hyprland/qmldir | 2 + .../qml-stubs/Quickshell/Io/IpcHandler.qml | 7 + .../test/qml-stubs/Quickshell/Io/Process.qml | 2 + .../qml-stubs/Quickshell/Io/SplitParser.qml | 8 + .../test/qml-stubs/Quickshell/Io/qmldir | 3 + .../Quickshell/Services/Pipewire/Pipewire.qml | 8 + .../Quickshell/Services/Pipewire/qmldir | 2 + .../test/qml-stubs/Quickshell/Singleton.qml | 3 + .../test/qml-stubs/Quickshell/qmldir | 2 + .../test/sleep-lock-family.py | 60 + packages/omamobile-omarchy/test/sleep-lock.sh | 12 +- .../omamobile-omarchy/test/source-family.py | 21 + .../test/upstream45/migrations/1789764927.sh | 17 + .../test/upstream45/migrations/1791125650.sh | 28 + .../test/upstream45/migrations/1791367434.sh | 4 + .../test/upstream45/migrations/1792648436.sh | 21 + .../test/upstream45/migrations/README.md | 8 + .../test/upstream45/notifications/loader.cjs | 26 + .../test/upstream45/notifications/logic.cjs | 1113 +++++++++++++++++ packages/omamobile-omarchy/version | 2 +- 89 files changed, 7432 insertions(+), 927 deletions(-) create mode 100644 packages/omamobile-omarchy/LICENSE.omarchy create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch rename packages/omamobile-omarchy/{patches => legacy-4.0.6}/0029-lock-double-tap-to-wake-for-touch-only-devices.patch (100%) rename packages/omamobile-omarchy/{patches => legacy-4.0.6}/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch (100%) rename packages/omamobile-omarchy/{patches => legacy-4.0.6}/bridge-4.0.4-menu-first-frame.patch (100%) create mode 100644 packages/omamobile-omarchy/test/mobile-pam-preserve.py create mode 100644 packages/omamobile-omarchy/test/notification-store45.cjs create mode 100644 packages/omamobile-omarchy/test/port45.py create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml create mode 100644 packages/omamobile-omarchy/test/sleep-lock-family.py create mode 100644 packages/omamobile-omarchy/test/source-family.py create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1789764927.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/README.md create mode 100644 packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs create mode 100644 packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs diff --git a/AGENTS.md b/AGENTS.md index 636a77ad3..a024081fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -217,7 +217,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - pointer handlers declared directly on a window get no events, so put them on an Item inside it; - Qt 6.12's `QtQuick/Color` shadows Omarchy's `Commons.Color`, so import `qs.Commons as Commons`. - **pacman.conf order on aarch64:** `[omamobile]`, then `[omarchy]`, then Arch Linux ARM's repositories, so our Mesa and Omarchy's builds win. Use `omarchy update`, not `pacman -Syu`: on the phone it hands over to `omamobile-update` (patch 0012), which refuses a wrong order, low battery, another kernel or a bootloader package (`linux-omamobile` passes only when `omamobile-boot-update preflight` does), skips Snapper, the AUR and gum prompts, and holds boot-related migrations ([RELEASES](docs/RELEASES.md) §5.4). -- **Omarchy upgrades overwrite our Omarchy patches;** `omamobile-omarchy`'s pacman hook puts them back (all or nothing, from Omarchy's own files). Edit the series in `packages/omamobile-omarchy/patches` (`patches/omarchy` links there), bump that package's version, and make every patch apply with `--fuzz=0` on the Omarchy the phone runs: `packages/omamobile-omarchy/test/all` applies it to the real aarch64 package. A patch Omarchy has absorbed is reported as upstream: drop it. +- **Omarchy upgrades overwrite our Omarchy patches;** `omamobile-omarchy`'s pacman hook puts them back (all or nothing, from Omarchy's own files). Two families are selected by the installed Omarchy version: today's 4.0.6 phones use `packages/omamobile-omarchy/legacy-4.0.6/`; 4.5 uses `packages/omamobile-omarchy/patches/` (`patches/omarchy` links only to that family). Fixes for today's phones go in `legacy-4.0.6/`, and in `patches/` too when applicable to 4.5. Bump the package version and make the selected family apply with `--fuzz=0` on the Omarchy the phone runs: `packages/omamobile-omarchy/test/all` applies it to the real aarch64 package. A patch Omarchy has absorbed is reported as upstream: drop it. - **`environment.d` can't unset a variable:** `VAR=` with an empty value is a syntax error, and the generator skips the line silently, so the old value stays. Set an explicit value instead (`omamobile-shell` uses `none`). - **GeoClue answers no client until an authorization agent is registered for the caller's user,** and queues the call with no timeout, so every client just times out. `omamobile-gnss` runs GeoClue's demo agent as a user unit; app allow-list entries skip only the agent's question, not the agent. - **Firewall changes** (ufw is on): arm `systemd-run --on-active=90 /usr/bin/ufw disable` first, then check with a fresh SSH connection (`tools/phone-ssh --fresh`). @@ -233,7 +233,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link | `kernel/configs/omamobile.config` | Config fragment on top of arm64 `defconfig`, commented by plan | | `packages/omamobile-device-cheetah` | Boot-success marker, Wi-Fi and AoC start scripts, udev, modprobe and systemd policy | | `packages/omamobile-shell`, `-sensors`, `-gnss`, `-audio`, `-remote` (opt-in, with `wlrctl`), `-fingerprint`, `-modem` (chroot profile), `libfprint`, `neard`, `mesa`, `hyprland`, `omamobile-keyring` | Userspace packages | -| `packages/omamobile-omarchy/patches/` (`patches/omarchy/` links there) | Omarchy changes waiting to land upstream, re-applied after every Omarchy upgrade | +| `packages/omamobile-omarchy/{legacy-4.0.6,patches}/` | Version-selected Omarchy families: current 4.0.6 phone fixes belong in `legacy-4.0.6/`, and also in the 4.5 `patches/` family when applicable; `patches/omarchy/` links only to 4.5 | | `docs/DEVICES.md` | Supported-devices matrix | | `~/omamobile-kernel/linux`, `wt-*`, `out-*` | The kernel clone, its worktrees and build outputs (outside the repo; `~/android/mainline` on older setups) | | `~/android/reference/` | Stock captures and partition backups: private, never committed | diff --git a/README.md b/README.md index ea6f21975..6719e8692 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The kernel and boot images come from `bin/omamobile kernel`, `modules`, `initram | `tools/build-packages`, `tools/build-rootfs`, `tools/install-phone`, `tools/phone-provision`, `tools/make-bundle` | The installer: aarch64 packages and the root image built on the laptop, the narrow fastboot installer, per-phone provisioning, release bundles (`rootfs/` holds the image's package lists; `tests/` their tests) | | `tools/` | Staged bring-up and capture tools, on-phone probes, firmware extraction from the user's factory image, package and repository helpers | | `packages/` | pacman packages: `omamobile-shell` (the phone profile for Omarchy's shell), `omamobile-apps` (the mobile apps desktop Omarchy lacks: Camera, Maps, NFC), `omacam` (the camera app, built from its own repository), `omamobile-device-cheetah` (Pixel 7 Pro support), `omamobile-device-felix` (Pixel Fold), `omamobile-sensors` (sensors and auto-rotate through the AoC), `omamobile-gnss` (location on demand), `omamobile-mirror` (the phone's screen and input on a computer over USB, VNC), `omamobile-remote` and a click-patched `wlrctl` (use the phone over ssh from a script or an agent; opt-in, [docs/REMOTE-TESTING.md](docs/REMOTE-TESTING.md)), `omamobile-audio` (PipeWire and speaker protection), `omamobile-speaker-tuning` (stock's speaker tuning, off by default), `omamobile-fingerprint` with a patched `libfprint`, `omamobile-modem` (the modem's vendor chroot profile), `omamobile-modem-sit` (the SIT client daemon; talks to the modem, registration untested), `omamobile-mmd` (ModemManager's D-Bus API in front of it, for GNOME Calls, Chatty and NetworkManager), `neard`, `omamobile-keyring` (the `[omamobile]` repository's signing key), patched `mesa` and `hyprland`. `tools/phone-install-package` builds one on the phone and installs it | -| `patches/omarchy/` | Changes to Omarchy for touch devices, to send upstream (`bridge-*` ones are stopgaps for the phone's older Omarchy); a link to `packages/omamobile-omarchy/patches`, whose pacman hook re-applies them after every Omarchy upgrade | +| `patches/omarchy/` | Changes to Omarchy for touch devices, to send upstream (`bridge-*` stopgaps are retained only in the legacy 4.0.6 family); a link to the 4.5 family in `packages/omamobile-omarchy/patches/`. The installed Omarchy version selects the family: today's 4.0.6 phones use `legacy-4.0.6/`, so fixes go there and also in `patches/` when applicable to 4.5; the pacman hook re-applies the selected family after upgrades | | `bin/lineage-ref` | Builds LineageOS for the phone. Used as a rooted reference Android (M0) and, later, for Waydroid images | | `kernel/configs/` | Our kernel config fragment, merged on top of arm64 `defconfig` | | `device/cheetah/` | Pixel 7 Pro bring-up notes, one plan per subsystem, overlays, the initramfs and the device descriptor (`device.conf`) | diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 743080008..684677f96 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -206,7 +206,7 @@ The same Alpine-based initramfs, with release differences: `omamobile-omarchy` (in every image built from 2026-10-13 on, and a dependency of `omamobile-shell`, so `omarchy update` brings it to older phones) owns both halves; the details are in the headers of its `bin/omamobile-update` and `bin/omamobile-omarchy-patches`. -**The patches survive upgrades.** The series lives in `packages/omamobile-omarchy/patches` (`patches/omarchy` links there) and ships in the package. Its pacman hook (`95-omamobile-omarchy-patches.hook`, PostTransaction on `omarchy`, `omarchy-dev` and itself) re-applies it after every transaction that replaces Omarchy's files, and `rootfs/build-inside` runs the same tool, so image builds and upgrades take one code path. Every run starts from Omarchy's own files (checked against the package's mtree), applies the series in a scratch tree with `--fuzz=0`, verifies it by reversing it back to Omarchy's files, and only then swaps the files in. A patch whose reverse applies is already in Omarchy (a backport that landed): it is skipped and reported, and should be dropped from the series. Any other failure leaves Omarchy's files exactly as shipped, logs to `/var/log/omamobile/omarchy-patches.log` and notifies the user (the lock's PIN pad may be missing until a fixed series ships). A file that matches neither Omarchy's copy nor the last patched one was changed by something else and is never overwritten. +**The patches survive upgrades.** Two series families ship in the package, selected by the installed Omarchy version: `packages/omamobile-omarchy/legacy-4.0.6/` for today's 4.0.6 phones, and `packages/omamobile-omarchy/patches/` for 4.5 (`patches/omarchy` links only to the latter). Fixes for today's phones must go in `legacy-4.0.6/`, and also in `patches/` when applicable to 4.5. Its pacman hook (`95-omamobile-omarchy-patches.hook`, PostTransaction on `omarchy`, `omarchy-dev` and itself) re-applies it after every transaction that replaces Omarchy's files, and `rootfs/build-inside` runs the same tool, so image builds and upgrades take one code path. Every run starts from Omarchy's own files (checked against the package's mtree), applies the series in a scratch tree with `--fuzz=0`, verifies it by reversing it back to Omarchy's files, and only then swaps the files in. A patch whose reverse applies is already in Omarchy (a backport that landed): it is skipped and reported, and should be dropped from the series. Any other failure leaves Omarchy's files exactly as shipped, logs to `/var/log/omamobile/omarchy-patches.log` and notifies the user (the lock's PIN pad may be missing until a fixed series ships). A file that matches neither Omarchy's copy nor the last patched one was changed by something else and is never overwritten. **The update takes the phone's path.** Patch 0012 hands `omarchy update` to `omamobile-update`, which runs Omarchy's own `omarchy-update -y` unchanged, with stand-ins first on `PATH` for the steps that don't belong on a phone. Step by step: @@ -232,7 +232,7 @@ The same Alpine-based initramfs, with release differences: **The phone follows Omarchy's stable channel.** Phones installed before 2026-10-20 take `[omarchy]` from edge, which then carried 4.5.0rc1, a release candidate the phone's patches don't apply to. Switch before the next update, because the update would fetch the candidate in the same transaction as the fixed patches: `sudo sed -i 's|pkgs.omarchy.org/edge/|pkgs.omarchy.org/stable/|' /etc/pacman.conf && sudo rm -f /var/lib/pacman/sync/omarchy.db* /tmp/checkup-db-*/sync/omarchy.db*`. Removing edge's cached database matters: it is newer than stable's, so pacman's refresh keeps it and still offers the candidate. `omamobile-omarchy` 0.1.3's `omamobile-update` refuses an edge or rc `[omarchy]` and prints that line. Don't use Omarchy's own `omarchy-channel-set` or `omarchy-refresh-pacman` on the phone: they copy Omarchy's x86 `pacman.conf` and mirrorlist over the phone's (no `[omamobile]`, no Arch Linux ARM) and then upgrade everything. -**`[omamobile]` can hold Omarchy at a version the patches support.** `rootfs/packages.pinned` lists upstream package files by SHA-256 and URL (upstream's first, then our published copy, for when upstream prunes it); `tools/build-packages` adds them to `out/repo` unchanged, signed with the release key, so the daily publish carries them too; it refuses a pin with the name of a package we build, and `tools/release`'s packages stage refuses an index without every pin. `[omamobile]` comes first, so its copy wins over the newer one in `[omarchy]`: `omarchy update` (and `checkupdates`, behind the update toast) offers no newer Omarchy, and images install the pinned one. Since 2026-11-06 it holds `omarchy` and `omarchy-settings` at 4.0.6, because the series doesn't apply to 4.5 and 4.5's migrations install packages that replace ours (#433, #434). When a series for the new Omarchy ships, its line comes out and phones move on at their next update. A phone that already took the newer Omarchy keeps it: pacman doesn't downgrade on `-Syu`. +**`[omamobile]` can hold Omarchy at a version the patches support.** `rootfs/packages.pinned` lists upstream package files by SHA-256 and URL (upstream's first, then our published copy, for when upstream prunes it); `tools/build-packages` adds them to `out/repo` unchanged, signed with the release key, so the daily publish carries them too; it refuses a pin with the name of a package we build, and `tools/release`'s packages stage refuses an index without every pin. `[omamobile]` comes first, so its copy wins over the newer one in `[omarchy]`: `omarchy update` (and `checkupdates`, behind the update toast) offers no newer Omarchy, and images install the pinned one. Since 2026-11-06 it holds `omarchy` and `omarchy-settings` at 4.0.6, while the 4.5 companion changes and update validation remain pending (#433, #434); 4.5's migrations can install packages that replace ours. Once the new series and its companions are accepted, the maintainer moves the pins to the reviewed package versions and phones move on at their next update. A phone that already took the newer Omarchy keeps it: pacman doesn't downgrade on `-Syu`. **Recovering a phone that took Omarchy 4.0.6 with `omamobile-omarchy` 0.1.0.** Its migration 1791403252 ran: `[omarchy]` sits above `[omamobile]`, Omarchy's Hyprland replaced the phone's, and no phone patch applies (no PIN pad on the lock screen, `omarchy update` no longer handed over). `omamobile-update` then refuses on the repository order, so the fix goes in by hand, over SSH or in a terminal on the phone: @@ -281,7 +281,7 @@ For a first install, or to recover a phone that won't boot. One bundle per devic | Piece | Where | Notes | | --- | --- | --- | | aarch64 packages without a phone | `tools/build-packages` | makepkg in an Arch Linux ARM container (the official tarball, MD5 and signature checked against the pinned build key, `tools/lib/alarm.sh`) under the laptop's qemu-user; signs with `keys/` into `out/repo/aarch64`. Mesa, Hyprland and libcamera take hours this way, so they're built only when named, once per version | -| The device's root image | `tools/build-rootfs`, `rootfs/` | pacstrap in that container: `rootfs/packages.base`, then Omarchy's own `install/omarchy-base.packages` (minus `rootfs/packages.omarchy-skip` and what isn't built for aarch64), then `rootfs/packages.omamobile`, the device package and the board's `ROOTFS_PACKAGES`, the `[omamobile]` repository itself, the kernel modules of the current build, and `patches/omarchy`. Output `out/omamobile-rootfs---aarch64.img.zst`, `.sha256` and a `MANIFEST` with every package version (also inside, `/usr/share/omamobile/rootfs/MANIFEST`) | +| The device's root image | `tools/build-rootfs`, `rootfs/` | pacstrap in that container: `rootfs/packages.base`, then Omarchy's own `install/omarchy-base.packages` (minus `rootfs/packages.omarchy-skip` and what isn't built for aarch64), then `rootfs/packages.omamobile`, the device package and the board's `ROOTFS_PACKAGES`, the `[omamobile]` repository itself, the kernel modules of the current build, and `omamobile-omarchy`'s version-selected patch family. Output `out/omamobile-rootfs---aarch64.img.zst`, `.sha256` and a `MANIFEST` with every package version (also inside, `/usr/share/omamobile/rootfs/MANIFEST`) | | First boot | `packages/omamobile-firstboot` | reads `/etc/omamobile/firstboot.conf` (data, never sourced), creates the user, SSH keys, ufw with SSH on `usb0`, runs Omarchy's own setup leaves (skipping four that don't fit a phone), SDDM autologin and the lock, Omarchy's and our user setup, then deletes the file | | Growing the root | `initramfs/init` (`grow_root`) | `resize2fs` before mounting, only for a file system labelled `omamobile-root` smaller than its partition; `omamobile.noresize` skips it | | The installer | `tools/install-phone` (the bundle's `install`) | as described below, steps 1, 3-5; the factory-image step (2) is `tools/phone-provision` after the first boot instead | diff --git a/packages/omamobile-omarchy/LICENSE.omarchy b/packages/omamobile-omarchy/LICENSE.omarchy new file mode 100644 index 000000000..f12cfa766 --- /dev/null +++ b/packages/omamobile-omarchy/LICENSE.omarchy @@ -0,0 +1,20 @@ +Copyright (c) David Heinemeier Hansson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/omamobile-omarchy/bin/omamobile-omarchy-patches b/packages/omamobile-omarchy/bin/omamobile-omarchy-patches index 8c081a442..a5a180cf6 100755 --- a/packages/omamobile-omarchy/bin/omamobile-omarchy-patches +++ b/packages/omamobile-omarchy/bin/omamobile-omarchy-patches @@ -7,9 +7,10 @@ omamobile-omarchy-patches verify [--root DIR] omamobile-omarchy-patches restore [--root DIR] Omarchy's own files back -The series (/usr/share/omamobile/omarchy/patches, *.patch in name order) is -written against Omarchy's source tree. Every run starts again from Omarchy's -own files, never from the patched ones: +The installed Omarchy version selects the series under +/usr/share/omamobile/omarchy: legacy-4.0.6/ for 4.0.6, patches/ for 4.5. +Each family applies *.patch in name order against Omarchy's source tree. +Every run starts again from Omarchy's own files, never from the patched ones: 1. Pristine files. For each file the series touches (and each file an earlier run touched), Omarchy's version as shipped: the file on disk if @@ -500,6 +501,21 @@ def reverse_recover(root, rels, owned, series_dirs, work, log): return {} +def default_series(root, packages): + """Only the two independently qualified source families have a series. + + Keep 4.0.6 available while preparing an upgrade; never apply 4.5 contexts + to the currently running old package. Explicit --series remains the + offline prospective rehearsal interface. + """ + families = {v.rsplit("-", 1)[0] for _n, v, _p in packages} + if families == {"4.0.6"}: + return os.path.join(root, "usr/share/omamobile/omarchy/legacy-4.0.6") + if families == {"4.5.0"}: + return os.path.join(root, SERIES) + raise Failure("Omarchy version has no qualified mobile patch series; refusing") + + def apply(root, series_dir, log, hook=False): state_dir = os.path.join(root, STATE_DIR) os.makedirs(state_dir, exist_ok=True) @@ -517,6 +533,9 @@ def apply(root, series_dir, log, hook=False): status["omarchy"] = " ".join("%s %s" % (n, v) for n, v, _ in packages) previous = load_json(os.path.join(state_dir, "state.json")) or {} try: + if series_dir is None: + series_dir = default_series(root, packages) + status["series"] = "/" + os.path.relpath(series_dir, root) patches, series_hash = load_series(series_dir, root) except Failure as e: return fail(root, status, e, log, hook) @@ -805,7 +824,7 @@ def main(argv): if cmd == "apply": log = Log(root, quiet) try: - return apply(root, series or os.path.join(root, SERIES), log, hook) + return apply(root, series, log, hook) except Failure as e: return fail(root, {"time": now(), "log": "/" + LOG, "applied": [], "upstream": [], "omarchy": None}, e, log, hook) if cmd == "restore": diff --git a/packages/omamobile-omarchy/install b/packages/omamobile-omarchy/install index 110562919..86d11d0d2 100755 --- a/packages/omamobile-omarchy/install +++ b/packages/omamobile-omarchy/install @@ -28,4 +28,8 @@ for f in patches/*.patch; do done install -Dm644 libalpm/95-omamobile-omarchy-patches.hook "$d/usr/share/libalpm/hooks/95-omamobile-omarchy-patches.hook" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-omarchy/LICENSE" +install -Dm644 LICENSE.omarchy "$d/usr/share/licenses/omamobile-omarchy/omarchy-MIT" install -Dm644 version "$d/usr/share/omamobile/omarchy/version" +for f in legacy-4.0.6/*.patch; do + install -Dm644 "$f" "$d/usr/share/omamobile/omarchy/legacy-4.0.6/${f##*/}" +done diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch b/packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch new file mode 100644 index 000000000..d879205b4 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch @@ -0,0 +1,15 @@ +# First run: a platform without a keyboard-first workflow (a phone) skips the +# "Learn Keybindings" welcome; omamobile-setup-user marks +# welcome-keybindings-not-applicable. Sent upstream as omacom/omarchy#15075. + +--- a/install/user/first-run/welcome.sh ++++ b/install/user/first-run/welcome.sh +@@ -1,3 +1,8 @@ ++# A platform without a keyboard-first workflow (a phone, say) opts out of the ++# keybindings introduction from its user setup: omarchy-done mark ++# welcome-keybindings-not-applicable. ++omarchy-done check welcome-keybindings-not-applicable && exit 0 ++ + # Real newlines, not a literal \n: the card renders the body as it arrives, and + # elides past three lines. + omarchy-notification-send -u critical -g  "Learn Keybindings" \ diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch new file mode 100644 index 000000000..131ac771a --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch @@ -0,0 +1,278 @@ +# Lock screen: a number pad for touch-only devices (the lock-keypad toggle), +# kept clear of an under-display fingerprint sensor, with a hint that either +# unlocks. The session lock hides every other surface, on-screen keyboards +# included, so a phone needs its own digits; a PIN is a numeric password. +# +# Against Omarchy 4.0.4 (the edge channel's aarch64 omarchy 4.0.4-2, the same +# files as tag v4.0.4) with 0000 (Commons.Color) applied. 4.0.4 has no +# "Fingerprint reader unavailable" notice, so the hunk that moved it above +# the field is gone and the hint shows whenever fingerprints are set up. +diff --git i/shell/plugins/lock/Keypad.qml w/shell/plugins/lock/Keypad.qml +new file mode 100644 +index 0000000..98ad1ad +--- /dev/null ++++ w/shell/plugins/lock/Keypad.qml +@@ -0,0 +1,73 @@ ++import QtQuick ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++ ++// Number pad for touch-only devices (phones, tablets), where the lock screen ++// can't count on a keyboard: the session lock hides every other surface, ++// on-screen keyboards included. Enabled by the `lock-keypad` toggle; the digits ++// go into the same password field, so a PIN is simply a numeric password. ++Item { ++ id: root ++ ++ signal digit(string value) ++ signal backspace() ++ signal enter() ++ ++ // The tallest the pad may be: on a short screen the keys shrink to fit ++ // rather than run under the field above them. ++ property real maxHeight: Infinity ++ ++ // Four rows of keys and three gaps of 0.3 keys: 4.9 keys tall. ++ readonly property int key: Math.round(Math.min(Style.space(84), (parent ? parent.width : 420) * 0.22, maxHeight / 4.9)) ++ readonly property int gap: Math.round(key * 0.3) ++ readonly property var keys: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "back", "0", "enter"] ++ readonly property var keySpec: Border.surfaceSpec("lock", "border-active", Commons.Color.lock.borderActive, 2, "border-alpha") ++ ++ implicitWidth: key * 3 + gap * 2 ++ implicitHeight: key * 4 + gap * 3 ++ width: implicitWidth ++ height: implicitHeight ++ opacity: enabled ? 1 : 0.5 ++ ++ Grid { ++ anchors.fill: parent ++ columns: 3 ++ spacing: root.gap ++ ++ Repeater { ++ model: root.keys ++ ++ delegate: BorderSurface { ++ id: keyCap ++ required property string modelData ++ ++ width: root.key ++ height: root.key ++ radius: Style.cornerRadius ++ color: tap.pressed ? Commons.Color.lock.selection : Commons.Color.lock.background ++ borderSpec: root.keySpec ++ ++ Text { ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: keyCap.modelData === "back" ? "⌫" : (keyCap.modelData === "enter" ? "⏎" : keyCap.modelData) ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Math.round(root.key * 0.38) ++ } ++ ++ MouseArea { ++ id: tap ++ anchors.fill: parent ++ enabled: root.enabled ++ onClicked: { ++ if (keyCap.modelData === "back") root.backspace() ++ else if (keyCap.modelData === "enter") root.enter() ++ else root.digit(keyCap.modelData) ++ } ++ } ++ } ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +index 3c5f65d..53eef73 100644 +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -17,8 +17,16 @@ Item { + property bool loadBackground: true + property string passwordText: "" + property bool syncingPasswordText: false ++ // Touch-only devices: a number pad under the field (the lock-keypad toggle). ++ property bool keypad: false ++ // A phone with a fingerprint sensor under the display has it in the lower ++ // third of the screen, where the pad would otherwise sit: a finger on the ++ // sensor pressed a key. With fingerprints set up, the pad keeps the lower ++ // third clear, and a hint above the field says either works, as on Android. ++ readonly property bool keypadClearsSensor: keypad && fingerprintConfigured ++ readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) + +- readonly property string placeholderText: "Enter Password" ++ readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" + readonly property int fieldWidth: 381 + readonly property int fieldHeight: 67 + readonly property int outlineThickness: 3 +@@ -54,7 +62,8 @@ Item { + } + + function forcePasswordFocus() { +- passwordInput.forceActiveFocus() ++ if (keypad) keypadKeys.forceActiveFocus() ++ else passwordInput.forceActiveFocus() + } + + function clearPassword() { +@@ -115,16 +124,58 @@ Item { + + MouseArea { + anchors.fill: parent +- hoverEnabled: true ++ hoverEnabled: !root.keypad + onClicked: { root.wakeRequested(); root.forcePasswordFocus() } + onPositionChanged: root.wakeRequested() + } + ++ Item { ++ id: keypadKeys ++ Keys.onPressed: function(event) { ++ if (!numberPad.enabled) return ++ if (event.text.length === 1 && event.text >= "0" && event.text <= "9") numberPad.digit(event.text) ++ else if (event.key === Qt.Key_Backspace) numberPad.backspace() ++ else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) numberPad.enter() ++ else if (event.key === Qt.Key_Escape) root.passwordTextEdited("") ++ else return ++ event.accepted = true ++ } ++ } ++ ++ Keypad { ++ id: numberPad ++ visible: root.keypad ++ enabled: root.inputEnabled && !root.authenticatingPassword ++ anchors.horizontalCenter: parent.horizontalCenter ++ anchors.bottom: parent.bottom ++ anchors.bottomMargin: root.keypadBottomMargin ++ // what is left above it for the field, the hint and a margin ++ maxHeight: parent.height - root.keypadBottomMargin - root.fieldHeight - Style.space(40) ++ - (root.keypadClearsSensor ? keypadHint.height + Style.space(18) : 0) - Style.space(48) ++ onDigit: function(value) { ++ root.wakeRequested() ++ if (root.failureMessage.length > 0) root.clearFailureRequested() ++ root.passwordTextEdited(root.passwordText + value) ++ } ++ onBackspace: { ++ root.wakeRequested() ++ root.passwordTextEdited(root.passwordText.slice(0, -1)) ++ } ++ onEnter: { ++ var submitted = root.passwordText ++ root.passwordTextEdited("") ++ if (submitted.length > 0) root.submitPassword(submitted) ++ } ++ } ++ + BorderSurface { + id: inputField + width: root.fieldWidth + height: root.fieldHeight +- anchors.centerIn: parent ++ anchors.horizontalCenter: parent.horizontalCenter ++ anchors.verticalCenter: root.keypad ? undefined : parent.verticalCenter ++ anchors.bottom: root.keypad ? numberPad.top : undefined ++ anchors.bottomMargin: root.keypad ? Style.space(40) : 0 + color: Commons.Color.lock.background + borderSpec: root.inputBorderSpec + radius: Style.cornerRadius +@@ -141,7 +192,7 @@ Item { + anchors.leftMargin: inputField.borderLeft + 18 + root.fingerprintReserve + verticalAlignment: TextInput.AlignVCenter + horizontalAlignment: TextInput.AlignHCenter +- activeFocusOnPress: true ++ activeFocusOnPress: !root.keypad + clip: true + enabled: root.inputEnabled && !root.authenticatingPassword + readOnly: root.authenticatingPassword +@@ -216,5 +267,23 @@ Item { + verticalAlignment: Text.AlignVCenter + } + } ++ ++ // Touch-only devices with fingerprints: say that either unlocks. ++ Text { ++ id: keypadHint ++ objectName: "keypadFingerprintHint" ++ textFormat: Text.PlainText ++ anchors.bottom: inputField.top ++ anchors.bottomMargin: Style.space(18) ++ anchors.horizontalCenter: inputField.horizontalCenter ++ width: parent.width - Style.space(32) ++ visible: root.keypadClearsSensor ++ text: "Touch the fingerprint sensor or enter your PIN" ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ wrapMode: Text.WordWrap ++ horizontalAlignment: Text.AlignHCenter ++ } + } + } +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +index 65fcb19..95726eb 100644 +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -23,6 +23,7 @@ Item { + property bool fingerprintAuthenticating: false + property bool passwordPamConfigured: false + property bool fingerprintConfigured: false ++ property bool keypad: false + property bool previewVisible: false + property string enteredPassword: "" + property string pendingPassword: "" +@@ -127,6 +128,7 @@ Item { + } + + function beginLock() { ++ keypadToggle.reload() + if (!passwordPamConfigured) { + logEvent("lock-denied: missing-pam") + return false +@@ -267,6 +269,7 @@ Item { + color: Commons.Color.background + + LockView { ++ keypad: root.keypad + id: lockView + anchors.fill: parent + backgroundPath: root.backgroundPath +@@ -298,6 +301,7 @@ Item { + exclusionMode: ExclusionMode.Ignore + + LockView { ++ keypad: root.keypad + anchors.fill: parent + backgroundPath: root.backgroundPath + backgroundVersion: root.backgroundVersion +@@ -414,7 +418,8 @@ Item { + + Timer { + id: idleBlankTimer +- interval: 5000 ++ // Touch-only devices (the number pad) get longer to find and use it. ++ interval: root.keypad ? 10000 : 5000 + repeat: false + property double armedAt: 0 + onTriggered: { +@@ -482,6 +487,17 @@ Item { + else armBlankTimer() + } + ++ // Touch-only devices opt into the number pad: omarchy-toggle lock-keypad. ++ FileView { ++ id: keypadToggle ++ path: root.stateHome + "/omarchy/toggles/lock-keypad" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.keypad = true ++ onLoadFailed: root.keypad = false ++ onFileChanged: reload() ++ } ++ + FileView { + path: "/etc/pam.d/omarchy-lock-password" + watchChanges: true diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch b/packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch new file mode 100644 index 000000000..7deb48d2b --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch @@ -0,0 +1,76 @@ +# Touch screens: swipe through the image picker (backgrounds, themes), fit it +# to a narrow screen, and hold the desktop for the Style menu (there is no +# right button or keyboard shortcut on a phone). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4) with 0000 (Commons.Color) +# applied: only the context of the picker's size properties differs from +# upstream main. +diff --git i/shell/plugins/background/Background.qml w/shell/plugins/background/Background.qml +index 0a53b20..546aaaf 100644 +--- i/shell/plugins/background/Background.qml ++++ w/shell/plugins/background/Background.qml +@@ -105,6 +105,15 @@ Item { + if (!bgSwitchProc.running) bgSwitchProc.running = true + } + ++ function openStyleMenu() { ++ if (!styleMenuProc.running) styleMenuProc.running = true ++ } ++ ++ Process { ++ id: styleMenuProc ++ command: ["omarchy-menu", "summon", "style"] ++ } ++ + function openThemeSwitcher() { + if (!themeSwitchProc.running) themeSwitchProc.running = true + } +@@ -313,6 +322,10 @@ Item { + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton ++ onPressAndHold: function(mouse) { ++ root.openStyleMenu() ++ mouse.accepted = true ++ } + onDoubleClicked: function(mouse) { + if (mouse.button === Qt.RightButton) root.openThemeSwitcher() + else root.openSelector() +diff --git i/shell/plugins/image-picker/ImagePicker.qml w/shell/plugins/image-picker/ImagePicker.qml +index b0554f5..0f735f6 100644 +--- i/shell/plugins/image-picker/ImagePicker.qml ++++ w/shell/plugins/image-picker/ImagePicker.qml +@@ -39,10 +39,11 @@ Item { + property color scrim: Commons.Color.imagePicker.scrim + property color selectedBorder: Commons.Color.imagePicker.selectedBorder + property color unselectedBorder: Commons.Color.imagePicker.unselectedBorder +- property int expandedWidth: 768 +- property int expandedHeight: 475 ++ // Fit narrow screens (phones): never wider than the window allows. ++ property int expandedWidth: panel.width > 0 ? Math.min(768, panel.width - 96) : 768 ++ property int expandedHeight: Math.round(475 * expandedWidth / 768) + property int sliceWidth: 108 +- property int sliceHeight: 432 ++ property int sliceHeight: Math.round(432 * expandedWidth / 768) + property int sliceSpacing: -30 + property int skewOffset: 28 + property int bottomChromeHeight: showLabels ? (filterable ? 104 : 74) : (filterable ? 60 : 30) +@@ -435,6 +436,18 @@ Item { + + Component.onCompleted: forceActiveFocus() + ++ // Swipe left or right to move through the images on touch screens. ++ DragHandler { ++ target: null ++ yAxis.enabled: false ++ property real swipeX: 0 ++ onActiveTranslationChanged: swipeX = activeTranslation.x ++ onActiveChanged: { ++ if (active) swipeX = 0 ++ else if (Math.abs(swipeX) > 40) root.selectAdjacent(swipeX < 0 ? 1 : -1) ++ } ++ } ++ + Repeater { + model: root.imageArray.length + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch b/packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch new file mode 100644 index 000000000..6183995da --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch @@ -0,0 +1,158 @@ +# Screensaver on a phone: turn squeekboard off while it runs (it popped up for +# the screensaver's terminal) and back on after, once the lock is up with +# lock-after-screensaver; restore the cursor as it was (a touch device keeps +# it hidden); a tap ends it; waking it goes straight to the lock; make sure +# its window is fullscreen; a user foot config wins. +# +# The launcher turns the keyboard back on from an EXIT trap, so no way out +# of it (an early exit, a signal from the idle service or a shell restart, +# no screensaver coming up) leaves the keyboard off with nothing to restore +# it, and it leaves the setting alone when the session is already locked. +# A phone that found the keyboard off with no screensaver running and the +# marker gone (TOUCH-PLAN 0.5) is what this closes; omamobile-shell's +# omamobile-osk-guard is the safety net behind it. +# +# Against Omarchy 4.0.6 (stable 4.0.6-1). +diff --git i/bin/omarchy-launch-screensaver w/bin/omarchy-launch-screensaver +--- i/bin/omarchy-launch-screensaver ++++ w/bin/omarchy-launch-screensaver +@@ -15,6 +15,32 @@ + fi + + focused=$(omarchy-hyprland-monitor-focused) ++ ++# Touch devices: an on-screen keyboard (squeekboard) pops up for whatever ++# terminal has focus, the screensaver's included. Turn it off; the ++# screensaver turns it back on when it exits (the marker says it should). ++# A locked session leaves it alone: the screensaver can't take focus from ++# the lock and exits at once. ++osk_key="org.gnome.desktop.a11y.applications screen-keyboard-enabled" ++osk_marker="${XDG_RUNTIME_DIR:-/tmp}/omarchy-screensaver-osk-off" ++ ++# Every way out of this launcher (an early exit, a signal from the idle ++# service or a shell restart, no screensaver coming up) turns the keyboard ++# back on, unless a screensaver runs to do it when it exits. ++restore_osk_unless_running() { ++ if [[ -f $osk_marker ]] && ! pgrep -f '[o]rg.omarchy.screensaver' >/dev/null; then ++ rm -f "$osk_marker" ++ gsettings set $osk_key true ++ fi ++} ++ ++if [[ $(omarchy-shell lock isLocked 2>/dev/null) != true ]] && ++ busctl --user status sm.puri.OSK0 &>/dev/null && [[ $(gsettings get $osk_key 2>/dev/null) == true ]]; then ++ trap restore_osk_unless_running EXIT ++ trap 'exit 1' INT TERM HUP ++ touch "$osk_marker" ++ gsettings set $osk_key false ++fi + terminal=$(xdg-terminal-exec --print-id) + + case $terminal in +@@ -64,7 +90,10 @@ + hypr_exec ghostty --class=org.omarchy.screensaver --config-file="$OMARCHY_PATH/default/ghostty/screensaver" --font-size=18 -e omarchy-screensaver + ;; + *foot*) +- hypr_exec foot --app-id=org.omarchy.screensaver --config="$OMARCHY_PATH/default/foot/screensaver.ini" -e omarchy-screensaver ++ # A user copy wins, e.g. a smaller font on a narrow screen. ++ foot_config="$OMARCHY_PATH/default/foot/screensaver.ini" ++ [[ -f ~/.config/foot/screensaver.ini ]] && foot_config=~/.config/foot/screensaver.ini ++ hypr_exec foot --app-id=org.omarchy.screensaver --config="$foot_config" -e omarchy-screensaver + ;; + *kitty*) + hypr_exec kitty --class=org.omarchy.screensaver --override font_size=18 --override window_padding_width=0 -e omarchy-screensaver +diff --git i/bin/omarchy-screensaver w/bin/omarchy-screensaver +--- i/bin/omarchy-screensaver ++++ w/bin/omarchy-screensaver +@@ -6,8 +6,34 @@ + hyprctl activewindow -j | jq -e '.class == "org.omarchy.screensaver"' >/dev/null 2>&1 + } + ++# Put the cursor back the way it was: a touch device keeps it hidden. ++cursor_was_invisible=$(hyprctl getoption cursor:invisible -j 2>/dev/null | jq -r '.bool // (.int == 1)' 2>/dev/null) ++ ++restore_cursor() { ++ if [[ $cursor_was_invisible != true ]]; then ++ hyprctl eval 'hl.config({ cursor = { invisible = false } })' &>/dev/null || hyprctl keyword cursor:invisible false &>/dev/null || true ++ fi ++} ++ ++# Turn the on-screen keyboard back on if omarchy-launch-screensaver turned it off. ++# With lock-after-screensaver, wait until the lock screen is up: until then this ++# terminal still has focus and the keyboard would flash on the way out. ++restore_osk() { ++ local marker="${XDG_RUNTIME_DIR:-/tmp}/omarchy-screensaver-osk-off" ++ [[ -f $marker ]] || return 0 ++ rm -f "$marker" ++ local enable="gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" ++ if omarchy-toggle-enabled lock-after-screensaver; then ++ # Detached: this script is about to be stopped by the lock. ++ setsid -f bash -c "for _ in \$(seq 50); do omarchy-shell lock status 2>/dev/null | grep -q '\"secure\":true' && break; sleep 0.1; done; $enable" &>/dev/null ++ else ++ $enable &>/dev/null || true ++ fi ++} ++ + exit_screensaver() { +- hyprctl eval 'hl.config({ cursor = { invisible = false } })' &>/dev/null || hyprctl keyword cursor:invisible false &>/dev/null || true ++ restore_cursor ++ restore_osk + pkill -x ttfx 2>/dev/null + pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null + exit 0 +@@ -17,6 +43,9 @@ + trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT + + printf '\033]11;rgb:00/00/00\007' # Set background color to black ++# Report mouse clicks (and touches) as input, so a tap ends the screensaver ++# like a key press does. Turned back off on exit. ++printf '\033[?1000h' + + hyprctl eval 'hl.config({ cursor = { invisible = true } })' &>/dev/null || hyprctl keyword cursor:invisible true &>/dev/null + +@@ -33,6 +62,17 @@ + done + } + ++# The window rule makes the screensaver fullscreen, but a surface that holds ++# focus as it opens (e.g. a launcher being dismissed) can leave it a plain ++# floating window. Make sure, before measuring the terminal. ++ensure_fullscreen() { ++ local window ++ window=$(hyprctl clients -j 2>/dev/null | jq -r '[.[] | select(.class == "org.omarchy.screensaver" and .fullscreen == 0)][0].address // empty') ++ [[ -n $window ]] && hyprctl dispatch "hl.dsp.window.fullscreen({ mode = \"fullscreen\", window = \"address:$window\" })" &>/dev/null ++ return 0 ++} ++ ++ensure_fullscreen + wait_for_terminal_resize + + while true; do +@@ -41,7 +81,26 @@ + --random-effect --no-eol --no-restore-cursor & + + while pgrep -t "${tty#/dev/}" -x ttfx >/dev/null; do +- if read -n1 -t 1 || ! screensaver_in_focus; then ++ if read -n1 -t 1; then ++ # Woken by the user: devices that lock on wake (the ++ # lock-after-screensaver toggle, e.g. phones) go straight to the lock. ++ printf '\033[?1000l' ++ if omarchy-toggle-enabled lock-after-screensaver; then ++ # The lock stops this screensaver itself, before exit_screensaver. ++ restore_cursor ++ restore_osk ++ # Bring the lock up first and let this screensaver stand in front of it ++ # until it's there (it takes a moment to settle); omarchy-system-lock ++ # then stops the screensaver. Otherwise the desktop shows in between. ++ omarchy-shell lock lock >/dev/null 2>&1 ++ for _ in $(seq 30); do ++ omarchy-shell lock status 2>/dev/null | grep -q '"secure":true' && break ++ sleep 0.1 ++ done ++ omarchy-system-lock ++ fi ++ exit_screensaver ++ elif ! screensaver_in_focus; then + exit_screensaver + fi + done diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch b/packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch new file mode 100644 index 000000000..4afb85828 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch @@ -0,0 +1,40 @@ +# Lock as soon as the user returns to the screensaver (lock-after-screensaver). +# Refreshed against Omarchy 4.0.6 (edge 4.0.6-1) so it applies without fuzz; +# the hunk lands where the fuzzed one did, before the main idle monitor. +diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml +index 8fb45a6..d694ab9 100644 +--- i/shell/plugins/services/idle/Service.qml ++++ w/shell/plugins/services/idle/Service.qml +@@ -266,6 +266,32 @@ Item { + // With both timeouts at 0 the monitor stops reporting, so nothing else would end a running cycle. + onIdleTimersEnabledChanged: if (!idleTimersEnabled) cancelIdleCycle("idle-timers-disabled") + ++ // Devices that lock on wake (the lock-after-screensaver toggle, e.g. phones) ++ // lock as soon as the user comes back to the screensaver. Starting the ++ // screensaver counts as activity for the main monitor, so it can't tell; this ++ // one only runs while the screensaver is on screen, goes idle after 2 s, and ++ // its next activity is the user: any tap, swipe or key, even ones the ++ // screensaver's terminal never sees. ++ IdleMonitor { ++ id: screensaverWakeMonitor ++ enabled: root.idleEnabled && root.screensaverWindowCount > 0 ++ timeout: 2 ++ respectInhibitors: false ++ property bool settled: false ++ onEnabledChanged: settled = false ++ onIsIdleChanged: { ++ if (isIdle) { ++ settled = true ++ } else if (settled) { ++ settled = false ++ root.logEvent("screensaver-wake", "user returned") ++ // Lock first and stop the screensaver only once the lock is up, so ++ // the desktop doesn't show in between. ++ root.runProcess(lockProcess, "lock-on-wake", "omarchy-toggle-enabled lock-after-screensaver || exit 0; omarchy-shell lock lock >/dev/null; for _ in $(seq 30); do omarchy-shell lock status | grep -q '\"secure\":true' && break; sleep 0.1; done; omarchy-system-lock") ++ } ++ } ++ } ++ + IdleMonitor { + id: idleMonitor + enabled: root.idleEnabled && root.idleTimersEnabled diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch b/packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch new file mode 100644 index 000000000..922444404 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch @@ -0,0 +1,37 @@ +# Brightness: panels whose backlight driver can power them down follow DPMS +# through bl_power (4 off, 0 on): on the phone, DPMS alone doesn't reach a +# panel run from the bootloader's framebuffer. Only where the user may write +# bl_power (the device package's udev rule). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/bin/omarchy-brightness-display w/bin/omarchy-brightness-display +index 5a3e534..3c754bb 100755 +--- i/bin/omarchy-brightness-display ++++ w/bin/omarchy-brightness-display +@@ -82,12 +82,26 @@ if (( $# == 0 )); then + exit + fi + ++# Panels whose backlight driver can power them down follow DPMS (bl_power: 4 is ++# off, 0 is on). Phones on a bootloader framebuffer need it: DPMS there doesn't ++# reach the panel. Only where the device lets this user write bl_power. ++panel_power() { ++ local device bl ++ device="$(omarchy-hw-display 2>/dev/null)" || return 0 ++ bl="${OMARCHY_BACKLIGHT_PATH:-/sys/class/backlight}/$device/bl_power" ++ [[ -w $bl ]] && echo "$1" >"$bl" 2>/dev/null ++ return 0 ++} ++ + step="$1" + + if [[ $step == "off" ]]; then + hyprctl dispatch 'hl.dsp.dpms({ action = "disable" })' >/dev/null 2>&1 ++ panel_power 4 + exit 0 + elif [[ $step == "on" ]]; then ++ # Before the check below: Hyprland can show a lit display whose panel is off. ++ panel_power 0 + # Skip the dispatch when every active display is already lit: a redundant + # DPMS enable right after system resume forces another modeset, which blanks + # the panel for a beat (visible flash at the unlock screen). diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch b/packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch new file mode 100644 index 000000000..1cc9b0d69 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch @@ -0,0 +1,24 @@ +# Lock: a "wake" IPC call that lights the locked display and re-arms its +# blank timer, as input on the lock screen does, for hardware keys (the +# phone's power button, through omamobile-keys). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +index ccd496a..113b40d 100644 +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -848,6 +848,14 @@ Item { + return "ok" + } + ++ // Wake the locked display the way input on the lock screen does: light ++ // it and re-arm the blank timer (a phone's power button). ++ function wake(): string { ++ if (!root.currentlyLocked()) return "unlocked" ++ root.runWake() ++ return "ok" ++ } ++ + function isLocked(): string { + return root.currentlyLocked() ? "true" : "false" + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch b/packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch new file mode 100644 index 000000000..419dc7856 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch @@ -0,0 +1,63 @@ +# Polkit prompt usable with an on-screen keyboard: on the top layer with +# OnDemand focus and normal exclusion, so squeekboard is drawn above it, gets +# its touches and keeps its reserved area; the field is re-focused after a +# wrong password so the keyboard shows again (FINGERPRINT-PLAN.md). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml +index acd6514c..e98356dd 100644 +--- i/shell/plugins/polkit/PolkitAgent.qml ++++ w/shell/plugins/polkit/PolkitAgent.qml +@@ -103,8 +103,16 @@ Item { + if (!dialogVisible) return + // In fingerprint mode there is no field to type into — park focus on the + // key catcher so Escape still cancels; otherwise focus the password field. +- if (fingerprintMode) keyCatcher.forceActiveFocus() +- else passwordInput.forceActiveFocus() ++ if (fingerprintMode) { ++ keyCatcher.forceActiveFocus() ++ return ++ } ++ // A field that already has focus gets no new focus-in, so the input ++ // method (an on-screen keyboard) is not asked to show again: after a ++ // wrong password the field was read-only for a moment, the keyboard hid, ++ // and tapping the field did not bring it back. Move focus off and back. ++ if (passwordInput.activeFocus) keyCatcher.forceActiveFocus() ++ passwordInput.forceActiveFocus() + } + + function submitResponse() { +@@ -149,7 +157,11 @@ Item { + id: errorTimer + interval: 1200 + repeat: false +- onTriggered: root.errorFlash = false ++ onTriggered: { ++ root.errorFlash = false ++ // writable again: re-focus so an on-screen keyboard shows again ++ Qt.callLater(root.refocus) ++ } + } + + SequentialAnimation { +@@ -225,9 +237,17 @@ Item { + anchors { top: true; bottom: true; left: true; right: true } + color: "transparent" + WlrLayershell.namespace: "omarchy-polkit" +- WlrLayershell.layer: WlrLayer.Overlay +- WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive +- exclusionMode: ExclusionMode.Ignore ++ // Top, not Overlay: an on-screen keyboard (squeekboard) is a top-layer ++ // surface that maps when the field takes focus, after this one, so it is ++ // drawn above the prompt; on the overlay layer the prompt covered it. ++ WlrLayershell.layer: WlrLayer.Top ++ // OnDemand still takes the keyboard when the prompt maps. Exclusive would ++ // also send every touch to this surface, so an on-screen keyboard (a ++ // touch-only device's only way to type the password) could not be used. ++ WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand ++ // Normal: stay out of other surfaces' exclusive zones, such as the area ++ // an on-screen keyboard reserves. ++ exclusionMode: ExclusionMode.Normal + + Rectangle { + anchors.fill: parent diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch b/packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch new file mode 100644 index 000000000..acf09eb32 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch @@ -0,0 +1,305 @@ +# PIN or password, the user's choice (on 0003 and 0010). The lock starts on +# the number pad for a PIN and on the text field with the on-screen keyboard +# for a password (the credential-password toggle); ABC/123 in the field swaps +# them. In pad mode the lock folds squeekboard (sm.puri.OSK0 SetVisible +# false) at lock, after each attempt and on 123, without touching the field, +# its focus or the PIN. The polkit prompt asks squeekboard for its digit +# layout for a PIN, with a 123/ABC switch, and a tap refocuses the field. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), which has 0000's Commons.Color fix: +# with the series, LockView.qml is byte for byte the phone's tested file +# (4c72b5be..., F16b). +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +index 53eef73..1f1b3b0 100644 +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -1,5 +1,7 @@ + import QtQuick + import QtQuick.Effects ++import Quickshell ++import Quickshell.Io + import qs.Commons + import qs.Commons as Commons + import qs.Ui +@@ -24,9 +26,18 @@ Item { + // sensor pressed a key. With fingerprints set up, the pad keeps the lower + // third clear, and a hint above the field says either works, as on Android. + readonly property bool keypadClearsSensor: keypad && fingerprintConfigured ++ // A password rather than a PIN (the credential-password toggle): the lock ++ // starts on the text field and the on-screen keyboard instead of the pad. ++ // The ABC/123 switch in the field swaps either way, so a password with ++ // letters and digits can always be typed. ++ property bool passwordFirst: false ++ property bool switchedInput: false ++ readonly property bool padShown: keypad && (passwordFirst === switchedInput) ++ readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 ++ readonly property real fieldSideReserve: Math.max(fingerprintReserve, inputSwitchReserve) + readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) + +- readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" ++ readonly property string placeholderText: padShown ? "Enter PIN" : "Enter Password" + readonly property int fieldWidth: 381 + readonly property int fieldHeight: 67 + readonly property int outlineThickness: 3 +@@ -62,8 +73,53 @@ Item { + } + + function forcePasswordFocus() { +- if (keypad) keypadKeys.forceActiveFocus() +- else passwordInput.forceActiveFocus() ++ if (padShown) { ++ keypadKeys.forceActiveFocus() ++ return ++ } ++ // A field that already has focus gets no new focus-in, so an on-screen ++ // keyboard that hid (a failed attempt disables the field) is not asked ++ // back. Move focus off and back. ++ if (keypad && passwordInput.activeFocus) keypadKeys.forceActiveFocus() ++ passwordInput.forceActiveFocus() ++ } ++ ++ function switchInput() { ++ switchedInput = !switchedInput ++ wakeRequested() ++ Qt.callLater(forcePasswordFocus) ++ } ++ ++ onAuthenticatingPasswordChanged: { ++ if (!authenticatingPassword && keypad && !padShown) Qt.callLater(forcePasswordFocus) ++ if (!authenticatingPassword && padShown) foldTimer.restart() ++ } ++ ++ // A number-pad lock wants no on-screen keyboard, but one can show over the ++ // lock (it is allowed there for the ABC switch) when the field's input ++ // method wakes up: at lock and after each attempt. Fold it then ++ // (squeekboard's sm.puri.OSK0; harmless without it). Nothing here touches ++ // the field, its focus or the PIN. ++ function foldKeyboard() { ++ Quickshell.execDetached(["busctl", "--user", "call", "sm.puri.OSK0", "/sm/puri/OSK0", ++ "sm.puri.OSK0", "SetVisible", "b", "false"]) ++ } ++ onPadShownChanged: if (padShown) foldTimer.restart() ++ Timer { ++ id: foldTimer ++ interval: 400 ++ // only on a lock taking input (not the style preview's copy) ++ running: root.padShown && root.inputEnabled ++ onTriggered: if (root.padShown && root.inputEnabled) root.foldKeyboard() ++ } ++ ++ FileView { ++ path: Quickshell.env("HOME") + "/.local/state/omarchy/toggles/credential-password" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.passwordFirst = true ++ onLoadFailed: root.passwordFirst = false ++ onFileChanged: reload() + } + + function clearPassword() { +@@ -144,7 +200,7 @@ Item { + + Keypad { + id: numberPad +- visible: root.keypad ++ visible: root.padShown + enabled: root.inputEnabled && !root.authenticatingPassword + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom +@@ -173,9 +229,14 @@ Item { + width: root.fieldWidth + height: root.fieldHeight + anchors.horizontalCenter: parent.horizontalCenter +- anchors.verticalCenter: root.keypad ? undefined : parent.verticalCenter +- anchors.bottom: root.keypad ? numberPad.top : undefined +- anchors.bottomMargin: root.keypad ? Style.space(40) : 0 ++ // Placed with y, not anchors that come and go: the ABC/123 switch ++ // changes the layout while the lock is up, and a field anchored at both ++ // ends for a moment kept the squashed height. Above the pad; without ++ // it (a password, the on-screen keyboard below) high on the screen; ++ // centred on a computer. ++ y: root.padShown ? numberPad.y - Style.space(40) - height ++ : root.keypad ? Math.round(parent.height * 0.22) ++ : Math.round((parent.height - height) / 2) + color: Commons.Color.lock.background + borderSpec: root.inputBorderSpec + radius: Style.cornerRadius +@@ -187,12 +248,12 @@ Item { + anchors.topMargin: inputField.borderTop + // Reserve the fingerprint icon's width on both sides so the centered + // dots stay symmetric and never slide under the icon as they grow. +- anchors.rightMargin: inputField.borderRight + 18 + root.fingerprintReserve ++ anchors.rightMargin: inputField.borderRight + 18 + root.fieldSideReserve + anchors.bottomMargin: inputField.borderBottom +- anchors.leftMargin: inputField.borderLeft + 18 + root.fingerprintReserve ++ anchors.leftMargin: inputField.borderLeft + 18 + root.fieldSideReserve + verticalAlignment: TextInput.AlignVCenter + horizontalAlignment: TextInput.AlignHCenter +- activeFocusOnPress: !root.keypad ++ activeFocusOnPress: !root.padShown + clip: true + enabled: root.inputEnabled && !root.authenticatingPassword + readOnly: root.authenticatingPassword +@@ -249,6 +310,33 @@ Item { + elide: Text.ElideRight + } + ++ // ABC / 123 on touch-only devices: the number pad or the text field ++ // with the on-screen keyboard. Inside the field's left edge, opposite ++ // the fingerprint icon. ++ Text { ++ id: inputSwitch ++ objectName: "inputSwitch" ++ textFormat: Text.PlainText ++ anchors.left: parent.left ++ anchors.leftMargin: inputField.borderLeft + 18 ++ anchors.verticalCenter: parent.verticalCenter ++ visible: root.keypad ++ text: root.padShown ? "ABC" : "123" ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Math.round(root.fieldFontSize * 0.8) ++ font.bold: true ++ ++ MouseArea { ++ // a thumb-sized target around the label ++ anchors.centerIn: parent ++ width: Math.max(parent.width + 24, 56) ++ height: inputField.height ++ enabled: root.inputEnabled && !root.authenticatingPassword ++ onClicked: root.switchInput() ++ } ++ } ++ + // Fingerprint hint pinned inside the field's right edge when a sensor is + // enrolled, so the user knows they can touch to unlock instead of typing. + // Matches hyprlock, which draws its fingerprint icon in the same spot. +@@ -278,7 +366,8 @@ Item { + anchors.horizontalCenter: inputField.horizontalCenter + width: parent.width - Style.space(32) + visible: root.keypadClearsSensor +- text: "Touch the fingerprint sensor or enter your PIN" ++ text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" ++ : "Touch the fingerprint sensor or enter your password" + color: Commons.Color.lock.text + font.family: Style.font.family + font.pixelSize: Style.font.subtitle +diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml +index 82c2848..36dc118 100644 +--- i/shell/plugins/polkit/PolkitAgent.qml ++++ w/shell/plugins/polkit/PolkitAgent.qml +@@ -39,6 +39,16 @@ Item { + // to the password even when a sensor is enrolled. Refreshed per request. + property bool laptopClosed: false + property int shakeOffset: 0 ++ // Touch-only devices (the lock-keypad toggle) get a 123/ABC switch by the ++ // field. The field asks the on-screen keyboard for its digit layout when ++ // the credential is a PIN, and its full layout when it is a password (the ++ // credential-password toggle); the switch swaps for this prompt. ++ property bool touchKeypad: false ++ property bool passwordFirst: false ++ property bool switchedInput: false ++ readonly property bool digitsInput: touchKeypad && (passwordFirst === switchedInput) ++ // Omarchy's toggles, where its toggle tools and the lock look ++ readonly property string togglesDir: Quickshell.env("HOME") + "/.local/state/omarchy/toggles" + + readonly property bool dialogVisible: polkitAgent.isActive || closing + // We show one method at a time. Fingerprint owns the dialog while PAM is +@@ -93,6 +103,7 @@ Item { + closeTimer.stop() + closing = false + submitted = false ++ switchedInput = false + passwordInput.text = "" + refreshLidState() + syncFromFlow() +@@ -170,6 +181,24 @@ Item { + NumberAnimation { target: root; property: "shakeOffset"; to: 8; duration: 50; easing.type: Easing.InOutQuad } + NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: 55; easing.type: Easing.OutQuad } + } ++ FileView { ++ path: root.togglesDir + "/lock-keypad" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.touchKeypad = true ++ onLoadFailed: root.touchKeypad = false ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ path: root.togglesDir + "/credential-password" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.passwordFirst = true ++ onLoadFailed: root.passwordFirst = false ++ onFileChanged: reload() ++ } ++ + FileView { + path: "/etc/pam.d/polkit-1" + watchChanges: true +@@ -324,7 +353,7 @@ Item { + } + + Item { +- width: parent.width - Style.space(40) ++ width: parent.width - Style.space(40) - (inputSwitch.visible ? inputSwitch.width + parent.spacing : 0) + height: root.fieldHeight + + TextInput { +@@ -333,6 +362,8 @@ Item { + verticalAlignment: TextInput.AlignVCenter + activeFocusOnPress: true + clip: true ++ // Digits: the on-screen keyboard's number layout for a PIN. ++ inputMethodHints: root.digitsInput ? Qt.ImhDigitsOnly : Qt.ImhNone + selectionColor: Util.alpha(root.accent, 0.45) + selectedTextColor: root.foreground + font.family: root.fontFamily +@@ -357,7 +388,7 @@ Item { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter +- text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : "Enter password") ++ text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : (root.digitsInput ? "Enter PIN" : "Enter password")) + color: root.errorFlash ? Commons.Color.polkit.textError : root.foreground + opacity: root.errorFlash ? 1 : 0.36 + font.family: root.fontFamily +@@ -379,7 +410,36 @@ Item { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + enabled: passwordInput.visible +- onClicked: passwordInput.forceActiveFocus() ++ // refocus, not just focus: a tap brings a hidden on-screen ++ // keyboard back ++ onClicked: root.refocus() ++ } ++ } ++ ++ // 123 / ABC: which on-screen keyboard layout the field asks for ++ Item { ++ id: inputSwitch ++ visible: root.touchKeypad ++ width: Style.space(44) ++ height: root.fieldHeight ++ ++ Text { ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: root.digitsInput ? "ABC" : "123" ++ color: root.accent ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.subtitle ++ font.bold: true ++ } ++ ++ MouseArea { ++ anchors.fill: parent ++ onClicked: { ++ root.switchedInput = !root.switchedInput ++ // a new focus-in sends the new content type to the keyboard ++ Qt.callLater(root.refocus) ++ } + } + } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch b/packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch new file mode 100644 index 000000000..889da8840 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch @@ -0,0 +1,30 @@ +# Phone only, not for upstream: "omarchy update" hands over to omamobile-update +# (packages/omamobile-omarchy), which runs this same script back with +# OMAMOBILE_UPDATE=1 and Omarchy's own steps, minus the ones that don't belong +# on a phone (Snapper, the AUR, the kernel-reboot prompt and orphan removal, +# which ask through gum) and with boot-related migrations held for review. So +# the command AGENTS.md tells people to use, the menu's Update > Omarchy and +# the bar's update button all take the phone's path. The patch is re-applied +# after every Omarchy upgrade like the rest of the series; when it can't be, +# Omarchy's update runs unwrapped, as before. Escape hatch: +# OMAMOBILE_UPDATE=1 omarchy-update. +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/bin/omarchy-update w/bin/omarchy-update +--- i/bin/omarchy-update ++++ w/bin/omarchy-update +@@ -7,6 +7,14 @@ + + set -e + ++# Omarchy Mobile: a phone updates through omamobile-update, which runs this ++# same flow with the phone's exclusions (no snapshot, AUR or reboot prompt; ++# boot-related migrations held) and reports to the shell's update sheet. It ++# calls back in with OMAMOBILE_UPDATE=1. ++if [[ -z ${OMAMOBILE_UPDATE:-} && -x /usr/bin/omamobile-update ]]; then ++ exec /usr/bin/omamobile-update "$@" ++fi ++ + if [[ -z ${OMARCHY_UPDATE_LOGGED:-} ]]; then + script_command=$(printf '%q ' "$0" "$@") + exec env OMARCHY_UPDATE_LOGGED=1 script -qefc "$script_command" "/tmp/omarchy-update.log" diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch b/packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch new file mode 100644 index 000000000..0fe310e1f --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch @@ -0,0 +1,20 @@ +# Idle: activity that ends an idle cycle wakes a locked display through the +# lock (the wake IPC from 0009), so its blank timer runs again. Lit by +# omarchy-system-wake alone, the panel stayed on behind the lock until the +# next unlock: a day of a lit screen on the phone. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0007. +diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml +--- i/shell/plugins/services/idle/Service.qml ++++ w/shell/plugins/services/idle/Service.qml +@@ -119,7 +119,9 @@ + lockTimer.stop() + screensaverLaunchGraceTimer.stop() + +- if (root.idledThisCycle) runProcess(wakeProcess, "wake", "omarchy-system-wake") ++ // A locked display is lit through the lock, which re-arms its blank timer; ++ // lit here alone, it stayed on behind the lock until the next unlock. ++ if (root.idledThisCycle) runProcess(wakeProcess, "wake", "[[ $(omarchy-shell lock wake 2>/dev/null) == ok ]] || omarchy-system-wake") + + root.idledThisCycle = false + root.screensaverStartedThisCycle = false diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch new file mode 100644 index 000000000..1e715673d --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch @@ -0,0 +1,54 @@ +# Lock: an "Emergency call" button on touch-only devices, under the number +# pad (or the field), as every phone's lock screen has. It asks the phone +# shell's call plugin (omamobile.call) to show what an emergency call can +# do on this phone, over the lock; until emergency calling is tested on a +# carrier (TELEPHONY-APPS-PLAN §3.3) that is the warning that it doesn't +# work yet, never a dialpad. The lock stays as it is. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0011. +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -374,5 +374,42 @@ + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + } ++ ++ // Touch-only devices (phones): "Emergency call", under the number pad ++ // or the field. It asks the phone shell's call plugin (omamobile.call) ++ // to show what an emergency call can do on this phone, over the lock; ++ // the lock itself stays as it is. Without that plugin the call does ++ // nothing. ++ Item { ++ id: emergencyButton ++ objectName: "lockEmergencyCall" ++ visible: root.keypad ++ anchors.horizontalCenter: parent.horizontalCenter ++ anchors.top: numberPad.visible ? numberPad.bottom : inputField.bottom ++ anchors.topMargin: Style.space(20) ++ width: emergencyLabel.implicitWidth + Style.space(40) ++ height: Math.max(Style.space(44), emergencyLabel.implicitHeight + Style.space(16)) ++ ++ Text { ++ id: emergencyLabel ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: "Emergency call" ++ color: Commons.Color.lock.text ++ opacity: emergencyTap.pressed ? 0.6 : 0.9 ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ font.bold: true ++ } ++ ++ MouseArea { ++ id: emergencyTap ++ anchors.fill: parent ++ onClicked: { ++ root.wakeRequested() ++ Quickshell.execDetached(["omarchy-shell", "shell", "call", "omamobile.call", "emergency", ""]) ++ } ++ } ++ } + } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch b/packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch new file mode 100644 index 000000000..89ec9a5f9 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch @@ -0,0 +1,232 @@ +# Notifications: inline reply (the freedesktop `inline-reply` action and +# NotificationReplied signal, which Quickshell implements). The server +# advertises it, and a toast whose sender asked for it gets a Reply button +# that opens a field with Send and Cancel; Send hands the text to the sender +# and dismisses the toast. While a field is open the toast's countdown stops +# and the toast surface takes keyboard focus on demand, so an on-screen +# keyboard can type into it. Stored history rows can't be answered and get +# no button. Messages apps use it to reply to a text without opening the +# app (TELEPHONY-APPS-PLAN §7.2). +# +# Against Omarchy 4.0.6 (edge 4.0.6-1). +diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +--- i/shell/plugins/notifications/Service.qml ++++ w/shell/plugins/notifications/Service.qml +@@ -314,6 +314,52 @@ Item { + removePopup(index, "dismiss") + } + ++ // The live notification behind a popup row, or null. A restored row has ++ // none (see removePopup). ++ function liveRefAt(index) { ++ if (index < 0 || index >= popupModel.count) return null ++ var entry = popupModel.get(index) ++ if (!entry || entry.originalId < 0 || isRestoredRow(entry)) return null ++ var ref = liveRefs[entry.originalId] ++ try { ++ return ref && ref.tracked ? ref : null ++ } catch (e) { ++ return null ++ } ++ } ++ ++ // The reply field's placeholder for a popup whose sender asked for an ++ // inline reply, or "" when it can't take one. ++ function replyPlaceholderAt(index) { ++ var ref = liveRefAt(index) ++ if (!ref || !ref.hasInlineReply) return "" ++ return String(ref.inlineReplyPlaceholder || "") || "Reply" ++ } ++ ++ // Popups with the reply field open. While any is, the popup surface takes ++ // keyboard focus so the field can be typed into. ++ property int openReplies: 0 ++ ++ // Send the reply to its sender (NotificationReplied), then take the toast ++ // off the screen. A sender that has meanwhile closed the notification ++ // gets nothing; the popup opens its app instead, so the reply isn't lost ++ // silently. ++ function sendReply(index, text) { ++ var ref = liveRefAt(index) ++ if (!ref || !ref.hasInlineReply) { ++ invokePopupDefault(index) ++ return ++ } ++ try { ++ ref.sendInlineReply(text) ++ } catch (e) { ++ console.warn("inline reply failed:", e) ++ invokePopupDefault(index) ++ return ++ } ++ dismissPopup(index) ++ } ++ + function expirePopup(index) { + removePopup(index, "expire") + } +@@ -936,6 +982,7 @@ Item { + bodyMarkupSupported: true + bodyHyperlinksSupported: true + persistenceSupported: true ++ inlineReplySupported: true + + onNotification: function(notification) { + service.handleNotification(notification) +@@ -960,7 +1007,9 @@ Item { + + WlrLayershell.namespace: "omarchy-notifications" + WlrLayershell.layer: WlrLayer.Overlay +- WlrLayershell.keyboardFocus: WlrKeyboardFocus.None ++ // Passive, except while a reply field is open (OnDemand, as the ++ // polkit prompt uses, so an on-screen keyboard can type into it). ++ WlrLayershell.keyboardFocus: service.openReplies > 0 ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + exclusionMode: ExclusionMode.Ignore + color: "transparent" + +@@ -1012,7 +1061,19 @@ Item { + + readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) + property real remainingLifetime: 1.0 +- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered ++ readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying ++ ++ // Inline reply. The placeholder is looked up again whenever the ++ // row's content changes, as an update can add or drop the action. ++ readonly property string replyPlaceholder: { ++ cardSlot.summary ++ cardSlot.body ++ return service.replyPlaceholderAt(cardSlot.index) ++ } ++ property bool replying: false ++ onReplyingChanged: service.openReplies += replying ? 1 : -1 ++ onReplyPlaceholderChanged: if (replyPlaceholder.length === 0) replying = false ++ Component.onDestruction: if (replying) service.openReplies -= 1 + + // A client updating this notification in place rewrites the row + // under the card (see refreshPopup). New text deserves a full look, +@@ -1052,8 +1113,22 @@ Item { + fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" + glyph: cardSlot.glyph + ++ replyPlaceholder: cardSlot.replyPlaceholder ++ replying: cardSlot.replying ++ + onCloseRequested: service.dismissPopup(cardSlot.index) + onCardClicked: service.invokePopupDefault(cardSlot.index) ++ onReplyRequested: cardSlot.replying = true ++ onReplyCancelled: { ++ cardSlot.replying = false ++ // A fresh countdown, so the toast doesn't vanish the ++ // moment the field closes. ++ cardSlot.remainingLifetime = 1.0 ++ } ++ onReplySent: function(text) { ++ cardSlot.replying = false ++ service.sendReply(cardSlot.index, text) ++ } + } + } + } +diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml +--- i/shell/plugins/notifications/components/NotificationCard.qml ++++ w/shell/plugins/notifications/components/NotificationCard.qml +@@ -33,8 +33,33 @@ BorderSurface { + + readonly property bool hovered: hoverTracker.hovered + ++ // Inline reply (the freedesktop `inline-reply` action): the popup container ++ // sets the sender's placeholder text while the live notification takes a ++ // reply. The history panel leaves it empty: a stored notification can't be ++ // answered. ++ property string replyPlaceholder: "" ++ // The reply field is open. The container keeps the toast on screen and ++ // gives its surface keyboard focus meanwhile. ++ property bool replying: false ++ + signal closeRequested() + signal cardClicked() ++ signal replyRequested() ++ signal replySent(string text) ++ signal replyCancelled() ++ ++ function sendReply() { ++ var text = replyField.text ++ if (text.trim().length === 0) return ++ root.replySent(text) ++ } ++ ++ // A field that opens gets focus, so an on-screen keyboard shows; one that ++ // closes forgets what was typed. ++ onReplyingChanged: { ++ if (replying) Qt.callLater(function() { replyField.forceActiveFocus() }) ++ else replyField.text = "" ++ } + // Prefer per-notification media/avatar data, then fall back to the app icon. + // The `check` flag avoids Qt's missing-texture placeholder for unknown names. + readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) +@@ -82,7 +107,9 @@ BorderSurface { + onClicked: function(mouse) { + if (mouse.button === Qt.RightButton) { + root.closeRequested() +- } else { ++ } else if (!root.replying) { ++ // A tap beside the open reply field must not open the app and ++ // throw the reply away. + root.cardClicked() + } + } +@@ -192,6 +219,53 @@ BorderSurface { + } + } + } ++ ++ // Reply, then a field with Send and Cancel, each tall enough to tap on ++ // a touch screen. ++ RowLayout { ++ id: replyRow ++ readonly property real controlHeight: Style.space(40) ++ Layout.fillWidth: true ++ Layout.leftMargin: Style.space(12) ++ Layout.rightMargin: Style.space(12) ++ Layout.bottomMargin: Style.space(10) ++ visible: root.replyPlaceholder.length > 0 ++ spacing: Style.space(8) ++ ++ TextField { ++ id: replyField ++ objectName: "notificationReplyField" ++ Layout.fillWidth: true ++ visible: root.replying ++ Layout.preferredHeight: replyRow.controlHeight ++ placeholderText: root.replyPlaceholder ++ foreground: Commons.Color.notifications.text ++ onAccepted: root.sendReply() ++ Keys.onEscapePressed: root.replyCancelled() ++ } ++ ++ Item { ++ Layout.fillWidth: true ++ visible: !root.replying ++ } ++ ++ Button { ++ visible: root.replying ++ text: "Cancel" ++ Layout.preferredHeight: replyRow.controlHeight ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replyCancelled() ++ } ++ ++ Button { ++ objectName: "notificationReplyButton" ++ Layout.preferredHeight: replyRow.controlHeight ++ text: root.replying ? "Send" : "Reply" ++ bordered: true ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replying ? root.sendReply() : root.replyRequested() ++ } ++ } + } + + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch b/packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch new file mode 100644 index 000000000..726b6c144 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch @@ -0,0 +1,50 @@ +# Phone only, not for upstream: omarchy-channel-set and omarchy-refresh-pacman +# refuse on a phone and point at RELEASES.md section 5.4. Both copy Omarchy's +# x86_64 pacman.conf and mirrorlist over the phone's (no [omamobile], no Arch +# Linux ARM) and then upgrade everything from them; the menu offers that as +# Update > Channel, and omarchy-reinstall-pkgs calls the refresh too +# (TOUCH-PLAN 0.2). omamobile-update, which this package installs, is the +# phone's test, as in 0012. omamobile-setup-user hides Update > Channel too; +# this keeps a terminal from doing the same. +# +# Against Omarchy 4.0.6 (stable 4.0.6-1). +diff --git i/bin/omarchy-channel-set w/bin/omarchy-channel-set +--- i/bin/omarchy-channel-set ++++ w/bin/omarchy-channel-set +@@ -6,6 +6,16 @@ + + set -euo pipefail + ++# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux ++# ARM, which the channel's x86_64 pacman.conf (omarchy-refresh-pacman) drops. ++if [[ -x /usr/bin/omamobile-update ]]; then ++ echo "omarchy-channel-set: not on an Omarchy Mobile phone. It would replace this phone's" >&2 ++ echo "pacman.conf with Omarchy's x86_64 one (no [omamobile], no Arch Linux ARM) and upgrade" >&2 ++ echo "everything from it. The phone follows Omarchy's stable channel; update it with" >&2 ++ echo "'omarchy update'. See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ exit 1 ++fi ++ + usage() { echo "Usage: omarchy-channel-set [stable|rc|edge|dev]"; } + fail() { echo "Error: $*" >&2; exit 1; } + +diff --git i/bin/omarchy-refresh-pacman w/bin/omarchy-refresh-pacman +--- i/bin/omarchy-refresh-pacman ++++ w/bin/omarchy-refresh-pacman +@@ -3,6 +3,16 @@ + # omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. + # omarchy:requires-sudo=true + ++# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux ++# ARM, which Omarchy's x86_64 pacman.conf and mirrorlist would replace. ++if [[ -x /usr/bin/omamobile-update ]]; then ++ echo "omarchy-refresh-pacman: not on an Omarchy Mobile phone. It would replace this phone's" >&2 ++ echo "pacman.conf and mirrorlist with Omarchy's x86_64 ones (no [omamobile], no Arch Linux" >&2 ++ echo "ARM) and upgrade everything from them. Update the phone with 'omarchy update'." >&2 ++ echo "See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ exit 1 ++fi ++ + sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak + sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch b/packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch new file mode 100644 index 000000000..cd2462d33 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch @@ -0,0 +1,261 @@ +# Notifications: swipe to dismiss, and a close button on touch screens. On a +# touch screen a tap runs the toast's default action and there is no right +# button, so a toast could only be got rid of by letting it launch something, +# and a critical one (Omarchy's first-run invitations) never expires. A +# sideways swipe now moves the card with the finger: let go past 35% of its +# width, or flick it, and it flies off that side and closes as a right-click +# does; short of that it springs back. The drag starts only past a threshold, +# so a tap still runs the default action, and it is off while a reply is +# being typed. When Hyprland lists a touch screen, each toast also gets a +# close glyph with a 44 px target in its top-right corner; a seat with only a +# mouse shows none, so desktops look as before. Hover pauses the countdown +# for a mouse or stylus only (a finger doesn't hover), and a card being +# swiped doesn't expire under the finger. Right-click still closes. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 (inline reply) applied. +diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +--- i/shell/plugins/notifications/Service.qml ++++ w/shell/plugins/notifications/Service.qml +@@ -455,6 +455,29 @@ + + Process { id: focusAppProc; running: false } + ++ // Whether the seat has a touch screen, asked of Hyprland once at startup. ++ // Toasts then show a close button: a tap runs the default action, and a ++ // finger has no right button to dismiss with. A seat with only a mouse ++ // keeps the toasts as they were. ++ property bool touchScreen: false ++ ++ Process { ++ id: touchScreenProc ++ command: ["hyprctl", "-j", "devices"] ++ running: false ++ stdout: StdioCollector { ++ waitForEnd: true ++ onStreamFinished: { ++ try { ++ var touch = JSON.parse(text || "{}").touch ++ service.touchScreen = Array.isArray(touch) && touch.length > 0 ++ } catch (e) { ++ service.touchScreen = false ++ } ++ } ++ } ++ } ++ + Process { + id: ensureDirsProc + command: ["mkdir", "-p", service.stateDir, service.popupStateDir, service.historyDir, service.imagesDir] +@@ -880,6 +903,7 @@ + + Component.onCompleted: { + ensureDirsProc.running = true ++ touchScreenProc.running = true + // Once mkdir has had a tick, load the existing settings file. FileView + // surfaces an empty string when the file doesn't exist; loadSettings + // handles that path. +@@ -1061,7 +1085,7 @@ + + readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) + property real remainingLifetime: 1.0 +- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying ++ readonly property bool ticking: cardSlot.lifetime > 0 && !card.held && !cardSlot.replying + + // Inline reply. The placeholder is looked up again whenever the + // row's content changes, as an update can add or drop the action. +@@ -1115,6 +1139,7 @@ + + replyPlaceholder: cardSlot.replyPlaceholder + replying: cardSlot.replying ++ closeButtonShown: service.touchScreen + + onCloseRequested: service.dismissPopup(cardSlot.index) + onCardClicked: service.invokePopupDefault(cardSlot.index) +diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml +--- i/shell/plugins/notifications/components/NotificationCard.qml ++++ w/shell/plugins/notifications/components/NotificationCard.qml +@@ -32,6 +32,22 @@ + property string fontFamily: "" + + readonly property bool hovered: hoverTracker.hovered ++ // The card is under the user's hand: a mouse over it, or a finger ++ // swiping it. The popup container pauses the countdown meanwhile. ++ readonly property bool held: hovered || swipeHandler.active ++ ++ // Touch: a horizontal swipe dismisses (swipeEnabled), and a close button ++ // shows in the top-right corner (closeButtonShown), as a tap runs the ++ // default action and a touch screen has no right button. The container ++ // shows the button when the seat has a touch screen, so a mouse-only ++ // desktop looks and behaves as before. ++ property bool swipeEnabled: true ++ property bool closeButtonShown: false ++ // How far the card has been swiped sideways, in pixels. ++ property real swipeOffset: 0 ++ // Release speed of the last swipe, pixels per second. ++ property real swipeVelocity: 0 ++ property bool dismissing: false + + // Inline reply (the freedesktop `inline-reply` action): the popup container + // sets the sender's placeholder text while the live notification takes a +@@ -77,6 +93,23 @@ + readonly property color accentColor: urgency === 2 ? Commons.Color.urgent : (urgency === 0 ? dimColor : Commons.Color.notifications.countdown) + readonly property var cardBorderSpec: Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) + ++ // A swipe ends: past 35% of the width, or flicked fast enough the same ++ // way, the card flies off that side and closes; otherwise it springs back. ++ function finishSwipe() { ++ var distance = Math.abs(root.swipeOffset) ++ var sameWay = root.swipeVelocity * root.swipeOffset > 0 ++ var flung = sameWay && Math.abs(root.swipeVelocity) >= Style.space(900) && distance >= root.width * 0.1 ++ if (root.width > 0 && (distance >= root.width * 0.35 || flung)) { ++ root.dismissing = true ++ swipeAnimation.to = (root.swipeOffset < 0 ? -1 : 1) * (root.width + Style.space(24)) ++ swipeAnimation.dismiss = true ++ } else { ++ swipeAnimation.to = 0 ++ swipeAnimation.dismiss = false ++ } ++ swipeAnimation.restart() ++ } ++ + function sanitizeBody(s) { + return NotificationLogic.sanitizeBody(s, app, appIcon) + } +@@ -92,13 +125,23 @@ + implicitWidth: Style.space(380) + // Add vertical border insets so mainColumn (inset by border on top/left/right) + // doesn't push content under the bottom edge. +- implicitHeight: mainColumn.implicitHeight + borderTop + borderBottom ++ implicitHeight: Math.max(mainColumn.implicitHeight, closeButtonShown ? closeButton.height : 0) + borderTop + borderBottom + radius: cornerRadius + color: Commons.Color.notifications.background + borderSpec: cardBorderSpec + clip: true + +- HoverHandler { id: hoverTracker } ++ // The swipe moves the card sideways and fades it as it goes. ++ transform: Translate { x: root.swipeOffset } ++ opacity: 1 - 0.6 * Math.min(1, Math.abs(root.swipeOffset) / Math.max(1, root.width)) ++ ++ // A mouse or stylus resting on the card pauses its countdown. A finger ++ // doesn't hover, so touch is left out: a toast that was touched must not ++ // count as hovered and stop expiring. ++ HoverHandler { ++ id: hoverTracker ++ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus ++ } + + MouseArea { + anchors.fill: parent +@@ -115,6 +158,61 @@ + } + } + ++ // Swipe to dismiss. Only sideways movement past the threshold starts it, ++ // so a tap still runs the default action and a right-click still closes. ++ // Off while a reply is being typed, so selecting text can't throw the ++ // reply away. ++ DragHandler { ++ id: swipeHandler ++ target: null ++ yAxis.enabled: false ++ dragThreshold: Style.space(12) ++ enabled: root.swipeEnabled && !root.replying && !root.dismissing ++ onActiveChanged: { ++ if (active) { ++ swipeAnimation.stop() ++ root.swipeVelocity = 0 ++ } else { ++ root.finishSwipe() ++ } ++ } ++ onActiveTranslationChanged: { ++ if (!active) return ++ root.swipeOffset = activeTranslation.x ++ root.swipeVelocity = centroid.velocity.x ++ } ++ } ++ ++ SequentialAnimation { ++ id: swipeAnimation ++ property real to: 0 ++ property bool dismiss: false ++ NumberAnimation { ++ target: root ++ property: "swipeOffset" ++ to: swipeAnimation.to ++ duration: swipeAnimation.dismiss ? 140 : 200 ++ easing.type: swipeAnimation.dismiss ? Easing.InQuad : Easing.OutBack ++ } ++ ScriptAction { ++ script: { ++ if (!swipeAnimation.dismiss) return ++ root.closeRequested() ++ // A container that keeps the card (nothing removes it) gets it back. ++ swipeResetTimer.restart() ++ } ++ } ++ } ++ ++ Timer { ++ id: swipeResetTimer ++ interval: 400 ++ onTriggered: { ++ root.dismissing = false ++ root.swipeOffset = 0 ++ } ++ } ++ + ColumnLayout { + id: mainColumn + // Inset by the card border so the content doesn't paint over the card's +@@ -131,7 +229,8 @@ + RowLayout { + Layout.fillWidth: true + Layout.leftMargin: Style.space(12) +- Layout.rightMargin: Style.space(12) ++ // Text stays clear of the close button's touch target. ++ Layout.rightMargin: root.closeButtonShown ? closeButton.width : Style.space(12) + Layout.topMargin: root.singleLineToast ? Style.space(7) : Style.space(10) + Layout.bottomMargin: root.singleLineToast ? Style.space(7) : Style.space(10) + spacing: root.collapseRedundantIcon ? 0 : (root.compactGlyph ? Style.space(8) : Style.space(12)) +@@ -268,4 +367,39 @@ + } + } + ++ // Close button: a small glyph with a 44 px touch target in the top-right ++ // corner, inside the border. ++ MouseArea { ++ id: closeButton ++ objectName: "notificationCloseButton" ++ visible: root.closeButtonShown ++ anchors.top: parent.top ++ anchors.right: parent.right ++ anchors.topMargin: root.borderTop ++ anchors.rightMargin: root.borderRight ++ width: Style.space(44) ++ height: Style.space(44) ++ cursorShape: Qt.PointingHandCursor ++ Accessible.role: Accessible.Button ++ Accessible.name: "Dismiss notification" ++ onClicked: root.closeRequested() ++ ++ Rectangle { ++ anchors.centerIn: parent ++ width: Style.space(28) ++ height: width ++ radius: width / 2 ++ color: Commons.Color.notifications.text ++ opacity: closeButton.pressed ? 0.18 : 0 ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ text: "󰅖" ++ color: root.dimColor ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.icon ++ } ++ } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch b/packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch new file mode 100644 index 000000000..410f8cf80 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch @@ -0,0 +1,113 @@ +# Menu: a back button in the header and swipe right to go back. Below the +# top level, going up was Backspace, Left or Escape-and-reopen, none of which +# a touch screen has. The header now shows a chevron (a 44 px target) that +# calls goBack(), and a swipe right on the card does the same: the card +# follows the finger at half speed and goes back once the finger has +# travelled a quarter of its width (at least 64 px) or flicks. The drag +# starts only past a threshold and only sideways, and not while the list +# scrolls, so taps still pick rows and vertical scrolling is untouched. +# Neither shows nor acts at the top level, in dmenu mode or while the +# uninstall question is open. The keys work as before. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), before the menu-first-frame bridge. +diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml +--- i/shell/plugins/menu/Menu.qml ++++ w/shell/plugins/menu/Menu.qml +@@ -1066,6 +1066,50 @@ + + MouseArea { anchors.fill: parent; onClicked: {} } + ++ // Touch back: a swipe right on the card goes up a level, as Backspace ++ // does. Only sideways movement past the threshold starts it, so a ++ // tap still picks a row, and a list that is scrolling keeps the ++ // finger. ++ readonly property bool canGoBack: root.activeMenu !== "root" && !root.dmenuActive && !root.deleteConfirmOpen ++ property real swipeOffset: 0 ++ property real swipeVelocity: 0 ++ transform: Translate { x: card.swipeOffset } ++ ++ DragHandler { ++ id: backSwipe ++ target: null ++ yAxis.enabled: false ++ dragThreshold: Style.space(12) ++ enabled: card.canGoBack && !resultList.moving ++ onActiveChanged: { ++ if (active) { ++ backSwipeSettle.stop() ++ card.swipeVelocity = 0 ++ return ++ } ++ // The finger's travel (the card follows at half speed). ++ var distance = card.swipeOffset * 2 ++ var flung = card.swipeVelocity >= Style.space(900) && distance >= Style.space(24) ++ if (distance >= Math.max(Style.space(64), card.width * 0.25) || flung) root.goBack() ++ backSwipeSettle.restart() ++ } ++ onActiveTranslationChanged: { ++ if (!active) return ++ // The card follows the finger at half speed, and only rightwards. ++ card.swipeOffset = Math.max(0, activeTranslation.x) / 2 ++ card.swipeVelocity = centroid.velocity.x ++ } ++ } ++ ++ NumberAnimation { ++ id: backSwipeSettle ++ target: card ++ property: "swipeOffset" ++ to: 0 ++ duration: 160 ++ easing.type: Easing.OutCubic ++ } ++ + Item { + id: keyCatcher + anchors.fill: parent +@@ -1151,9 +1195,46 @@ + radius: root.cornerRadius + color: "transparent" + ++ // Back, for touch: shown below the top level, does what ++ // Backspace does. A 44 px target, overhanging the header's ++ // height into the margins around it. ++ MouseArea { ++ id: backButton ++ objectName: "menuBackButton" ++ visible: card.canGoBack ++ anchors.left: parent.left ++ anchors.verticalCenter: parent.verticalCenter ++ width: Style.space(44) ++ height: Math.max(parent.height, Style.space(44)) ++ hoverEnabled: true ++ cursorShape: Qt.PointingHandCursor ++ Accessible.role: Accessible.Button ++ Accessible.name: "Back" ++ onClicked: root.goBack() ++ ++ Rectangle { ++ anchors.centerIn: parent ++ width: Style.space(32) ++ height: width ++ radius: root.cornerRadius ++ color: root.selectedBackground ++ opacity: backButton.pressed ? 0.9 : (backButton.containsMouse ? 0.5 : 0) ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ text: "󰅁" ++ color: root.foreground ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.heading ++ } ++ } ++ + Text { + textFormat: Text.PlainText + anchors.left: parent.left ++ anchors.leftMargin: backButton.visible ? backButton.width : 0 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: root.filterText || (root.dmenuActive ? (root.dmenuPrompt + "…") : ((root.item(root.activeMenu) ? (root.item(root.activeMenu).title || root.item(root.activeMenu).label) : "Go") + "…")) diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch b/packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch new file mode 100644 index 000000000..e718492ef --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch @@ -0,0 +1,73 @@ +# Notifications: forget one notification by IPC. Omarchy Mobile's quick +# settings list the toasts on screen and the history under the sheet, and a +# sideways swipe on a row there takes away that one notification. The +# service has calls for all toasts (dismissAll), all history (clear) and +# toasts by summary text, but none for one entry, and every way a toast +# leaves the screen moves its file into history, so a toast swiped away in +# the shade would come straight back as a history row. Deleting a history +# file from outside isn't safe either: archives, trims and replays run on the +# service's serialized file queue, and a move still queued for that +# notification would put the file back. `forget -.json` now +# closes a toast with that file name (a history replay of it too) at its +# sender without archiving it, then deletes the history entry and its image +# copies on the same queue, after anything already queued. A name that isn't +# a notification file name does nothing. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 and 0017 applied. +diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +--- i/shell/plugins/notifications/Service.qml ++++ w/shell/plugins/notifications/Service.qml +@@ -376,9 +376,11 @@ + // The popup is leaving the screen — for any reason — so its file must not + // survive to the next shell restart. It becomes the newest history entry + // instead. Rows that never had a file (a history replay, the empty-history +- // placeholder) archive to nothing, which the move tolerates. ++ // placeholder) archive to nothing, which the move tolerates. A forgotten ++ // popup (forgetNotification) leaves no history entry: its file goes. + if (entry) { +- archivePopupFileFor(entry) ++ if (reason === "forget") deletePopupFileFor(entry) ++ else archivePopupFileFor(entry) + if (restored) delete restoredPopups[NotificationLogic.popupFileName(entry)] + } + popupModel.remove(index) +@@ -398,6 +400,26 @@ + while (popupModel.count > 0) dismissPopup(0) + } + ++ // Forget one notification for good, named by its file (-.json, ++ // popupFileName): a toast on screen with that name, a history replay of it ++ // included, closes at its sender without moving into history, and the ++ // history entry and its image copies are deleted. The delete runs on the ++ // file queue, after any archive already queued for the same notification, ++ // so a toast that has just left the screen can't come back as history. ++ function forgetNotification(name) { ++ var file = String(name || "") ++ if (!/^[0-9]+-[0-9]+\.json$/.test(file)) return "none" ++ for (var i = popupModel.count - 1; i >= 0; i--) { ++ var row = popupModel.get(i) ++ if (row && row.originalId >= 0 && NotificationLogic.popupFileName(row) === file) ++ removePopup(i, "forget") ++ } ++ enqueuePopupFileJob(["bash", "-c", ++ "rm -f \"$1/$3\" \"$2/${3%.json}\"-*", "--", ++ historyDir, imagesDir, file]) ++ return "ok" ++ } ++ + // Run the popup's click action, then dismiss. Omarchy's own toasts carry the + // action as an argv vector in the `execArgv` role (see execArgvFromHints), + // which the persistence files preserve, so restored toasts stay clickable. +@@ -993,6 +1015,12 @@ + return hit ? "ok" : "none" + } + ++ // Forget one notification, toast or history entry, by its file name ++ // (`forget 1760000000000-3.json`); the rest of the history stays. ++ function forget(name: string): string { ++ return service.forgetNotification(name) ++ } ++ + function ping(): string { return "ok" } + } + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch b/packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch new file mode 100644 index 000000000..2f30027af --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch @@ -0,0 +1,70 @@ +# Notifications: platform phrasing. Omarchy's notifications say "click" and +# give "Super + ..." shortcuts, which a phone can't follow: the screenshot +# toast reads "Edit with Super + Alt + , (or click this)". On a touch platform +# omarchy-notification-send rewords them as it sends: "Edit with ... (or +# click this)" becomes "Tap to view" (the phone's screenshot editor is an +# image viewer, Omarchy Mobile's omamobile-screenshot-open), "Open with ... +# (or click this)" "Tap to open", a leading "Click to" becomes +# "Tap to", Voxtype's "Hold F9 ..." points at the Dictation tile, a +# parenthesised Super hint is removed, and a body line that is only a Super +# hint is dropped. Anything else passes through as written, and a desktop +# sends exactly what it did before. The phone is detected by +# /usr/bin/omamobile-update, as in 0016; OMARCHY_NOTIFICATION_PHRASING= +# touch|desktop overrides it. The welcome toast's two Super lines would be +# dropped too, but 0001 skips that toast on a phone. +# +# Against Omarchy 4.0.6 (stable 4.0.6-1). +diff --git i/bin/omarchy-notification-send w/bin/omarchy-notification-send +--- i/bin/omarchy-notification-send ++++ w/bin/omarchy-notification-send +@@ -136,6 +136,50 @@ + fi + done + ++# Platform phrasing. On a touch platform a notification is tapped, not ++# clicked, and there is no keyboard to follow a "Super + ..." hint, so the ++# phrasings that assume either are reworded; any other text passes through as ++# written. A phone running Omarchy Mobile is detected by its omamobile-update; ++# OMARCHY_NOTIFICATION_PHRASING=touch|desktop overrides the detection. ++phrasing=${OMARCHY_NOTIFICATION_PHRASING:-} ++if [[ -z $phrasing ]]; then ++ phrasing=desktop ++ [[ -x /usr/bin/omamobile-update ]] && phrasing=touch ++fi ++ ++touch_phrasing() { ++ local -n text=$1 ++ local hint_re='^(.*) \([^)]*Super \+[^)]*\)(.*)$' line kept=() drop_lines=$2 ++ ++ case $text in ++ "Edit with "*" (or click this)") text="Tap to view" ;; ++ "Open with "*" (or click this)") text="Tap to open" ;; ++ "Hold F9 to dictate (or toggle with Super + Ctrl + X).") text="Use the Dictation tile in quick settings." ;; ++ "Click to "*) text="Tap to ${text#Click to }" ;; ++ esac ++ text=${text//" (or click this)"/} ++ ++ # "Do this (or press Super + X)." -> "Do this." ++ while [[ $text =~ $hint_re ]]; do ++ text=${BASH_REMATCH[1]}${BASH_REMATCH[2]} ++ done ++ ++ # A body line that is only a keyboard hint ("Start it with Super + Space") ++ # has nothing to offer on a touch screen: drop it. ++ if ((drop_lines)) && [[ $text == *"Super + "* ]]; then ++ while IFS= read -r line; do ++ [[ $line == *"Super + "* ]] || kept+=("$line") ++ done <<<"$text" ++ text=$(printf '%s\n' "${kept[@]}") ++ ((${#kept[@]})) || text="" ++ fi ++} ++ ++if [[ $phrasing == touch ]]; then ++ touch_phrasing headline 0 ++ touch_phrasing description 1 ++fi ++ + case $urgency in + low) urgency_byte=0 ;; + normal) urgency_byte=1 ;; diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch b/packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch new file mode 100644 index 000000000..cc9bfac30 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch @@ -0,0 +1,53 @@ +# Sleep: turn the display off before suspend, once the session is secure. +# A phone's panel stays lit through suspend-to-idle: its display driver +# doesn't power it down for system sleep. A suspend that didn't come from +# the power key (upower's critical action, the system menu) began with the +# lock screen lit, so the phone slept behind a lit lock screen, drained the +# battery the suspend was meant to save, and couldn't charge from a 500 mA +# port. Only panels whose backlight this user may power down (bl_power), the +# panels patch 0008 makes follow DPMS, so laptops are unchanged. Bounded by +# what is left of the lock's budget, so a stuck Hyprland can't hold the +# suspend. A power-key wake lights the display again (omamobile-keys wake). +# It also tells the lock the display went dark (omarchy-shell lock dark, +# patch 0023), so the glance is up on the next wake. +# +# Against Omarchy 4.0.6 (4.0.6-1). +diff --git i/bin/omarchy-system-sleep-lock w/bin/omarchy-system-sleep-lock +index d471cea..b278615 100755 +--- i/bin/omarchy-system-sleep-lock ++++ w/bin/omarchy-system-sleep-lock +@@ -104,6 +104,25 @@ report_unsecured() { + exit 1 + } + ++# A phone's panel stays lit through suspend-to-idle (its display driver doesn't ++# power it down for system sleep), so a suspend that began with the screen on ++# slept behind a lit lock screen and drained the battery it was meant to save. ++# Once the session is secure, turn the display off within what is left of the ++# budget; a power-key wake lights it again. Only panels whose backlight this ++# user may power down (bl_power), the same panels brightness follows DPMS on. ++display_off() { ++ local device remaining seconds ++ device=$(omarchy-hw-display 2>/dev/null) || return 0 ++ [[ -w ${OMARCHY_BACKLIGHT_PATH:-/sys/class/backlight}/$device/bl_power ]] || return 0 ++ remaining=$(remaining_ms) ++ (( remaining > 0 )) || return 0 ++ printf -v seconds '%d.%03d' $((remaining / 1000)) $((remaining % 1000)) ++ # The lock's glance view (patch 0023) goes back to the glance whenever the ++ # display goes dark; tell it, as omamobile-keys and omamobile-sleepd do. ++ timeout --kill-after=0.1s "$seconds" omarchy-shell lock dark >/dev/null 2>&1 || true ++ timeout --kill-after=0.1s "$seconds" omarchy-brightness-display off >/dev/null 2>&1 || true ++} ++ + # Request the lock before touching monitor state, so a stuck Hyprland IPC call + # cannot consume the window before Quickshell has begun securing the session. + request_lock +@@ -113,7 +132,7 @@ sync_clamshell + # inside the reserve derive_budget_ms already held back for logind. + while (( $(remaining_ms) > 0 )); do + case $(lock_state) in +- secure) exit 0 ;; ++ secure) display_off; exit 0 ;; + locking) ;; + *) request_lock ;; + esac diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch b/packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch new file mode 100644 index 000000000..13c9da150 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch @@ -0,0 +1,186 @@ +# Lock: fingerprint only when a finger is enrolled. A backport of the probe +# half of upstream Omarchy's 879d6583d ("Fix fingerprint enrollment and +# lock-screen recovery", omacom/omarchy#7158, on quattro for 4.5; no stable +# release has it). The lock and omarchy-apply-lock took +# fprintd-list "$USER" | grep -qi finger as "fingerprint is set up", which +# also matches "User ... has no fingers enrolled ...". On a phone with +# omamobile-fingerprint installed (it ships the PAM file) and nothing +# enrolled, the lock then started a pam_fprintd attempt that failed at once +# (PAM_AUTHINFO_UNAVAIL) and retried every 250 ms for as long as it was up: +# 130,164 attempts in one night, about 55-62 mA (#170). +# +# As upstream: the probe is LC_ALL=C fprintd-list "$USER" 2>&1, and +# FingerprintModel.classifyProbe() reads it: "yes" only for an enrolled-print +# row (" - #0: ..."), "no" for "has no fingers enrolled" (or no PAM file or +# fprintd-list), "unknown" otherwise. Unknown never turns fingerprint off; it +# is asked again after 1 s, doubling to 40 s, while the lock is up. +# omarchy-apply-lock matches the same row, removes the PAM file only on a +# definite "no", and keeps it when the probe fails. +# +# Not taken: the rest of 879d6583d (the attempt backoff and the "reader +# unavailable" notice, the fprintd resume hook and its stop-timeout drop-in, +# the enrollment script changes), so a phone with a finger enrolled behaves +# as before: retries after a mismatch stay at 250 ms. FingerprintModel.js +# holds only upstream's probe functions, copied unchanged. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0009. Drop it once the +# phone's Omarchy has 879d6583d (the 4.5 line); its Service.qml and +# omarchy-apply-lock differ from 4.0.6's, so this will not apply there. +diff --git i/bin/omarchy-apply-lock w/bin/omarchy-apply-lock +--- i/bin/omarchy-apply-lock ++++ w/bin/omarchy-apply-lock +@@ -40,16 +40,24 @@ + account include system-local-login + EOF + +-if [[ -x /usr/bin/fprintd-list ]] && +- /usr/bin/fprintd-list "$target_user" 2>/dev/null | grep -qi finger; then ++# Keep the privileged probe pinned to /usr/bin; failure is not empty enrollment. ++if [[ -x /usr/bin/fprintd-list ]]; then ++ fingerprint_status=$(/usr/bin/fprintd-list "$target_user" 2>&1 || true) ++else ++ fingerprint_status="no" ++fi ++ ++if grep -qE '^[[:space:]]*-[[:space:]]*#[0-9]+:' <<< "$fingerprint_status"; then + echo "Configuring lock screen fingerprint authentication..." + as_root tee /etc/pam.d/omarchy-lock-fingerprint >/dev/null <<'EOF' + #%PAM-1.0 + auth required pam_fprintd.so + account include system-local-login + EOF +-else ++elif [[ $fingerprint_status == "no" ]] || grep -qi 'has no fingers enrolled' <<< "$fingerprint_status"; then + as_root rm -f /etc/pam.d/omarchy-lock-fingerprint ++else ++ echo "Could not check fingerprint enrollment; keeping the existing configuration." >&2 + fi + + # omarchy-shell can't reach a running shell during chroot install. The echo +diff --git i/shell/plugins/lock/FingerprintModel.js w/shell/plugins/lock/FingerprintModel.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/FingerprintModel.js +@@ -0,0 +1,33 @@ ++// The probe half of upstream's FingerprintModel.js (879d6583d): what ++// fprintd-list's answer means, and how often to ask again when it had none. ++var MATCH_RETRY_MS = 250 ++var ERROR_RETRY_BASE_MS = 1000 ++// Leave enough idle time for fprintd to exit and clear a wedged claim. ++var FPRINTD_IDLE_EXIT_MS = 30000 ++var ERROR_RETRY_CAP_MS = 40000 ++ ++function retryDelayMs(streak) { ++ if (streak <= 0) return MATCH_RETRY_MS ++ var delay = ERROR_RETRY_BASE_MS * Math.pow(2, streak - 1) ++ return Math.min(delay, ERROR_RETRY_CAP_MS) ++} ++ ++// A failed probe is unknown, so it cannot disable authentication for the lock. ++function classifyProbe(text) { ++ var s = String(text || "").trim() ++ if (/^[ \t]*-[ \t]*#[0-9]+:/m.test(s)) return "yes" ++ if (s === "no") return "no" ++ if (/has no fingers enrolled/i.test(s)) return "no" ++ return "unknown" ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { ++ MATCH_RETRY_MS: MATCH_RETRY_MS, ++ ERROR_RETRY_BASE_MS: ERROR_RETRY_BASE_MS, ++ ERROR_RETRY_CAP_MS: ERROR_RETRY_CAP_MS, ++ FPRINTD_IDLE_EXIT_MS: FPRINTD_IDLE_EXIT_MS, ++ classifyProbe: classifyProbe, ++ retryDelayMs: retryDelayMs ++ } ++} +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -5,6 +5,7 @@ + import Quickshell.Wayland + import qs.Commons + import qs.Commons as Commons ++import "FingerprintModel.js" as FingerprintModel + + Item { + id: root +@@ -23,6 +24,7 @@ + property bool fingerprintAuthenticating: false + property bool passwordPamConfigured: false + property bool fingerprintConfigured: false ++ property int fingerprintProbeStreak: 0 + property bool keypad: false + property bool previewVisible: false + property string enteredPassword: "" +@@ -119,6 +121,32 @@ + if (!fingerprintCheckProc.running) fingerprintCheckProc.running = true + } + ++ // Only definitive enrollment results may disable authentication. ++ function applyFingerprintProbe(text) { ++ var status = FingerprintModel.classifyProbe(text) ++ if (status === "unknown") { ++ if (fingerprintConfigured) return ++ fingerprintProbeStreak += 1 ++ if (lockRequested) { ++ fingerprintRecheckTimer.interval = FingerprintModel.retryDelayMs(fingerprintProbeStreak) ++ fingerprintRecheckTimer.restart() ++ } ++ return ++ } ++ fingerprintProbeStreak = 0 ++ fingerprintRecheckTimer.stop() ++ fingerprintConfigured = status === "yes" ++ if (lockRequested && fingerprintConfigured) { ++ // A pending retry already owns the next attempt. ++ if (!fingerprintRetryTimer.running) startFingerprint() ++ } else if (!fingerprintConfigured) { ++ // abort() delivers no completion signal, so close the attempt here. ++ if (fingerprintPam.active) fingerprintPam.abort() ++ fingerprintAuthenticating = false ++ fingerprintRetryTimer.stop() ++ } ++ } ++ + function logEvent(event) { + lastEvent = event + lastEventAt = new Date().toISOString() +@@ -132,6 +160,8 @@ + failedAttempts = 0 + authenticatingPassword = false + fingerprintAuthenticating = false ++ fingerprintProbeStreak = 0 ++ fingerprintRecheckTimer.stop() + fingerprintRetryTimer.stop() + if (passwordPam.active) passwordPam.abort() + if (fingerprintPam.active) fingerprintPam.abort() +@@ -390,15 +420,21 @@ + } + } + ++ // Keep fprintd errors distinguishable from an explicit empty enrollment. + Process { + id: fingerprintCheckProc +- command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1 && fprintd-list \"$USER\" 2>/dev/null | grep -qi finger; then echo yes; else echo no; fi"] ++ command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1; then LC_ALL=C fprintd-list \"$USER\" 2>&1; else echo no; fi"] + stdout: StdioCollector { id: fingerprintCheckStdout; waitForEnd: true } +- onExited: { +- root.fingerprintConfigured = String(fingerprintCheckStdout.text || "").trim() === "yes" +- if (root.lockRequested && root.fingerprintConfigured) root.startFingerprint() +- else if (!root.fingerprintConfigured && fingerprintPam.active) fingerprintPam.abort() +- } ++ onExited: root.applyFingerprintProbe(fingerprintCheckStdout.text) ++ } ++ ++ // Retries a probe that could not reach fprintd, paced like the attempt ++ // retries so a daemon that stays unreachable is asked about ever less often. ++ Timer { ++ id: fingerprintRecheckTimer ++ interval: FingerprintModel.ERROR_RETRY_BASE_MS ++ repeat: false ++ onTriggered: root.refreshFingerprintStatus() + } + + Process { diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch new file mode 100644 index 000000000..8f08ea8b7 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch @@ -0,0 +1,1058 @@ +# Lock: a glance view on touch-only devices (the lock-keypad toggle), as a +# phone's lock screen opens: the time, the date, the home screen's last +# weather reading and the newest notifications, over the lock's blurred +# wallpaper. Only a swipe up (a clear drag, 8 % of the height, or a quick +# flick, from anywhere, a card included) or a typed key (kept in the field) +# moves to the PIN view, which is the lock as before plus a small clock. A +# tap never does: a tap on a card opens it to more of its text (summary up +# to 2 lines, body up to 4) and runs nothing, a second tap closes it, and a +# tap elsewhere does nothing. The first 12 px of a drag decide its way: +# mostly sideways on a card swipes it as a toast swipes (0017's +# finishSwipe: past 35 % or a flick it flies off), and that one notification +# is forgotten through the notifications service's forget call (0019), the +# call the phone's shade makes, so it leaves the history and the shade too, +# and the next one moves up; mostly vertical is the swipe up. It comes back +# whenever the lock is shown, the +# screen is woken (the wake call from 0009) or the screen goes dark: the +# lock's own blank, or a new "dark" call for what blanks it from outside +# (the phone's power button, and sleep). With an empty field and no input it +# also comes back after 15 s, counted on the wall clock so that a sleep in +# between can't freeze it. A touch on a dark screen, and one within 400 ms +# of a wake, only wakes it, and open cards close again. Only one view shows +# outside the short change; the other is hidden, so nothing of the PIN view +# renders or takes touches under the glance. Fingerprint unlock is untouched +# and works from both. +# +# The cards are Omarchy's NotificationCard, static as the history uses it, +# one per notification, newest first, as many as fit above the hint (up to +# three), then a line for the rest ("N more from A and B", "N more from A, +# B and 2 others"), with three new card properties: summaryLines, bodyLines +# and a detail label (the age, "2m"). +# Read (the forget is the one change) from the notifications plugin's +# persisted toasts and history +# (~/.local/state/omarchy/notifications/*.json, history/*.json): the same +# notifications the phone's shade lists, the newest ten with no age limit, +# Omarchy's own messages (omarchy-action, shown as Omarchy) and notify-send +# included. While do-not-disturb is on (notifications.json "dnd"), only what +# still toasts shows: Omarchy's own messages and a critical notify-send. +# The toggle lock-hide-notification-text shows the app name and "Unlock to +# read" instead of the text. Weather comes from +# ~/.local/state/omamobile/weather.json, written by the phone shell's +# omamobile-weather service, and is hidden when absent or over 3 h old; the +# lock makes no network calls. The clock is 12- or 24-hour as the phone bar +# and the home screen's clock decide, from the bar's clockFormat (shell.json, +# read at once whatever the lock shows, on every change and whenever the +# glance comes back; a failed read keeps the last), else the bar's default +# (HH:mm), never the session's C/POSIX locale. The big glance time is built +# without AM/PM (Qt's "h" without a marker counts to 23), the small clock +# over the PIN view keeps it. On a computer the lock is unchanged. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0017 +# and 0019. +diff --git i/shell/plugins/lock/LockGlance.js w/shell/plugins/lock/LockGlance.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockGlance.js +@@ -0,0 +1,164 @@ ++.pragma library ++.import "../notifications/NotificationLogic.js" as NotificationLogic ++ ++// What the phone's lock shows at a glance (LockGlance.qml): the clock's ++// 12- or 24-hour choice, the notifications grouped by app, and the weather ++// line. Plain functions of their inputs, so the test can drive them. ++ ++// Up to this many notifications get a card; the rest fold into one line. ++var MAX_CARDS = 3 ++// The notifications the lock sums up are the ones the phone's notification ++// shade lists: the newest ten of the toasts on screen and the history, ++// which the notifications service trims to ten (historyLimit), with no age ++// limit and no app left out. ++var SHADE_LIMIT = 10 ++// NotificationUrgency.Critical, for the do-not-disturb rule. ++var CRITICAL = 2 ++// A weather reading older than this is not shown. ++var WEATHER_MAX_AGE_MS = 3 * 60 * 60 * 1000 ++ ++// The bar's own default time format (omamobile-shell's bar, without a ++// clockFormat): the lock's clock agrees with it. ++var BAR_DEFAULT_FORMAT = "HH:mm" ++ ++// 12- or 24-hour, decided as the phone bar and the home screen's clock decide ++// (omamobile-shell, HomeModel.systemTimeFormat) from the bar's clockFormat ++// (shell.json bar.clockFormat): quoted literals ignored, an AM/PM marker or ++// "h" without "H" means 12-hour. Without one, the bar's default (24-hour), ++// never the session's Qt locale, which is C/POSIX for the shell. ++function twelveHour(barFormat) { ++ var f = String(barFormat || BAR_DEFAULT_FORMAT).replace(/'[^']*'/g, "") ++ return /a/i.test(f) || (/h/.test(f) && !/H/.test(f)) ++} ++ ++// The bar's clockFormat from shell.json's text: "" when it has none, null ++// when the text can't be read (a write caught half done), which keeps the ++// last one. ++function barClockFormat(text) { ++ var shell ++ try { shell = JSON.parse(String(text || "")) } catch (e) { return null } ++ if (!shell || typeof shell !== "object") return null ++ return shell.bar && shell.bar.clockFormat ? String(shell.bar.clockFormat) : "" ++} ++ ++// The small clock over the PIN view: a Qt format, with AM/PM in 12-hour. ++function timeFormat(twelve) { ++ return twelve ? "h:mm AP" : "HH:mm" ++} ++ ++// The large glance time, without AM/PM. Built here, not as the Qt format ++// "h:mm": without an AM/PM marker in the same format Qt counts "h" from 0 ++// to 23, so a 12-hour bar got a 24-hour lock ("14:02"). ++function glanceTime(date, twelve) { ++ var d = date instanceof Date ? date : new Date(date) ++ var h = d.getHours() ++ var mm = (d.getMinutes() < 10 ? "0" : "") + d.getMinutes() ++ if (twelve) return (h % 12 || 12) + ":" + mm ++ return (h < 10 ? "0" : "") + h + ":" + mm ++} ++ ++function age(timestamp, now) { ++ var minutes = Math.floor(Math.max(0, Number(now) - Number(timestamp || 0)) / 60000) ++ if (minutes < 1) return "now" ++ if (minutes < 60) return minutes + "m" ++ return Math.floor(minutes / 60) + "h" ++} ++ ++ ++// The name a card goes by: Omarchy's own messages (omarchy-action) ++// as Omarchy, a bare notify-send or a nameless sender as Notifications. ++function appName(app) { ++ var name = String(app || "").trim() ++ if (name === "omarchy-action") return "Omarchy" ++ if (!name || name === "notify-send") return "Notifications" ++ return name ++} ++ ++// The shade's rows (see SHADE_LIMIT; a row with neither summary nor body is ++// skipped, as there) from the persisted popup and history files (the ++// notifications plugin's state, one JSON line each, read together). ++function shadeRows(raw) { ++ var rows = NotificationLogic.historyRows(raw, [], 1, 1000) ++ var out = [] ++ for (var i = 0; i < rows.length && out.length < SHADE_LIMIT; i++) { ++ var e = rows[i] ++ if (!String(e.summary || "").trim() && !String(e.body || "").trim()) continue ++ out.push(e) ++ } ++ return out ++} ++ ++// The file names (NotificationLogic.popupFileName) of every notification ++// the files hold, as a set. ++function fileNames(raw) { ++ var rows = NotificationLogic.historyRows(raw, [], 1, 1000) ++ var out = {} ++ for (var i = 0; i < rows.length; i++) out[NotificationLogic.popupFileName(rows[i])] = true ++ return out ++} ++ ++// Those rows as cards, one per notification, newest first. While ++// do-not-disturb is on, only what would still toast: Omarchy's own ++// messages, and a critical notify-send (NotificationLogic.shouldBypassDnd). ++// hideText shows the app name and "Unlock to read" instead of the text, and ++// no sender picture. The detail beside the summary is the age ("2m"). ++function cards(raw, now, hideText, dnd) { ++ var rows = shadeRows(raw) ++ var out = [] ++ for (var i = 0; i < rows.length; i++) { ++ var e = rows[i] ++ if (dnd && !NotificationLogic.shouldBypassDnd({ appName: e.app, urgency: e.urgency }, CRITICAL)) continue ++ var name = appName(e.app) ++ out.push({ ++ app: name, ++ appIcon: e.appIcon, ++ image: hideText ? "" : e.image, ++ glyph: e.glyph, ++ urgency: e.urgency, ++ timestamp: e.timestamp, ++ summary: hideText ? name : (String(e.summary || "").trim() || name), ++ body: hideText ? "Unlock to read" : NotificationLogic.sanitizeBody(e.body, e.app, e.appIcon), ++ detail: age(e.timestamp, now), ++ file: NotificationLogic.popupFileName(e) ++ }) ++ } ++ return out ++} ++ ++// The line under the cards for the notifications without one: "5 more from ++// Mail and GitHub", "5 more from Mail, GitHub and 2 others", each app named ++// once, newest first. ++function moreText(rest) { ++ if (!rest || rest.length === 0) return "" ++ var names = [] ++ for (var i = 0; i < rest.length; i++) { ++ var app = String(rest[i].app || "") ++ if (app && names.indexOf(app) < 0) names.push(app) ++ } ++ if (names.length === 0) return rest.length + " more" ++ var from = names.length <= 2 ? names.join(" and ") ++ : names.slice(0, 2).join(", ") + " and " + (names.length - 2) + (names.length === 3 ? " other" : " others") ++ return rest.length + " more from " + from ++} ++ ++// notifications.json's do-not-disturb flag: silenced notifications make no ++// toast, so the lock shows only what still toasts (cards). ++function doNotDisturb(raw) { ++ var parsed = NotificationLogic.parseSettings(raw) ++ return parsed.dnd === true ++} ++ ++// The home screen weather widget's last reading, which omamobile-shell ++// keeps in ~/.local/state/omamobile/weather.json: ++// {"at": , "temperature": 12, "unit": "°C", "text": "Partly cloudy"} ++// Shown as "12°, partly cloudy"; nothing when absent, unreadable or older ++// than WEATHER_MAX_AGE_MS. The lock itself never asks the network. ++function weatherLine(raw, now) { ++ var w ++ try { w = JSON.parse(String(raw || "")) } catch (e) { return "" } ++ if (!w || typeof w.temperature !== "number" || !isFinite(w.temperature)) return "" ++ var at = Number(w.at || 0) ++ if (!(at > 0) || Number(now) - at > WEATHER_MAX_AGE_MS || at - Number(now) > 5 * 60 * 1000) return "" ++ var text = String(w.text || "").trim() ++ return Math.round(w.temperature) + "°" + (text ? ", " + text.charAt(0).toLowerCase() + text.slice(1) : "") ++} +diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockGlance.qml +@@ -0,0 +1,628 @@ ++import QtQuick ++import Quickshell ++import Quickshell.Io ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++import "../notifications/components" ++import "LockGlance.js" as Glance ++ ++// The lock's glance view on touch-only devices (the lock-keypad toggle): ++// the time, the date, the weather, the newest notifications and a hint, ++// over the lock's own blurred wallpaper. A tap on a card opens it to more ++// of its text, a sideways swipe dismisses it (as in the shade); only a swipe up or a typed key moves to the PIN view, which ++// is the lock as before plus a small clock; with no input it comes back after ++// 15 s, and whenever the lock is shown, the screen goes dark (any way: the ++// lock's own blank, the power button, sleep) or the screen is woken. The ++// touch that wakes a dark screen only wakes it. Fingerprint unlock runs ++// underneath either view, untouched. ++// ++// Read-only: the notifications plugin's persisted toasts and history, its ++// do-not-disturb flag, the lock-hide-notification-text toggle, the bar's ++// clock format and the home screen's last weather reading. Nothing here ++// acts on a notification or asks the network. ++// ++// On a computer (keypad off) it shows nothing and reads nothing but the ++// bar's clock format. ++Item { ++ id: glance ++ ++ // The LockView this sits in. ++ property var lock: null ++ // Where the PIN view's own content starts (its hint or field), for the ++ // small clock above it. ++ property real pinTop: height * 0.2 ++ ++ readonly property bool active: !!lock && lock.keypad ++ property bool shown: true ++ readonly property bool showing: active && shown ++ // 1 with the glance up, 0 with the PIN view; animated in between. The ++ // view not in use is hidden (visible: false) once the change is over. ++ property real progress: showing ? 1 : 0 ++ Behavior on progress { NumberAnimation { duration: 220; easing.type: Easing.OutCubic } } ++ ++ readonly property string home: Quickshell.env("HOME") ++ property bool hideText: false ++ property bool doNotDisturb: false ++ property string barClockFormat: "" ++ property string notificationsRaw: "" ++ property string weatherRaw: "" ++ readonly property double now: clock.date.getTime() ++ readonly property bool twelveHour: Glance.twelveHour(barClockFormat) ++ // Swiped away: hidden at once by file name, until a read no longer finds ++ // the file (the service's forget runs on its file queue), as the shade ++ // does. A mark the files still show after 15 s lapses (a forget that never ++ // happened), and the card comes back. ++ property var dismissed: ({}) ++ readonly property var cards: active ? Glance.cards(notificationsRaw, now, hideText, doNotDisturb) ++ .filter(function(c) { return !glance.dismissed[c.file] }) : [] ++ readonly property var shownCards: cards.slice(0, Glance.MAX_CARDS) ++ // How many of those cards fit above the hint (refit). ++ property int fitCount: Glance.MAX_CARDS ++ readonly property string moreText: Glance.moreText(cards.slice(Math.min(fitCount, shownCards.length))) ++ // The cards opened to more of their text, by notification file name; ++ // all closed again whenever the glance comes back. ++ property var expanded: ({}) ++ readonly property string weatherText: active ? Glance.weatherLine(weatherRaw, now) : "" ++ // Where the under-display sensor's part of the screen starts (LockView's ++ // keypadClearsSensor): the hint sits just below it, the cards above. ++ readonly property real sensorTop: lock && lock.keypadClearsSensor ? height - lock.keypadBottomMargin : height ++ property double lastActivity: Date.now() ++ property bool polling: true ++ // A touch on a dark screen only wakes it, as on a phone, and so does one ++ // within this long of a wake (the rest of that touch, or a finger already ++ // on its way). ++ property int wakeGuardMs: 400 ++ property double wakeGuardUntil: 0 ++ ++ visible: active ++ ++ function show() { ++ if (!active || (lock && lock.authenticatingPassword)) return ++ shown = true ++ expanded = ({}) ++ shellFile.reload() ++ if (lock.passwordText.length > 0) lock.passwordTextEdited("") ++ noteActivity() ++ refresh() ++ glance.forceActiveFocus() ++ if (lock.inputEnabled) lock.foldKeyboard() ++ } ++ ++ function reveal() { ++ if (!showing) return ++ shown = false ++ pendingFocus = true ++ lock.wakeRequested() ++ } ++ ++ // The PIN view's field takes focus once it is shown again (an item that ++ // is not visible can't), which brings up the on-screen keyboard for a ++ // password as before. ++ property bool pendingFocus: false ++ onProgressChanged: { ++ if (pendingFocus && progress < 1) { ++ pendingFocus = false ++ Qt.callLater(lock.forcePasswordFocus) ++ } ++ } ++ ++ function noteActivity() { ++ lastActivity = Date.now() ++ idleTimer.since = lastActivity ++ if (!active) return ++ if (!polling) { ++ polling = true ++ refresh() ++ } ++ } ++ ++ function armWakeGuard() { ++ wakeGuardUntil = Date.now() + wakeGuardMs ++ } ++ ++ // Whether a touch that starts now only wakes the screen; a dark one is ++ // lit through the lock, as any touch on the lock lights it. ++ function wakeTouch() { ++ if (lock.displayDark) { ++ armWakeGuard() ++ lock.wakeRequested() ++ return true ++ } ++ return Date.now() < wakeGuardUntil ++ } ++ ++ function refresh() { ++ if (active && !notificationsProc.running) notificationsProc.running = true ++ } ++ ++ function refit() { ++ var avail = cardsArea.height ++ var gap = cardsColumn.spacing ++ var moreHeight = moreLabel.implicitHeight + gap ++ var used = 0 ++ var n = 0 ++ for (var i = 0; i < cardsRepeater.count; i++) { ++ var item = cardsRepeater.itemAt(i) ++ if (!item) break ++ var h = item.implicitHeight + (n > 0 ? gap : 0) ++ var needMore = i + 1 < cards.length ++ if (used + h + (needMore ? moreHeight : 0) > avail) break ++ used += h ++ n++ ++ } ++ fitCount = n ++ } ++ ++ onShownCardsChanged: Qt.callLater(refit) ++ ++ // A card swiped off its side: that one notification is forgotten through ++ // the notifications service's forget call (omamobile-omarchy patch 0019), ++ // the call the phone's shade makes, so it leaves the toasts, the history ++ // and the shade too. Nothing of the notification runs. ++ property var forgetQueue: [] ++ function dismiss(file) { ++ if (!file || dismissed[file]) return ++ var marks = {} ++ for (var k in dismissed) marks[k] = dismissed[k] ++ marks[file] = Date.now() ++ dismissed = marks ++ forgetQueue = forgetQueue.concat([file]) ++ noteActivity() ++ Qt.callLater(runForget) ++ } ++ ++ function runForget() { ++ if (forgetProc.running || forgetQueue.length === 0) return ++ forgetProc.command = ["sh", "-c", ++ "dir=$1; shift; for name; do qs ipc -p \"$dir\" call notifications forget \"$name\"; done; exit 0", ++ "sh", Quickshell.shellDir].concat(forgetQueue) ++ forgetQueue = [] ++ forgetProc.running = true ++ } ++ ++ function pruneDismissed(raw) { ++ var present = Glance.fileNames(raw) ++ var marks = {} ++ var any = false ++ for (var k in dismissed) { ++ if (!present[k]) continue ++ if (Date.now() - dismissed[k] > 15000) continue ++ marks[k] = dismissed[k] ++ any = true ++ } ++ dismissed = any ? marks : ({}) ++ } ++ ++ function toggleCard(file) { ++ var next = {} ++ for (var k in expanded) next[k] = expanded[k] ++ if (next[file]) delete next[file] ++ else next[file] = true ++ expanded = next ++ noteActivity() ++ } ++ ++ // The card under a point of the glance, or null. ++ function cardAt(item, x, y) { ++ for (var i = 0; i < cardsRepeater.count; i++) { ++ var card = cardsRepeater.itemAt(i) ++ if (!card || !card.visible) continue ++ var p = item.mapToItem(card, x, y) ++ if (p.x >= 0 && p.y >= 0 && p.x <= card.width && p.y <= card.height) return card ++ } ++ return null ++ } ++ onHeightChanged: Qt.callLater(refit) ++ ++ // A typed key on the glance moves to the PIN view and keeps the key: a ++ // digit (or, for a password, any character) goes into the field. ++ Keys.onPressed: function(event) { ++ if (!showing) return ++ var t = event.text ++ var printable = t.length === 1 && t.charCodeAt(0) >= 32 && !(event.modifiers & Qt.ControlModifier) ++ if (printable && lock.inputEnabled && !lock.authenticatingPassword ++ && (!lock.padShown || (t >= "0" && t <= "9"))) { ++ if (lock.failureMessage.length > 0) lock.clearFailureRequested() ++ lock.passwordTextEdited(lock.passwordText + t) ++ } else if (!printable && event.key !== Qt.Key_Return && event.key !== Qt.Key_Enter ++ && event.key !== Qt.Key_Up && event.key !== Qt.Key_Space) { ++ return ++ } ++ reveal() ++ event.accepted = true ++ } ++ ++ Connections { ++ target: glance.lock ++ enabled: glance.active ++ function onInputEnabledChanged() { if (glance.lock.inputEnabled) glance.show() } ++ function onWakeSerialChanged() { glance.armWakeGuard(); glance.show() } ++ function onBlankSerialChanged() { glance.show() } ++ function onDisplayDarkChanged() { if (!glance.lock.displayDark) glance.armWakeGuard() } ++ function onWakeRequested() { glance.noteActivity() } ++ // Text that reaches the field another way still shows the PIN view. ++ function onPasswordTextChanged() { if (glance.showing && glance.lock.passwordText.length > 0) glance.reveal() } ++ } ++ ++ Component.onCompleted: if (active) { refresh(); Qt.callLater(function() { if (glance.showing) glance.forceActiveFocus() }) } ++ onActiveChanged: if (active) refresh() ++ ++ // Back to the glance after 15 s on the PIN view with nothing typed, ++ // counted on the wall clock as the lock's blank timer is: a countdown ++ // frozen by sleep would otherwise pick up where it stopped after resume. ++ Timer { ++ id: idleTimer ++ objectName: "lockGlanceIdle" ++ property int returnAfter: 15000 ++ // When the PIN view last had input, or the countdown began. ++ property double since: 0 ++ interval: 1000 ++ repeat: true ++ running: glance.active && !glance.shown && glance.lock.passwordText.length === 0 && !glance.lock.authenticatingPassword ++ onRunningChanged: if (running) since = Date.now() ++ onTriggered: { ++ if (!(since > 0)) since = Date.now() ++ else if (Date.now() - since >= returnAfter) glance.show() ++ } ++ } ++ ++ // The notification files have no change signal to watch, so they are read ++ // again every few seconds while the lock is in use, and not while it sits ++ // dark: the lock blanks the screen 10 s after the last input. ++ Timer { ++ id: pollTimer ++ interval: 5000 ++ repeat: true ++ running: glance.active && glance.polling ++ onTriggered: { ++ if (Date.now() - glance.lastActivity > 20000) glance.polling = false ++ else glance.refresh() ++ } ++ } ++ ++ SystemClock { ++ id: clock ++ precision: SystemClock.Minutes ++ } ++ ++ Process { ++ id: notificationsProc ++ command: ["bash", "-c", "shopt -s nullglob; set -- \"$1\"*.json \"$1\"history/*.json; (($#)) && awk 1 \"$@\" 2>/dev/null; true", ++ "--", glance.home + "/.local/state/omarchy/notifications/"] ++ stdout: StdioCollector { ++ waitForEnd: true ++ onStreamFinished: { ++ glance.notificationsRaw = String(text || "") ++ glance.pruneDismissed(glance.notificationsRaw) ++ } ++ } ++ } ++ ++ Process { ++ id: forgetProc ++ onExited: { ++ glance.runForget() ++ glance.refresh() ++ } ++ } ++ ++ FileView { ++ path: glance.active ? glance.home + "/.local/state/omarchy/toggles/lock-hide-notification-text" : "" ++ watchChanges: true ++ printErrors: false ++ onLoaded: glance.hideText = true ++ onLoadFailed: glance.hideText = false ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ path: glance.active ? glance.home + "/.local/state/omarchy/notifications.json" : "" ++ watchChanges: true ++ printErrors: false ++ onLoaded: glance.doNotDisturb = Glance.doNotDisturb(text()) ++ onLoadFailed: glance.doNotDisturb = false ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ path: glance.active ? glance.home + "/.local/state/omamobile/weather.json" : "" ++ watchChanges: true ++ printErrors: false ++ onLoaded: glance.weatherRaw = text() ++ onLoadFailed: glance.weatherRaw = "" ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ // The bar's clock format, read whatever the lock shows, at once (a small ++ // file), again on every change and each time the glance comes back. A ++ // read that fails (shell.json being replaced) keeps the last format. ++ id: shellFile ++ path: glance.home + "/.config/omarchy/shell.json" ++ blockLoading: true ++ watchChanges: true ++ printErrors: false ++ onLoaded: { ++ var format = Glance.barClockFormat(text()) ++ if (format !== null) glance.barClockFormat = format ++ } ++ onFileChanged: reload() ++ } ++ ++ // ---------------------------------------------------------------- PIN view ++ ++ // The time, small, above the PIN view's hint or field. ++ Text { ++ id: pinClock ++ objectName: "lockPinClock" ++ textFormat: Text.PlainText ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: Math.max(Style.space(24), glance.pinTop - Style.space(22) - height) ++ visible: glance.progress < 1 ++ opacity: 1 - glance.progress ++ text: Qt.formatDateTime(clock.date, Glance.timeFormat(glance.twelveHour)) ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.display ++ } ++ ++ // ---------------------------------------------------------------- glance ++ ++ Item { ++ id: glanceLayer ++ objectName: "lockGlanceView" ++ anchors.fill: parent ++ visible: glance.progress > 0 ++ enabled: glance.showing ++ opacity: glance.progress ++ ++ Item { ++ id: content ++ anchors.fill: parent ++ // Follows a swipe a little, and rises as the PIN view comes in. ++ transform: Translate { ++ y: Math.min(0, swipe.dragY) * 0.4 - Style.space(40) * (1 - glance.progress) ++ } ++ ++ Column { ++ id: header ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: Math.round(parent.height * 0.113) ++ width: Math.min(Style.space(380), parent.width - Style.space(32)) ++ spacing: 0 ++ ++ Text { ++ id: timeLabel ++ objectName: "lockGlanceTime" ++ width: parent.width ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: Glance.glanceTime(clock.date, glance.twelveHour) ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.weight: Font.Light ++ font.pixelSize: Math.round(Style.font.displayLarge * 3.7) ++ fontSizeMode: Text.HorizontalFit ++ minimumPixelSize: Style.font.display ++ } ++ ++ Text { ++ objectName: "lockGlanceDate" ++ width: parent.width ++ topPadding: Style.space(14) ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: Qt.formatDate(clock.date, "dddd, MMMM d") ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.heading ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockGlanceWeather" ++ width: parent.width ++ topPadding: Style.space(6) ++ visible: glance.weatherText.length > 0 ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: glance.weatherText ++ color: Commons.Color.lock.placeholder ++ font.family: Style.font.family ++ font.pixelSize: Style.font.title ++ elide: Text.ElideRight ++ } ++ } ++ ++ // Between the header and the hint; the cards that don't fit fold ++ // into the "more" line. ++ Item { ++ id: cardsArea ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: header.y + header.height + Style.space(40) ++ width: header.width ++ height: Math.max(0, hint.y - Style.space(24) - y) ++ onHeightChanged: Qt.callLater(glance.refit) ++ ++ Column { ++ id: cardsColumn ++ objectName: "lockGlanceCards" ++ width: parent.width ++ spacing: Style.space(10) ++ ++ Repeater { ++ id: cardsRepeater ++ model: glance.shownCards ++ ++ NotificationCard { ++ required property var modelData ++ required property int index ++ objectName: "lockGlanceCard" ++ width: cardsColumn.width ++ visible: index < glance.fitCount ++ app: modelData.app ++ appIcon: modelData.appIcon ++ image: modelData.image ++ glyph: modelData.glyph ++ urgency: modelData.urgency ++ timestamp: modelData.timestamp ++ summary: modelData.summary ++ body: modelData.body ++ detail: modelData.detail ++ readonly property bool open: !!glance.expanded[modelData.file] ++ summaryLines: open ? 2 : 1 ++ bodyLines: open ? 4 : 1 ++ cornerRadius: Style.cornerRadius ++ fontFamily: Style.font.family ++ swipeEnabled: false ++ closeButtonShown: false ++ // No actions from the lock: a tap opens or closes the card ++ // (the glance's touch area below does it; this is the same ++ // for a click that reaches the card), and a card swiped off ++ // its side (the touch area moves it, the card's own ++ // finishSwipe from patch 0017 decides) is forgotten. ++ onCardClicked: glance.toggleCard(modelData.file) ++ onCloseRequested: glance.dismiss(modelData.file) ++ onImplicitHeightChanged: Qt.callLater(glance.refit) ++ } ++ } ++ ++ Text { ++ id: moreLabel ++ objectName: "lockGlanceMore" ++ width: parent.width ++ visible: glance.moreText.length > 0 ++ topPadding: Style.space(2) ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: glance.moreText ++ color: Commons.Color.lock.placeholder ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockGlanceQuiet" ++ width: parent.width ++ visible: glance.cards.length === 0 ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: "No new notifications" ++ color: Commons.Color.lock.placeholder ++ font.family: Style.font.family ++ font.pixelSize: Style.font.title ++ } ++ } ++ } ++ ++ Text { ++ id: hint ++ objectName: "lockGlanceHint" ++ anchors.horizontalCenter: parent.horizontalCenter ++ width: parent.width - Style.space(32) ++ // Where the PIN view has its emergency call: above the sensor's ++ // fingerprint mark, or near the bottom without fingerprints. ++ y: glance.lock && glance.lock.keypadClearsSensor ? glance.sensorTop + Style.space(26) ++ : parent.height - (glance.lock ? glance.lock.keypadBottomMargin : 0) - height ++ textFormat: Text.PlainText ++ text: glance.lock && glance.lock.fingerprintConfigured ? "Touch the fingerprint sensor or swipe up" : "Swipe up to unlock" ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ wrapMode: Text.WordWrap ++ horizontalAlignment: Text.AlignHCenter ++ } ++ } ++ ++ // Over everything, cards included. The first 12 px of a drag decide its ++ // way: mostly sideways on a card swipes that card (off its side, past ++ // 35 % or a flick, dismisses it); mostly vertical is the swipe up to the ++ // PIN view (a clear drag, 8 % of the height, or a quick flick), from a ++ // card too. A tap on a card opens or closes it, a tap anywhere else does ++ // nothing, and a touch that wakes a dark screen only wakes it. ++ MouseArea { ++ id: swipe ++ objectName: "lockGlanceSwipe" ++ anchors.fill: parent ++ property real startY: 0 ++ property real startX: 0 ++ property double startAt: 0 ++ property real dragY: 0 ++ // This touch woke the screen (glance.wakeTouch): it does nothing else. ++ property bool wakeOnly: false ++ // "", "x" (a card swipe) or "y" (toward the PIN view), from the first ++ // 12 px of movement. ++ property string axis: "" ++ property var swipeCard: null ++ property real lastX: 0 ++ property double lastAt: 0 ++ property real velocityX: 0 ++ onPressed: function(mouse) { ++ wakeOnly = glance.wakeTouch() ++ startY = mouse.y ++ startX = mouse.x ++ startAt = Date.now() ++ lastX = mouse.x ++ lastAt = startAt ++ velocityX = 0 ++ dragY = 0 ++ axis = "" ++ swipeCard = null ++ } ++ onPositionChanged: function(mouse) { ++ if (wakeOnly) return ++ var dx = mouse.x - startX ++ var dy = mouse.y - startY ++ if (!axis && Math.max(Math.abs(dx), Math.abs(dy)) >= Style.space(12)) { ++ axis = Math.abs(dx) > Math.abs(dy) ? "x" : "y" ++ if (axis === "x") { ++ var card = glance.cardAt(swipe, startX, startY) ++ swipeCard = card && !card.dismissing ? card : null ++ } ++ } ++ if (axis === "y") dragY = dy ++ if (axis === "x" && swipeCard) { ++ var t = Date.now() ++ if (t > lastAt) velocityX = (mouse.x - lastX) * 1000 / (t - lastAt) ++ lastX = mouse.x ++ lastAt = t ++ swipeCard.swipeOffset = dx ++ swipeCard.swipeVelocity = velocityX ++ } ++ } ++ onReleased: function(mouse) { ++ var moved = mouse.y - startY ++ dragY = 0 ++ if (wakeOnly) { ++ wakeOnly = false ++ return ++ } ++ if (axis === "x") { ++ if (swipeCard) swipeCard.finishSwipe() ++ swipeCard = null ++ return ++ } ++ var quick = Date.now() - startAt < 300 && moved < -Style.space(24) ++ if (axis === "y" && (moved < -glance.height * 0.08 || quick)) { ++ glance.reveal() ++ return ++ } ++ if (Math.abs(moved) < Style.space(12) && Math.abs(mouse.x - startX) < Style.space(12)) { ++ var card = glance.cardAt(swipe, mouse.x, mouse.y) ++ if (card) glance.toggleCard(card.modelData.file) ++ } ++ } ++ onCanceled: { ++ dragY = 0 ++ wakeOnly = false ++ if (swipeCard) { ++ swipeCard.swipeVelocity = 0 ++ swipeCard.swipeOffset = 0 ++ } ++ swipeCard = null ++ } ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -31,6 +31,16 @@ + // The ABC/123 switch in the field swaps either way, so a password with + // letters and digits can always be typed. + property bool passwordFirst: false ++ // The glance view (LockGlance.qml) over the PIN view on touch-only ++ // devices: the PIN view's parts fade in as it goes, and are hidden while it ++ // is up. The lock bumps wakeSerial when the screen is woken and ++ // blankSerial when it goes dark, and each brings the glance back; while ++ // displayDark, a touch only wakes the screen. ++ property int wakeSerial: 0 ++ property int blankSerial: 0 ++ property bool displayDark: false ++ readonly property real pinOpacity: 1 - glance.progress ++ readonly property bool pinVisible: glance.progress < 1 + property bool switchedInput: false + readonly property bool padShown: keypad && (passwordFirst === switchedInput) + readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 +@@ -73,6 +83,10 @@ + } + + function forcePasswordFocus() { ++ if (glance.showing) { ++ glance.forceActiveFocus() ++ return ++ } + if (padShown) { + keypadKeys.forceActiveFocus() + return +@@ -200,7 +214,8 @@ + + Keypad { + id: numberPad +- visible: root.padShown ++ visible: root.padShown && root.pinVisible ++ opacity: root.pinOpacity + enabled: root.inputEnabled && !root.authenticatingPassword + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom +@@ -226,6 +241,8 @@ + + BorderSurface { + id: inputField ++ visible: root.pinVisible ++ opacity: root.pinOpacity + width: root.fieldWidth + height: root.fieldHeight + anchors.horizontalCenter: parent.horizontalCenter +@@ -365,7 +382,8 @@ + anchors.bottomMargin: Style.space(18) + anchors.horizontalCenter: inputField.horizontalCenter + width: parent.width - Style.space(32) +- visible: root.keypadClearsSensor ++ visible: root.keypadClearsSensor && root.pinVisible ++ opacity: root.pinOpacity + text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" + : "Touch the fingerprint sensor or enter your password" + color: Commons.Color.lock.text +@@ -383,9 +401,10 @@ + Item { + id: emergencyButton + objectName: "lockEmergencyCall" +- visible: root.keypad ++ visible: root.keypad && root.pinVisible ++ opacity: root.pinOpacity + anchors.horizontalCenter: parent.horizontalCenter +- anchors.top: numberPad.visible ? numberPad.bottom : inputField.bottom ++ anchors.top: root.padShown ? numberPad.bottom : inputField.bottom + anchors.topMargin: Style.space(20) + width: emergencyLabel.implicitWidth + Style.space(40) + height: Math.max(Style.space(44), emergencyLabel.implicitHeight + Style.space(16)) +@@ -411,5 +430,12 @@ + } + } + } ++ ++ LockGlance { ++ id: glance ++ anchors.fill: parent ++ lock: root ++ pinTop: root.keypadClearsSensor ? keypadHint.y : inputField.y ++ } + } + } +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -31,6 +31,15 @@ + property int failedAttempts: 0 + property string backgroundPath: "" + property int backgroundVersion: 0 ++ // Bumped by the wake call (a phone's power button): the lock's glance view ++ // comes back each time the screen is woken. ++ property int wakeSerial: 0 ++ // Bumped whenever the locked display goes dark: the lock's own blank, or ++ // the dark call (a phone's power button, sleep). The glance view comes ++ // back each time, and displayDark holds until the display is lit through ++ // the lock again, so the touch that wakes a dark screen only wakes it. ++ property int blankSerial: 0 ++ property bool displayDark: false + property string lastEvent: "init" + property string lastEventAt: "" + property bool strandedLock: false +@@ -178,14 +187,22 @@ + } + + function runWake() { ++ displayDark = false + if (!wakeProcess.running) wakeProcess.running = true + if (lockRequested) armBlankTimer() + } + + function runBlank() { ++ markDark() + if (!blankProcess.running) blankProcess.running = true + } + ++ function markDark() { ++ if (!lockRequested) return ++ blankSerial += 1 ++ displayDark = true ++ } ++ + function submitPassword(value) { + var password = String(value || "") + if (!lockRequested || authenticatingPassword || password.length === 0) return +@@ -280,6 +297,9 @@ + + LockView { + keypad: root.keypad ++ wakeSerial: root.wakeSerial ++ blankSerial: root.blankSerial ++ displayDark: root.displayDark + id: lockView + anchors.fill: parent + backgroundPath: root.backgroundPath +@@ -548,10 +568,21 @@ + // it and re-arm the blank timer (a phone's power button). + function wake(): string { + if (!root.currentlyLocked()) return "unlocked" ++ root.wakeSerial += 1 + root.runWake() + return "ok" + } + ++ // The locked display went dark some other way than the lock's own blank ++ // (a phone's power button, or just before sleep): back to the glance ++ // view, and the touch that next wakes the screen only wakes it. The ++ // display itself is left as it is. ++ function dark(): string { ++ if (!root.currentlyLocked()) return "unlocked" ++ root.markDark() ++ return "ok" ++ } ++ + function isLocked(): string { + return root.currentlyLocked() ? "true" : "false" + } +diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml +--- i/shell/plugins/notifications/components/NotificationCard.qml ++++ w/shell/plugins/notifications/components/NotificationCard.qml +@@ -27,6 +27,11 @@ + property int urgency: 1 + property double timestamp: 0 + property int cornerRadius: 0 ++ // A static summary (a phone's lock screen) keeps each card short, and ++ // says beside the summary how many there are and how old ("2 new, 5m"). ++ property int summaryLines: 2 ++ property int bodyLines: 3 ++ property string detail: "" + + // System monospace font injected by the container. + property string fontFamily: "" +@@ -300,7 +305,7 @@ + font.bold: true + wrapMode: Text.WordWrap + elide: Text.ElideRight +- maximumLineCount: 2 ++ maximumLineCount: root.summaryLines + } + + Text { +@@ -314,9 +319,19 @@ + font.pixelSize: Style.font.title + wrapMode: Text.WordWrap + elide: Text.ElideRight +- maximumLineCount: 3 ++ maximumLineCount: root.bodyLines + } + } ++ ++ Text { ++ textFormat: Text.PlainText ++ Layout.alignment: Qt.AlignTop ++ visible: root.detail.length > 0 ++ text: root.detail ++ color: root.dimColor ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.bodySmall ++ } + } + + // Reply, then a field with Send and Cancel, each tall enough to tap on diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch b/packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch new file mode 100644 index 000000000..f8ad213c4 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch @@ -0,0 +1,39 @@ +# App icons: the icon index keeps the largest size per name, not the first +# file found. The scan lists SVGs first, then PNGs in directory order, and +# kept the first hit, so a raster-only app such as Chromium (16 to 256 px +# PNGs, no SVG) resolved to its 32x32 file, drawn soft on a phone's home +# screen at 64 logical (192 physical) pixels. An SVG or a "scalable" path +# still wins over any size; then the larger NxN directory (@Nx scaled). +# Candidate for upstream Omarchy. +diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml +--- i/shell/services/AppLibrary.qml ++++ w/shell/services/AppLibrary.qml +@@ -136,6 +136,17 @@ + ].join(' ') + } + ++ // The size an icon path was drawn for: "scalable" or an SVG beats any ++ // size, then the larger NxN directory wins, so a raster-only app (Chromium ++ // ships 16 to 256 px PNGs) isn't drawn from its 32 px file at a home ++ // screen's 192 physical pixels. Pixmaps and unsized paths come last. ++ function iconPathSize(path) { ++ if (/\.svg$/.test(path) || path.indexOf("/scalable/") >= 0) return 100000 ++ var m = /\/(\d+)x\d+(@\d+x)?\//.exec(path) ++ if (!m) return 0 ++ return parseInt(m[1], 10) * (m[2] ? parseInt(m[2].slice(1), 10) : 1) ++ } ++ + function indexIconLine(path) { + var value = String(path || "").trim() + if (value.length === 0) return +@@ -143,7 +154,9 @@ + var file = slash >= 0 ? value.slice(slash + 1) : value + var dot = file.lastIndexOf(".") + var name = dot > 0 ? file.slice(0, dot) : file +- if (name.length > 0 && root.pendingIconIndex[name] === undefined) ++ if (name.length === 0) return ++ var known = root.pendingIconIndex[name] ++ if (known === undefined || iconPathSize(value) > iconPathSize(known)) + root.pendingIconIndex[name] = value + } + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch b/packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch new file mode 100644 index 000000000..faabb29e4 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch @@ -0,0 +1,30 @@ +# App launch: no "Launching ..." toast for a desktop entry that runs +# omarchy-shell. Such an entry opens a shell surface (on the phone the +# Updates entry summons the update sheet), never a toplevel, so the toast +# waited for a window that never came and sat over the sheet's buttons +# until its timeout. Every other launch keeps the toast. Candidate for +# upstream Omarchy. +diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml +--- i/shell/services/AppLibrary.qml ++++ w/shell/services/AppLibrary.qml +@@ -74,10 +74,19 @@ + if (!iconIndexScan.running) iconIndexScan.running = true + } + ++ // An entry that runs omarchy-shell opens a shell surface (a panel or a ++ // sheet), never a window, so the launch toast would wait for a toplevel ++ // that doesn't come and cover the surface until it times out. ++ function launchesShellSurface(id) { ++ var entry = DesktopEntries.byId(id) ++ var command = entry && entry.command ? entry.command : [] ++ return command.length > 0 && String(command[0]).replace(/^.*\//, "") === "omarchy-shell" ++ } ++ + function launch(desktopId, name) { + var id = String(desktopId || "") + if (!id) return +- root.beginLaunchFeedback(name) ++ if (!root.launchesShellSurface(id)) root.beginLaunchFeedback(name) + // Start gtk-launch inside a scope under app-graphical.slice so apps do not + // inherit wayland-wm@.service. Keeping gtk-launch as the desktop-entry + // resolver supports IDs with spaces and entries that UWSM rejects. diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch b/packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch new file mode 100644 index 000000000..daae350e2 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch @@ -0,0 +1,238 @@ +# Lock: the battery on the lock screen, top right, as the phone's status bar +# shows it: the bar's Nerd Font battery glyph at the level (the glyph carries +# a bolt while charging, a plug when full, exactly as the bar's does; no +# second bolt) and the percentage. On every omamobile device with a battery, +# over the glance view and the PIN view alike; a device with no battery (a +# desktop test box) shows nothing, never "No battery". +# +# Read from the kernel's power supplies (LockBattery.js): the first present +# Battery whose scope is not Device gives the percentage (a paired keyboard, +# mouse or controller is a Battery too, hid-…-battery, scope Device, and +# sorts before the phone's max170xx_battery; the gauges set no scope, so +# they read as empty and count; scope is read before capacity, which can +# wake a HID device); charging is any charger supply (Mains, USB, USB_C, +# USB_PD, Wireless) online, or that same battery, no other, saying Charging +# or Full. The charger's online flag is the signal +# that holds: the fuel gauge says Discharging whenever the net current is +# negative, even with the charger plugged in, and UPower's OnBattery follows +# the battery's state, so the bar's `!UPower.onBattery` can miss it (and +# Quickshell's UPower exposes no line-power Online to ask instead). One +# bash process every 15 s while the display is lit, one at each wake, none +# while it is dark. A reading that hangs is cut by timeout(1) and a 4 s +# stale timer, and clears the state; the bolt is dropped when the display +# goes dark so a wake never paints a stale one before its own reading. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0023. +diff --git i/shell/plugins/lock/LockBattery.js w/shell/plugins/lock/LockBattery.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockBattery.js +@@ -0,0 +1,61 @@ ++// The lock's battery reading, from the kernel's power supplies ++// (/sys/class/power_supply). The first battery that is present and whose ++// scope is not Device gives the percentage: a paired keyboard, mouse or ++// game controller is a Battery supply too (hid-…-battery, ++// ps-controller-battery-…), present, with scope Device, and sorts before ++// the phone's gauge (max170xx_battery); the gauges set no scope, so it ++// reads as empty and they count. Charging is any charger supply (Mains, ++// USB, USB_C, USB_PD, Wireless) online, or that same battery, no other, ++// saying Charging or Full. The charger's online flag is the truthful ++// signal: a fuel gauge reports Discharging whenever the net current is ++// negative, even with the charger plugged in. ++ ++// One line per supply: type, present, capacity, status, online, scope, ++// tab-separated. Type and scope are read first, and a Device-scope battery ++// is skipped before its capacity is read (a read that can wake a HID device). ++var COMMAND = "shopt -s nullglob; for d in \"$1\"/*/; do t= sc= p= c= s= o=; " + ++ "read -r t 2>/dev/null < \"$d/type\"; read -r sc 2>/dev/null < \"$d/scope\"; " + ++ "[ \"$t\" = Battery ] && [ \"$sc\" = Device ] && continue; " + ++ "read -r p 2>/dev/null < \"$d/present\"; read -r c 2>/dev/null < \"$d/capacity\"; " + ++ "read -r s 2>/dev/null < \"$d/status\"; read -r o 2>/dev/null < \"$d/online\"; " + ++ "printf '%s\\t%s\\t%s\\t%s\\t%s\\t%s\\n' \"$t\" \"$p\" \"$c\" \"$s\" \"$o\" \"$sc\"; done" ++ ++var CHARGERS = ["Mains", "USB", "USB_C", "USB_PD", "Wireless"] ++ ++function parse(text) { ++ var out = { present: false, percent: -1, charging: false, full: false } ++ var lines = String(text || "").split("\n") ++ for (var i = 0; i < lines.length; i++) { ++ var f = lines[i].split("\t") ++ if (f.length < 5) continue ++ var type = f[0], present = f[1], capacity = f[2], status = f[3], online = f[4], scope = f[5] || "" ++ if (type === "Battery" && present !== "0" && scope !== "Device") { ++ // The first such battery is the one; its status alone says Charging or ++ // Full, a peripheral's never does. ++ if (!out.present && /^[0-9]+$/.test(capacity)) { ++ out.present = true ++ out.percent = Math.max(0, Math.min(100, parseInt(capacity, 10))) ++ if (status === "Charging" || status === "Full") out.charging = true ++ if (status === "Full") out.full = true ++ } ++ } else if (CHARGERS.indexOf(type) >= 0 && online === "1") { ++ out.charging = true ++ } ++ } ++ return out ++} ++ ++// The status bar's glyphs (omamobile.bar StatusModel.batteryIcon): a battery ++// at the level, with a bolt while charging, a plug when full. ++function icon(percent, charging, full) { ++ if (percent < 0) return "" ++ if (full) return "󰂅" ++ var chargingIcons = ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"] ++ var defaultIcons = ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] ++ var index = Math.max(0, Math.min(9, Math.floor(percent / 10))) ++ return charging ? chargingIcons[index] : defaultIcons[index] ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { COMMAND: COMMAND, parse: parse, icon: icon } ++} +diff --git i/shell/plugins/lock/LockBattery.qml w/shell/plugins/lock/LockBattery.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockBattery.qml +@@ -0,0 +1,122 @@ ++import QtQuick ++import Quickshell.Io ++import qs.Commons ++import qs.Commons as Commons ++import "LockBattery.js" as Battery ++ ++// The battery on the lock, as the status bar shows it: the bar's battery ++// glyph (which carries the bolt while charging, the plug when full) and the ++// percentage. Read from the kernel's power supplies (LockBattery.js; a ++// peripheral's Device-scope battery never counts) every 15 s while the ++// display is lit, and at each wake. Nothing at all without a battery. ++Item { ++ id: battery ++ ++ // Polled while lit; a bump of wakeSerial reads at once. ++ property bool lit: true ++ property int wakeSerial: 0 ++ ++ property bool present: false ++ property int percent: -1 ++ property bool charging: false ++ property bool full: false ++ readonly property bool low: present && percent <= 10 && !charging ++ ++ visible: present ++ implicitWidth: row.implicitWidth ++ implicitHeight: row.implicitHeight ++ ++ function refresh() { ++ if (supplies.running) return ++ supplies.running = true ++ stale.restart() ++ } ++ ++ function clear() { ++ present = false ++ percent = -1 ++ charging = false ++ full = false ++ } ++ ++ onLitChanged: { ++ if (lit) { ++ refresh() ++ } else { ++ // Dark: the charger may go while nobody looks. Keep the level, drop ++ // the bolt, so the next wake never paints a stale one; the wake's ++ // reading puts it back if the charger is still there. ++ charging = false ++ full = false ++ } ++ } ++ onWakeSerialChanged: refresh() ++ Component.onCompleted: refresh() ++ ++ Timer { ++ interval: 15000 ++ repeat: true ++ running: battery.lit ++ onTriggered: battery.refresh() ++ } ++ ++ // A reading that never comes back (a sysfs read that hangs) must not hold ++ // the last state up: after the deadline the process is stopped and the ++ // state cleared; the next tick or wake reads again. ++ Timer { ++ id: stale ++ interval: 4000 ++ onTriggered: { ++ if (!supplies.running) return ++ supplies.running = false ++ battery.clear() ++ } ++ } ++ ++ Process { ++ id: supplies ++ // timeout(1) ends a bash stuck on a sysfs read before the stale timer ++ // would; a failed or killed run clears the state as an empty one does. ++ command: ["timeout", "-k", "1", "3", "bash", "-c", Battery.COMMAND, "--", "/sys/class/power_supply"] ++ stdout: StdioCollector { ++ waitForEnd: true ++ onStreamFinished: { ++ stale.stop() ++ var s = Battery.parse(String(text || "")) ++ battery.present = s.present ++ battery.percent = s.percent ++ battery.charging = s.charging ++ battery.full = s.full ++ } ++ } ++ onExited: function(exitCode, exitStatus) { ++ stale.stop() ++ if (exitCode !== 0) battery.clear() ++ } ++ } ++ ++ Row { ++ id: row ++ spacing: Style.space(6) ++ ++ Text { ++ objectName: "lockBatteryIcon" ++ anchors.verticalCenter: parent.verticalCenter ++ textFormat: Text.PlainText ++ text: Battery.icon(battery.percent, battery.charging, battery.full) ++ color: battery.low ? Commons.Color.lock.textError : Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Math.round(Style.font.title * 1.2) ++ } ++ ++ Text { ++ objectName: "lockBatteryPercent" ++ anchors.verticalCenter: parent.verticalCenter ++ textFormat: Text.PlainText ++ text: battery.percent + "%" ++ color: battery.low ? Commons.Color.lock.textError : Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.title ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -437,5 +437,16 @@ Item { + lock: root + pinTop: root.keypadClearsSensor ? keypadHint.y : inputField.y + } ++ ++ // The battery, top right, over the glance and the PIN view alike; shown ++ // only on a device that has one. ++ LockBattery { ++ objectName: "lockBattery" ++ anchors.top: parent.top ++ anchors.right: parent.right ++ anchors.margins: Style.space(24) ++ lit: !root.displayDark ++ wakeSerial: root.wakeSerial ++ } + } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch b/packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch new file mode 100644 index 000000000..44f47da71 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch @@ -0,0 +1,623 @@ +# Lock: media controls, as a phone has them, for whatever plays or is +# paused (MPRIS, Quickshell.Services.Mpris): on the glance a card above the +# notifications, in their palette, with the album art, the title, the +# artist, the app's name, how far the track has played, and previous, +# play/pause and next; on the PIN view a single row above the small clock, +# in the lock's palette, only when the PIN view has the room (with +# fingerprints set up the pad reaches up to the clock, and the row is left +# out rather than crowd it). No player, nothing. +# +# Transport only: no tap opens the app (no MPRIS Raise, nothing started), +# no seeking, no choosing another player. On the glance the touch area over +# everything hands a tap on a control to it (LockMedia.buttonAt); a tap +# elsewhere on the card does nothing, a swipe up from it still goes to the +# PIN view, and the touch that wakes a dark screen only wakes it. +# +# Which player: one that plays or is paused and has a title; playing +# before paused, then the one that started or changed track last; Omarchy's +# media service's proxy rule (MediaModel.isProxyPlayer: playerctld only +# repeats another player) from its own MediaModel.js. The same order as +# the phone shade's media card (omamobile-shell's MediaModel.js). +# +# Privacy: the lock loads local art only (a file the player wrote, or a +# data: image); a cover on the network (https://) would be a request from +# the locked phone nobody asked for, so the app's icon stands in. With the +# lock-hide-notification-text toggle on, the app's name and "Playing" or +# "Paused" stand in for the track, and no art shows. The position is asked +# for once a second while a player plays and the display is lit, never +# while it is dark. On a computer (keypad off) nothing shows. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0023 and 0026. +diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml +--- i/shell/plugins/lock/LockGlance.qml ++++ w/shell/plugins/lock/LockGlance.qml +@@ -22,6 +22,11 @@ + // clock format and the home screen's last weather reading. Nothing here + // acts on a notification or asks the network. + // ++// While a player plays or is paused, media controls (LockMedia.qml) sit ++// above the cards on the glance, and in a row above the small clock on the ++// PIN view when it has the room: previous, play/pause and next, nothing ++// more (no app, no seeking). ++// + // On a computer (keypad off) it shows nothing and reads nothing but the + // bar's clock format. + Item { +@@ -137,8 +142,8 @@ + } + + function refit() { +- var avail = cardsArea.height + var gap = cardsColumn.spacing ++ var avail = cardsArea.height - (glanceMedia.visible ? glanceMedia.implicitHeight + gap : 0) + var moreHeight = moreLabel.implicitHeight + gap + var used = 0 + var n = 0 +@@ -286,6 +291,13 @@ + precision: SystemClock.Minutes + } + ++ // The player the media controls show; its position asked for only while ++ // the lock is lit. ++ LockMediaSource { ++ id: mediaSource ++ ticking: glance.active && !!glance.lock && !glance.lock.displayDark ++ } ++ + Process { + id: notificationsProc + command: ["bash", "-c", "shopt -s nullglob; set -- \"$1\"*.json \"$1\"history/*.json; (($#)) && awk 1 \"$@\" 2>/dev/null; true", +@@ -367,6 +379,25 @@ + font.pixelSize: Style.font.display + } + ++ // Media controls in one row under the battery, above the small clock; ++ // left out when the PIN view has no room for them there. ++ LockMedia { ++ id: pinMedia ++ objectName: "lockPinMedia" ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: Style.space(72) ++ width: Math.min(Style.space(380), parent.width - Style.space(32)) ++ height: implicitHeight ++ compact: true ++ textColor: Commons.Color.lock.text ++ player: glance.active ? mediaSource.player : null ++ hideText: glance.hideText ++ readonly property bool fits: y + implicitHeight + Style.space(12) <= pinClock.y ++ visible: !!player && fits && glance.progress < 1 ++ opacity: 1 - glance.progress ++ onActivity: glance.lock.wakeRequested() ++ } ++ + // ---------------------------------------------------------------- glance + + Item { +@@ -451,6 +482,18 @@ + width: parent.width + spacing: Style.space(10) + ++ LockMedia { ++ id: glanceMedia ++ objectName: "lockGlanceMedia" ++ width: cardsColumn.width ++ height: implicitHeight ++ player: glance.active ? mediaSource.player : null ++ hideText: glance.hideText ++ onActivity: glance.noteActivity() ++ onImplicitHeightChanged: Qt.callLater(glance.refit) ++ onVisibleChanged: Qt.callLater(glance.refit) ++ } ++ + Repeater { + id: cardsRepeater + model: glance.shownCards +@@ -508,6 +551,7 @@ + width: parent.width + visible: glance.cards.length === 0 + horizontalAlignment: Text.AlignHCenter ++ topPadding: glanceMedia.visible ? Style.space(14) : 0 + textFormat: Text.PlainText + text: "No new notifications" + color: Commons.Color.lock.placeholder +@@ -610,6 +654,12 @@ + return + } + if (Math.abs(moved) < Style.space(12) && Math.abs(mouse.x - startX) < Style.space(12)) { ++ // A media control's tap; elsewhere on the media card, nothing. ++ var control = glanceMedia.visible ? glanceMedia.buttonAt(swipe, mouse.x, mouse.y) : null ++ if (control) { ++ glanceMedia.run(control.action) ++ return ++ } + var card = glance.cardAt(swipe, mouse.x, mouse.y) + if (card) glance.toggleCard(card.modelData.file) + } +diff --git i/shell/plugins/lock/LockMedia.js w/shell/plugins/lock/LockMedia.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockMedia.js +@@ -0,0 +1,124 @@ ++// What the lock's media controls show: which MPRIS player, what it says and ++// which art may load. Pure functions over objects with MprisPlayer's ++// property names, so Node can test them. The order is the phone shade's ++// (omamobile-shell's MediaModel.js): only a player that plays or is paused ++// and has a title; playing before paused; among those the one that started ++// or changed track last; playerctld (a proxy that repeats another player, ++// Omarchy's media service's isProxyPlayer) only when nothing else is there. ++// ++// The lock loads local art only: a file the player wrote, or a data: image. ++// Art on the network (Spotify's https:// covers, a browser's) would be a ++// request from the locked phone that nobody asked for, so the app's icon ++// stands in. ++ ++// MprisPlaybackState.Enum: Stopped, Playing, Paused ++var PLAYING = 1 ++var PAUSED = 2 ++ ++function str(value) { ++ return value === undefined || value === null ? "" : String(value) ++} ++ ++function key(player) { ++ if (!player) return "" ++ return str(player.dbusName || player.desktopEntry || player.identity) ++} ++ ++function playing(player) { ++ return !!player && (!!player.isPlaying || player.playbackState === PLAYING) ++} ++ ++function showable(player) { ++ if (!player || !str(player.trackTitle)) return false ++ return playing(player) || player.playbackState === PAUSED ++} ++ ++// isProxy(player) -> bool: Omarchy's MediaModel.isProxyPlayer. ++function pick(players, order, isProxy) { ++ var list = [] ++ var all = players || [] ++ for (var i = 0; i < all.length; i++) if (showable(all[i])) list.push(all[i]) ++ if (list.length === 0) return null ++ if (isProxy) { ++ var real = list.filter(function(p) { return !isProxy(p) }) ++ if (real.length > 0) list = real ++ } ++ var rank = order || {} ++ list.sort(function(a, b) { ++ if (playing(a) !== playing(b)) return playing(a) ? -1 : 1 ++ return (rank[key(b)] || 0) - (rank[key(a)] || 0) ++ }) ++ return list[0] ++} ++ ++function appName(player) { ++ if (!player) return "" ++ var identity = str(player.identity) ++ if (identity) return identity ++ var entry = str(player.desktopEntry) ++ if (entry) return entry ++ return str(player.dbusName).replace(/^org\.mpris\.MediaPlayer2\./, "").replace(/\.instance[0-9_]+$/, "") ++} ++ ++function artist(player) { ++ if (!player) return "" ++ var a = str(player.trackArtist) ++ if (a) return a ++ var list = player.trackArtists ++ if (list && list.length) { ++ var out = [] ++ for (var i = 0; i < list.length; i++) if (str(list[i])) out.push(str(list[i])) ++ return out.join(", ") ++ } ++ return "" ++} ++ ++// Local art only; "" for the app's icon. ++function artSource(url) { ++ var u = str(url).trim() ++ if (!u) return "" ++ if (u.charAt(0) === "/") return "file://" + u.split("/").map(encodeURIComponent).join("/") ++ var lower = u.toLowerCase() ++ if (lower.indexOf("file:///") === 0) return u ++ if (lower.indexOf("data:image/") === 0) return u ++ return "" ++} ++ ++function hasTimeline(player) { ++ return !!player && !!player.positionSupported && !!player.lengthSupported ++ && Number(player.length) > 0 && isFinite(Number(player.length)) ++} ++ ++function fraction(position, length) { ++ var l = Number(length) ++ if (!(l > 0) || !isFinite(l)) return 0 ++ return Math.max(0, Math.min(1, (Number(position) || 0) / l)) ++} ++ ++function canPlayPause(player) { ++ return !!player && (!!player.canTogglePlaying || !!player.canPlay || !!player.canPause) ++} ++ ++// The lines the controls show: with the lock's hide-notification-text ++// toggle on, the app and whether it plays, never the track. ++function lines(player, hideText) { ++ if (!player) return { title: "", detail: "" } ++ if (hideText) return { title: appName(player), detail: playing(player) ? "Playing" : "Paused" } ++ var a = artist(player) ++ return { title: str(player.trackTitle), detail: a } ++} ++ ++function accessibleName(player, hideText) { ++ if (!player) return "" ++ var l = lines(player, hideText) ++ var parts = [l.title, hideText ? "" : l.detail, hideText ? "" : appName(player)].filter(function(p) { return !!p }) ++ return (playing(player) ? "Playing: " : "Paused: ") + parts.join(", ") ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { ++ PLAYING: PLAYING, PAUSED: PAUSED, key: key, playing: playing, showable: showable, pick: pick, ++ appName: appName, artist: artist, artSource: artSource, hasTimeline: hasTimeline, fraction: fraction, ++ canPlayPause: canPlayPause, lines: lines, accessibleName: accessibleName ++ } ++} +diff --git i/shell/plugins/lock/LockMedia.qml w/shell/plugins/lock/LockMedia.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockMedia.qml +@@ -0,0 +1,297 @@ ++import QtQuick ++import Quickshell ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++import "LockMedia.js" as Media ++ ++// Media controls on the lock: the art (local only, LockMedia.js; else the ++// app's icon), the track and the app's name, how far it has played, and ++// previous, play/pause and next. Transport only: nothing here opens the ++// app, seeks, picks another player or reaches anything past the lock. ++// With the lock-hide-notification-text toggle on, the app's name and ++// "Playing" or "Paused" stand in for the track, and no art shows. ++// ++// On the glance it is a card above the notifications, in their palette ++// (the glance's touch area over it hands its taps to buttonAt); on the PIN ++// view, `compact`, a single row in the lock's palette with its own touch. ++BorderSurface { ++ id: media ++ ++ property var player: null ++ property bool compact: false ++ property bool hideText: false ++ property color textColor: Commons.Color.notifications.text ++ // Called before a control acts (the lock counts it as activity). ++ signal activity() ++ ++ readonly property int touchSize: Math.max(44, Style.space(44)) ++ readonly property int inner: Style.space(compact ? 8 : 14) ++ readonly property int artSize: compact ? touchSize : Math.max(56, Style.space(56)) ++ readonly property bool isPlaying: Media.playing(player) ++ readonly property var shown: Media.lines(player, hideText) ++ readonly property string artUrl: player && !hideText ? Media.artSource(player.trackArtUrl) : "" ++ readonly property var desktopEntry: { ++ if (!player) return null ++ var names = [player.desktopEntry, player.identity] ++ for (var i = 0; i < names.length; i++) { ++ var n = String(names[i] || "") ++ if (!n) continue ++ var e = typeof DesktopEntries.heuristicLookup === "function" ? DesktopEntries.heuristicLookup(n) : DesktopEntries.byId(n) ++ if (e) return e ++ } ++ return null ++ } ++ readonly property string iconSource: { ++ var icon = desktopEntry && desktopEntry.icon ? String(desktopEntry.icon) : "" ++ if (!icon) return "" ++ if (icon.charAt(0) === "/") return "file://" + icon ++ return Quickshell.iconPath(icon, true) ++ } ++ ++ visible: !!player ++ implicitHeight: !player ? 0 : compact ? artSize + inner * 2 : column.implicitHeight + inner * 2 ++ radius: Style.cornerRadius ++ color: compact ? Commons.Color.lock.background : Commons.Color.notifications.background ++ borderSpec: compact ? Border.surfaceSpec("lock", "border", Commons.Color.lock.border, Math.max(1, Style.space(2)), "border-alpha") ++ : Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) ++ ++ Accessible.role: Accessible.Grouping ++ Accessible.name: Media.accessibleName(player, hideText) ++ ++ // The control under a point of `item`, if it can act; the glance's touch ++ // area asks this for a tap. ++ function buttonAt(item, x, y) { ++ var buttons = [previousButton, playButton, nextButton] ++ for (var i = 0; i < buttons.length; i++) { ++ var b = buttons[i] ++ if (!b.visible || !b.enabled) continue ++ var p = item.mapToItem(b, x, y) ++ if (p.x >= 0 && p.y >= 0 && p.x <= b.width && p.y <= b.height) return b ++ } ++ return null ++ } ++ ++ function run(action) { ++ var p = player ++ if (!p) return false ++ activity() ++ if (action === "previous" && p.canGoPrevious) p.previous() ++ else if (action === "next" && p.canGoNext) p.next() ++ else if (action === "playPause" && Media.canPlayPause(p)) { ++ if (p.isPlaying && p.canPause) p.pause() ++ else if (!p.isPlaying && p.canPlay) p.play() ++ else p.togglePlaying() ++ } else return false ++ return true ++ } ++ ++ // ---- art, or the app's icon, or Omarchy's media glyph ++ BorderSurface { ++ id: artFrame ++ objectName: "lockMediaArt" ++ x: media.inner ++ y: media.inner ++ width: media.artSize ++ height: media.artSize ++ radius: Style.cornerRadius ++ clip: true ++ color: Style.normalFillFor(media.textColor, Commons.Color.accent) ++ borderSpec: Border.controlSpec("normal", media.textColor, Commons.Color.accent) ++ ++ Image { ++ id: art ++ anchors.fill: parent ++ anchors.margins: artFrame.borderLeft ++ fillMode: Image.PreserveAspectCrop ++ asynchronous: true ++ sourceSize.width: media.artSize * 2 ++ sourceSize.height: media.artSize * 2 ++ source: media.artUrl ++ visible: status === Image.Ready ++ } ++ ++ Image { ++ id: appIcon ++ anchors.centerIn: parent ++ width: Math.round(media.artSize * 0.6) ++ height: width ++ fillMode: Image.PreserveAspectFit ++ asynchronous: true ++ sourceSize.width: width * 2 ++ sourceSize.height: height * 2 ++ source: art.visible ? "" : media.iconSource ++ visible: !art.visible && status === Image.Ready ++ } ++ ++ Text { ++ anchors.centerIn: parent ++ visible: !art.visible && !appIcon.visible ++ textFormat: Text.PlainText ++ text: "󰝚" ++ color: media.textColor ++ font.family: Style.font.family ++ font.pixelSize: media.compact ? Style.font.title : Style.font.display ++ } ++ } ++ ++ Column { ++ id: column ++ x: media.inner ++ y: media.inner ++ width: media.width - media.inner * 2 ++ spacing: Style.space(8) ++ ++ // The words beside the art (and, compact, the controls after them). ++ Item { ++ width: parent.width ++ height: media.artSize ++ ++ Column { ++ anchors.left: parent.left ++ anchors.leftMargin: media.artSize + Style.space(12) ++ anchors.right: parent.right ++ anchors.rightMargin: media.compact ? controls.width + Style.space(8) : 0 ++ anchors.verticalCenter: parent.verticalCenter ++ spacing: Style.space(2) ++ ++ Text { ++ objectName: "lockMediaApp" ++ width: parent.width ++ visible: !media.compact && !media.hideText && text !== "" ++ textFormat: Text.PlainText ++ text: Media.appName(media.player) ++ color: Qt.darker(media.textColor, 1.4) ++ font.family: Style.font.family ++ font.pixelSize: Math.max(12, Style.font.caption) ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockMediaTitle" ++ width: parent.width ++ textFormat: Text.PlainText ++ text: media.shown.title ++ color: media.textColor ++ font.family: Style.font.family ++ font.pixelSize: media.compact ? Style.font.body : Style.font.subtitle ++ font.bold: true ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockMediaDetail" ++ width: parent.width ++ visible: text !== "" ++ textFormat: Text.PlainText ++ text: media.shown.detail ++ color: Qt.darker(media.textColor, 1.15) ++ font.family: Style.font.family ++ font.pixelSize: media.compact ? Math.max(12, Style.font.caption) : Style.font.body ++ elide: Text.ElideRight ++ } ++ } ++ } ++ ++ // How far the track has played: shown, never a seek bar. ++ Item { ++ objectName: "lockMediaProgress" ++ visible: !media.compact && Media.hasTimeline(media.player) ++ width: parent.width ++ height: visible ? Math.max(4, Style.space(4)) : 0 ++ ++ Rectangle { ++ anchors.fill: parent ++ radius: height / 2 ++ color: Style.selectedFillFor(media.textColor, Commons.Color.accent) ++ } ++ ++ Rectangle { ++ height: parent.height ++ radius: height / 2 ++ width: parent.width * (media.player ? Media.fraction(media.player.position, media.player.length) : 0) ++ color: Commons.Color.accent ++ } ++ } ++ ++ // Room for the controls under the words, on the glance. ++ Item { ++ visible: !media.compact ++ width: parent.width ++ height: visible ? media.touchSize : 0 ++ } ++ } ++ ++ Row { ++ id: controls ++ anchors.right: media.compact ? parent.right : undefined ++ anchors.rightMargin: media.compact ? media.inner : 0 ++ anchors.horizontalCenter: media.compact ? undefined : parent.horizontalCenter ++ y: media.compact ? media.inner + (media.artSize - media.touchSize) / 2 : media.height - media.inner - media.touchSize ++ spacing: media.compact ? Style.space(2) : Style.space(24) ++ ++ MediaButton { ++ id: previousButton ++ objectName: "lockMediaPrevious" ++ glyph: "󰒮" ++ name: "Previous track" ++ action: "previous" ++ enabled: !!media.player && !!media.player.canGoPrevious ++ } ++ ++ MediaButton { ++ id: playButton ++ objectName: "lockMediaPlayPause" ++ glyph: media.isPlaying ? "󰏤" : "󰐊" ++ name: media.isPlaying ? "Pause" : "Play" ++ action: "playPause" ++ primary: true ++ enabled: Media.canPlayPause(media.player) ++ } ++ ++ MediaButton { ++ id: nextButton ++ objectName: "lockMediaNext" ++ glyph: "󰒭" ++ name: "Next track" ++ action: "next" ++ enabled: !!media.player && !!media.player.canGoNext ++ } ++ } ++ ++ component MediaButton: BorderSurface { ++ id: button ++ property string glyph: "" ++ property string name: "" ++ property string action: "" ++ property bool primary: false ++ ++ width: primary && !media.compact ? Math.round(media.touchSize * 1.4) : media.touchSize ++ height: media.touchSize ++ radius: Style.cornerRadius ++ opacity: enabled ? 1 : 0.4 ++ color: buttonTouch.pressed ? Style.pressedFillFor(media.textColor, Commons.Color.accent) ++ : primary ? Util.alpha(Commons.Color.accent, Style.selectedFillAlpha) : "transparent" ++ borderSpec: primary ? Border.controlSpec("selected", media.textColor, Commons.Color.accent) : Border.none() ++ ++ Accessible.role: Accessible.Button ++ Accessible.name: button.name ++ Accessible.onPressAction: if (button.enabled) media.run(button.action) ++ ++ Text { ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: button.glyph ++ color: button.primary ? Commons.Color.accent : media.textColor ++ font.family: Style.font.family ++ font.pixelSize: Style.font.iconLarge ++ } ++ ++ MouseArea { ++ id: buttonTouch ++ anchors.fill: parent ++ enabled: button.enabled ++ onClicked: media.run(button.action) ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockMediaSource.qml w/shell/plugins/lock/LockMediaSource.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockMediaSource.qml +@@ -0,0 +1,52 @@ ++import QtQuick ++import Quickshell.Services.Mpris ++import "../services/media/MediaModel.js" as MediaModel ++import "LockMedia.js" as Media ++ ++// The MPRIS player the lock's media controls show (LockMedia.pick, with ++// Omarchy's media service's proxy rule). The order is kept from when the ++// lock is made: a player that starts playing or changes track goes first ++// among its kind. Its position is asked for once a second while it plays ++// and the display is lit (Quickshell reports it only when asked); nothing ++// runs while the display is dark. ++Item { ++ id: source ++ ++ property var players: Mpris.players ? Mpris.players.values : [] ++ property bool ticking: false ++ ++ property var order: ({}) ++ property int serial: 0 ++ readonly property var player: Media.pick(players, order, MediaModel.isProxyPlayer) ++ ++ function touch(p) { ++ var k = Media.key(p) ++ if (!k) return ++ var next = {} ++ for (var name in order) next[name] = order[name] ++ serial += 1 ++ next[k] = serial ++ order = next ++ } ++ ++ Component.onCompleted: { ++ for (var i = 0; i < players.length; i++) if (Media.playing(players[i])) touch(players[i]) ++ } ++ ++ Instantiator { ++ model: source.players ++ delegate: Connections { ++ required property var modelData ++ target: modelData ++ function onIsPlayingChanged() { if (Media.playing(modelData)) source.touch(modelData) } ++ function onTrackChanged() { source.touch(modelData) } ++ } ++ } ++ ++ Timer { ++ interval: 1000 ++ repeat: true ++ running: source.ticking && !!source.player && Media.playing(source.player) && !!source.player.positionSupported ++ onTriggered: if (source.player) source.player.positionChanged() ++ } ++} diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch b/packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch new file mode 100644 index 000000000..00119b92d --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch @@ -0,0 +1,60 @@ +# Install terminals: a stacked logo for a terminal narrower than the logo. +# omarchy-launch-floating-terminal-with-presentation starts every install +# and setup screen (Install > AI > Dictation, the security setups, plugin +# add) with omarchy-show-logo, and logo.txt is 81 columns wide. A phone held +# upright fits about 66 at Omarchy's terminal font size, so the logo wrapped +# into a screen of broken blocks above the install's first question. A +# terminal too narrow for it now gets the same wordmark stacked on two lines +# (logo-narrow.txt, 48 columns), and one too narrow for that gets none. The +# width is read from the terminal itself (stty on /dev/tty), so a desktop +# terminal, or a run without one, shows the wide logo as before. Candidate +# for upstream Omarchy. +# +# Against Omarchy 4.0.6 (4.0.6-1). +diff --git i/bin/omarchy-show-logo w/bin/omarchy-show-logo +--- i/bin/omarchy-show-logo ++++ w/bin/omarchy-show-logo +@@ -3,7 +3,18 @@ + # omarchy:summary=Display the Omarchy logo in the terminal using green color. + + clear ++# A terminal narrower than the logo (a phone held upright) gets the logo ++# stacked on two lines, and one narrower still gets none, rather than a logo ++# that wraps into noise. ++logo=$OMARCHY_PATH/logo.txt ++columns=$(stty size 2>/dev/null columns )); then ++ logo=$OMARCHY_PATH/logo-narrow.txt ++ if [[ ! -f $logo ]] || (( $(LC_ALL=C.UTF-8 wc -L <"$logo") > columns )); then ++ logo= ++ fi ++fi + echo -e "\033[32m" +-cat <$OMARCHY_PATH/logo.txt ++[[ -n $logo ]] && cat <"$logo" + echo -e "\033[0m" + echo +diff --git i/logo-narrow.txt w/logo-narrow.txt +new file mode 100644 +--- /dev/null ++++ w/logo-narrow.txt +@@ -0,0 +1,19 @@ ++ ▄▄▄ ++ ▄█████▄ ▄███████████▄ ▄███████ ▄███████ ++███ ███ ███ ███ ███ ███ ███ ███ ███ ++███ ███ ███ ███ ███ ███ ███ ███ ███ ++███ ███ ███ ███ ███ ▄███▄▄▄███ ▄███▄▄▄██▀ ++███ ███ ███ ███ ███ ▀███▀▀▀███ ▀███▀▀▀▀ ++███ ███ ███ ███ ███ ███ ███ ██████████ ++███ ███ ███ ███ ███ ███ ███ ███ ███ ++ ▀█████▀ ▀█ ███ █▀ ███ █▀ ███ ███ ++ ███ █▀ ++ ++ ▄███████ ▄█ █▄ ▄█ █▄ ++ ███ ███ ███ ███ ███ ███ ++ ███ █▀ ███ ███ ███ ███ ++ ███ ▄███▄▄▄███▄ ███▄▄▄███ ++ ███ ▀▀███▀▀▀███ ▀▀▀▀▀▀███ ++ ███ █▄ ███ ███ ▄██ ███ ++ ███ ███ ███ ███ ███ ███ ++ ███████▀ ███ █▀ ▀█████▀ diff --git a/packages/omamobile-omarchy/patches/0029-lock-double-tap-to-wake-for-touch-only-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0029-lock-double-tap-to-wake-for-touch-only-devices.patch similarity index 100% rename from packages/omamobile-omarchy/patches/0029-lock-double-tap-to-wake-for-touch-only-devices.patch rename to packages/omamobile-omarchy/legacy-4.0.6/0029-lock-double-tap-to-wake-for-touch-only-devices.patch diff --git a/packages/omamobile-omarchy/patches/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch b/packages/omamobile-omarchy/legacy-4.0.6/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch similarity index 100% rename from packages/omamobile-omarchy/patches/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch rename to packages/omamobile-omarchy/legacy-4.0.6/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch diff --git a/packages/omamobile-omarchy/patches/bridge-4.0.4-menu-first-frame.patch b/packages/omamobile-omarchy/legacy-4.0.6/bridge-4.0.4-menu-first-frame.patch similarity index 100% rename from packages/omamobile-omarchy/patches/bridge-4.0.4-menu-first-frame.patch rename to packages/omamobile-omarchy/legacy-4.0.6/bridge-4.0.4-menu-first-frame.patch diff --git a/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch b/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch index d879205b4..b70bf276c 100644 --- a/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch +++ b/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch @@ -1,15 +1,20 @@ # First run: a platform without a keyboard-first workflow (a phone) skips the # "Learn Keybindings" welcome; omamobile-setup-user marks # welcome-keybindings-not-applicable. Sent upstream as omacom/omarchy#15075. +# +# Omarchy 4.5: rebased only. 4.5 moved the card's title and body into the i18n +# catalog (omarchy-i18n firstRun.keybindings*), which changed the context; the +# guard itself is unchanged and 4.5 still has no opt-out of its own. ---- a/install/user/first-run/welcome.sh -+++ b/install/user/first-run/welcome.sh +diff --git i/install/user/first-run/welcome.sh w/install/user/first-run/welcome.sh +--- i/install/user/first-run/welcome.sh ++++ w/install/user/first-run/welcome.sh @@ -1,3 +1,8 @@ +# A platform without a keyboard-first workflow (a phone, say) opts out of the +# keybindings introduction from its user setup: omarchy-done mark +# welcome-keybindings-not-applicable. +omarchy-done check welcome-keybindings-not-applicable && exit 0 + - # Real newlines, not a literal \n: the card renders the body as it arrives, and - # elides past three lines. - omarchy-notification-send -u critical -g  "Learn Keybindings" \ + # The catalog entry holds a real newline, not a literal \n: the card renders the + # body as it arrives, and elides past three lines. + omarchy-notification-send -u critical -g  "$(omarchy-i18n firstRun.keybindingsTitle)" \ diff --git a/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch b/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch index 131ac771a..77b11a959 100644 --- a/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch +++ b/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch @@ -3,13 +3,17 @@ # unlocks. The session lock hides every other surface, on-screen keyboards # included, so a phone needs its own digits; a PIN is a numeric password. # -# Against Omarchy 4.0.4 (the edge channel's aarch64 omarchy 4.0.4-2, the same -# files as tag v4.0.4) with 0000 (Commons.Color) applied. 4.0.4 has no -# "Fingerprint reader unavailable" notice, so the hunk that moved it above -# the field is gone and the hint shows whenever fingerprints are set up. -diff --git i/shell/plugins/lock/Keypad.qml w/shell/plugins/lock/Keypad.qml -new file mode 100644 -index 0000000..98ad1ad +# Omarchy 4.5 port (from the 4.0.6 series): same pad, toggle, layout and +# 10 s blank as before. 4.5 changed the lock under it, and the port follows: +# the placeholder is the i18n catalog's "Enter Password" unless the pad is +# shown ("Enter PIN" stays English, as the series' strings always were: the +# catalogs ship outside the patched package); 4.5's held-key guard +# (dropsAutoRepeat) also covers keys typed into the pad; 4.5's focus restore +# after a VT switch gives focus back to the pad's keys, not the field; the +# idle blank timer's 4.5 idleMs carries the 10 s. 4.5's "Fingerprint reader +# unavailable" notice moves above the field with the pad (below it is the +# pad) and replaces the "either unlocks" hint while it shows. + --- /dev/null +++ w/shell/plugins/lock/Keypad.qml @@ -0,0 +1,73 @@ @@ -86,14 +90,14 @@ index 0000000..98ad1ad + } + } +} -diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml -index 3c5f65d..53eef73 100644 --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -17,8 +17,16 @@ Item { +@@ -19,8 +19,18 @@ property bool loadBackground: true property string passwordText: "" property bool syncingPasswordText: false +- +- readonly property string placeholderText: Commons.I18n.t("lock.enterPassword") + // Touch-only devices: a number pad under the field (the lock-keypad toggle). + property bool keypad: false + // A phone with a fingerprint sensor under the display has it in the lower @@ -102,14 +106,15 @@ index 3c5f65d..53eef73 100644 + // third clear, and a hint above the field says either works, as on Android. + readonly property bool keypadClearsSensor: keypad && fingerprintConfigured + readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) - -- readonly property string placeholderText: "Enter Password" -+ readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" ++ // Whichever line sits above the field with the number pad, for its room. ++ readonly property Item keypadLineAbove: keypadHint.visible || !unavailableNotice.visible ? keypadHint : unavailableNotice ++ ++ readonly property string placeholderText: keypad ? "Enter PIN" : Commons.I18n.t("lock.enterPassword") readonly property int fieldWidth: 381 readonly property int fieldHeight: 67 readonly property int outlineThickness: 3 -@@ -54,7 +62,8 @@ Item { - } +@@ -50,7 +60,8 @@ + signal wakeRequested() function forcePasswordFocus() { - passwordInput.forceActiveFocus() @@ -118,7 +123,18 @@ index 3c5f65d..53eef73 100644 } function clearPassword() { -@@ -115,16 +124,58 @@ Item { +@@ -75,7 +86,9 @@ + // The field loses focus while a password is checked (it is disabled then), + // and forcing focus onto it would not stick until the check ends. + function restorePasswordFocus() { +- if (inputEnabled && passwordInput.enabled && !passwordInput.activeFocus) forcePasswordFocus() ++ if (!inputEnabled || !passwordInput.enabled) return ++ // With the number pad the keys hold focus, not the field. ++ if (keypad ? !keypadKeys.activeFocus : !passwordInput.activeFocus) forcePasswordFocus() + } + + onPasswordTextChanged: syncPasswordText() +@@ -134,16 +147,64 @@ MouseArea { anchors.fill: parent @@ -126,12 +142,18 @@ index 3c5f65d..53eef73 100644 + hoverEnabled: !root.keypad onClicked: { root.wakeRequested(); root.forcePasswordFocus() } onPositionChanged: root.wakeRequested() - } - ++ } ++ + Item { + id: keypadKeys + Keys.onPressed: function(event) { + if (!numberPad.enabled) return ++ root.wakeRequested() ++ // As in the field: a held key types nothing (Omarchy 4.5's guard). ++ if (event.isAutoRepeat && root.dropsAutoRepeat(event.key)) { ++ event.accepted = true ++ return ++ } + if (event.text.length === 1 && event.text >= "0" && event.text <= "9") numberPad.digit(event.text) + else if (event.key === Qt.Key_Backspace) numberPad.backspace() + else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) numberPad.enter() @@ -148,9 +170,9 @@ index 3c5f65d..53eef73 100644 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: root.keypadBottomMargin -+ // what is left above it for the field, the hint and a margin ++ // what is left above it for the field, the line over it and a margin + maxHeight: parent.height - root.keypadBottomMargin - root.fieldHeight - Style.space(40) -+ - (root.keypadClearsSensor ? keypadHint.height + Style.space(18) : 0) - Style.space(48) ++ - (root.keypadLineAbove.visible ? root.keypadLineAbove.height + Style.space(18) : 0) - Style.space(48) + onDigit: function(value) { + root.wakeRequested() + if (root.failureMessage.length > 0) root.clearFailureRequested() @@ -165,8 +187,8 @@ index 3c5f65d..53eef73 100644 + root.passwordTextEdited("") + if (submitted.length > 0) root.submitPassword(submitted) + } -+ } -+ + } + BorderSurface { id: inputField width: root.fieldWidth @@ -179,7 +201,7 @@ index 3c5f65d..53eef73 100644 color: Commons.Color.lock.background borderSpec: root.inputBorderSpec radius: Style.cornerRadius -@@ -141,7 +192,7 @@ Item { +@@ -160,7 +221,7 @@ anchors.leftMargin: inputField.borderLeft + 18 + root.fingerprintReserve verticalAlignment: TextInput.AlignVCenter horizontalAlignment: TextInput.AlignHCenter @@ -188,12 +210,34 @@ index 3c5f65d..53eef73 100644 clip: true enabled: root.inputEnabled && !root.authenticatingPassword readOnly: root.authenticatingPassword -@@ -216,5 +267,23 @@ Item { - verticalAlignment: Text.AlignVCenter - } +@@ -246,11 +307,18 @@ + // The crossed-out icon has no meaning to a user who has never seen it — it + // is not intuitive that it signals a broken reader — so the words carry the + // explanation and the icon only reinforces it. ++ // With the number pad, the space under the field is the pad's, so the ++ // notice goes above the field, where the hint below would otherwise be. + Text { ++ id: unavailableNotice + objectName: "fingerprintUnavailableNotice" + textFormat: Text.PlainText +- anchors.top: inputField.bottom +- anchors.topMargin: 18 ++ anchors.top: root.keypad ? undefined : inputField.bottom ++ anchors.topMargin: root.keypad ? 0 : 18 ++ anchors.bottom: root.keypad ? inputField.top : undefined ++ anchors.bottomMargin: root.keypad ? Style.space(18) : 0 ++ width: parent.width - Style.space(32) ++ wrapMode: root.keypad ? Text.WordWrap : Text.NoWrap + anchors.horizontalCenter: inputField.horizontalCenter + visible: root.fingerprintConfigured && root.fingerprintUnavailable + text: Commons.I18n.t("lock.fingerprintUnavailable") +@@ -260,5 +328,24 @@ + font.italic: true + horizontalAlignment: Text.AlignHCenter } + -+ // Touch-only devices with fingerprints: say that either unlocks. ++ // Touch-only devices with fingerprints: say that either unlocks. Not ++ // while the reader is unavailable: the notice above says so instead. + Text { + id: keypadHint + objectName: "keypadFingerprintHint" @@ -202,7 +246,7 @@ index 3c5f65d..53eef73 100644 + anchors.bottomMargin: Style.space(18) + anchors.horizontalCenter: inputField.horizontalCenter + width: parent.width - Style.space(32) -+ visible: root.keypadClearsSensor ++ visible: root.keypadClearsSensor && !root.fingerprintUnavailable + text: "Touch the fingerprint sensor or enter your PIN" + color: Commons.Color.lock.text + font.family: Style.font.family @@ -212,19 +256,17 @@ index 3c5f65d..53eef73 100644 + } } } -diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml -index 65fcb19..95726eb 100644 --- i/shell/plugins/lock/Service.qml +++ w/shell/plugins/lock/Service.qml -@@ -23,6 +23,7 @@ Item { +@@ -24,6 +24,7 @@ property bool fingerprintAuthenticating: false property bool passwordPamConfigured: false property bool fingerprintConfigured: false + property bool keypad: false - property bool previewVisible: false - property string enteredPassword: "" - property string pendingPassword: "" -@@ -127,6 +128,7 @@ Item { + property int fingerprintUnreachedStreak: 0 + property bool fingerprintAttemptReachedDevice: false + property bool fingerprintAttemptFastError: false +@@ -215,6 +216,7 @@ } function beginLock() { @@ -232,36 +274,38 @@ index 65fcb19..95726eb 100644 if (!passwordPamConfigured) { logEvent("lock-denied: missing-pam") return false -@@ -267,6 +269,7 @@ Item { - color: Commons.Color.background +@@ -507,6 +509,7 @@ LockView { -+ keypad: root.keypad id: lockView ++ keypad: root.keypad anchors.fill: parent backgroundPath: root.backgroundPath -@@ -298,6 +301,7 @@ Item { + videoPosterPath: root.videoPosterPath +@@ -543,6 +546,7 @@ exclusionMode: ExclusionMode.Ignore LockView { + keypad: root.keypad anchors.fill: parent backgroundPath: root.backgroundPath - backgroundVersion: root.backgroundVersion -@@ -414,7 +418,8 @@ Item { + videoPosterPath: root.videoPosterPath +@@ -766,7 +770,8 @@ Timer { id: idleBlankTimer -- interval: 5000 +- readonly property int idleMs: 5000 + // Touch-only devices (the number pad) get longer to find and use it. -+ interval: root.keypad ? 10000 : 5000 - repeat: false - property double armedAt: 0 - onTriggered: { -@@ -482,6 +487,17 @@ Item { ++ readonly property int idleMs: root.keypad ? 10000 : 5000 + // A resume reaches this as soon as the kernel thaws, seconds before the + // panel lights (on NVIDIA it waits out a VT switch and a modeset), so the + // idle run-up blanked the lock just as it appeared. +@@ -843,6 +848,17 @@ + if (!lockRequested) return + if (authenticatingPassword) idleBlankTimer.stop() else armBlankTimer() - } - ++ } ++ + // Touch-only devices opt into the number pad: omarchy-toggle lock-keypad. + FileView { + id: keypadToggle @@ -271,8 +315,6 @@ index 65fcb19..95726eb 100644 + onLoaded: root.keypad = true + onLoadFailed: root.keypad = false + onFileChanged: reload() -+ } -+ + } + FileView { - path: "/etc/pam.d/omarchy-lock-password" - watchChanges: true diff --git a/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch b/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch index 7deb48d2b..8f76441ed 100644 --- a/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch +++ b/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch @@ -2,30 +2,35 @@ # to a narrow screen, and hold the desktop for the Style menu (there is no # right button or keyboard shortcut on a phone). # -# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4) with 0000 (Commons.Color) -# applied: only the context of the picker's size properties differs from -# upstream main. +# Omarchy 4.5 port: 4.5 renamed the menu's "style" route to "appearance" +# ("style" stays an alias), so the hold summons "appearance" by its id. The +# swipe follows 4.5's right-to-left reading (Util.readingKey flips the arrow +# keys; the swipe flips the same way) and waits for the picker's reveal +# (layoutSettled), as 4.5's keys do. 4.5's hold-to-preview (PreviewHold) is +# a separate handler and untouched. + diff --git i/shell/plugins/background/Background.qml w/shell/plugins/background/Background.qml -index 0a53b20..546aaaf 100644 --- i/shell/plugins/background/Background.qml +++ w/shell/plugins/background/Background.qml -@@ -105,6 +105,15 @@ Item { +@@ -218,6 +218,17 @@ if (!bgSwitchProc.running) bgSwitchProc.running = true } ++ // Touch screens: hold the desktop for the Appearance menu (4.0's "style" ++ // route; a phone has no right button or keyboard shortcut). + function openStyleMenu() { + if (!styleMenuProc.running) styleMenuProc.running = true + } + + Process { + id: styleMenuProc -+ command: ["omarchy-menu", "summon", "style"] ++ command: ["omarchy-menu", "summon", "appearance"] + } + function openThemeSwitcher() { - if (!themeSwitchProc.running) themeSwitchProc.running = true - } -@@ -313,6 +322,10 @@ Item { + var payload = JSON.stringify({ source: "themes" }) + +@@ -521,6 +532,10 @@ MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton @@ -37,11 +42,10 @@ index 0a53b20..546aaaf 100644 if (mouse.button === Qt.RightButton) root.openThemeSwitcher() else root.openSelector() diff --git i/shell/plugins/image-picker/ImagePicker.qml w/shell/plugins/image-picker/ImagePicker.qml -index b0554f5..0f735f6 100644 --- i/shell/plugins/image-picker/ImagePicker.qml +++ w/shell/plugins/image-picker/ImagePicker.qml -@@ -39,10 +39,11 @@ Item { - property color scrim: Commons.Color.imagePicker.scrim +@@ -55,10 +55,11 @@ + property color foreground: Commons.Color.imagePicker.text property color selectedBorder: Commons.Color.imagePicker.selectedBorder property color unselectedBorder: Commons.Color.imagePicker.unselectedBorder - property int expandedWidth: 768 @@ -55,22 +59,29 @@ index b0554f5..0f735f6 100644 property int sliceSpacing: -30 property int skewOffset: 28 property int bottomChromeHeight: showLabels ? (filterable ? 104 : 74) : (filterable ? 60 : 30) -@@ -435,6 +436,18 @@ Item { +@@ -728,6 +729,25 @@ Component.onCompleted: forceActiveFocus() -+ // Swipe left or right to move through the images on touch screens. ++ // Swipe to move through the images on touch screens: toward the ++ // reading start for the next one, as the arrow keys read. + DragHandler { + target: null + yAxis.enabled: false ++ enabled: root.layoutSettled + property real swipeX: 0 + onActiveTranslationChanged: swipeX = activeTranslation.x + onActiveChanged: { -+ if (active) swipeX = 0 -+ else if (Math.abs(swipeX) > 40) root.selectAdjacent(swipeX < 0 ? 1 : -1) ++ if (active) { ++ swipeX = 0 ++ } else if (Math.abs(swipeX) > 40) { ++ var next = swipeX < 0 ++ if (Commons.I18n.rightToLeft) next = !next ++ root.selectAdjacent(next ? 1 : -1) ++ } + } + } + Repeater { - model: root.imageArray.length - + id: imageCards + model: visibleImages diff --git a/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch b/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch index 6183995da..296188e42 100644 --- a/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch +++ b/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch @@ -12,11 +12,16 @@ # marker gone (TOUCH-PLAN 0.5) is what this closes; omamobile-shell's # omamobile-osk-guard is the safety net behind it. # -# Against Omarchy 4.0.6 (stable 4.0.6-1). +# Omarchy 4.5 port: rebased. 4.5 starts each screensaver on a special +# workspace per monitor, hands focus back once they are gone, and turns +# terminal echo off (stty -echo) after setting the black background; the +# mouse-reporting line now follows that. Nothing of the phone's behaviour +# changed. + diff --git i/bin/omarchy-launch-screensaver w/bin/omarchy-launch-screensaver --- i/bin/omarchy-launch-screensaver +++ w/bin/omarchy-launch-screensaver -@@ -15,6 +15,32 @@ +@@ -11,6 +11,32 @@ fi focused=$(omarchy-hyprland-monitor-focused) @@ -49,7 +54,7 @@ diff --git i/bin/omarchy-launch-screensaver w/bin/omarchy-launch-screensaver terminal=$(xdg-terminal-exec --print-id) case $terminal in -@@ -64,7 +90,10 @@ +@@ -63,7 +89,10 @@ hypr_exec ghostty --class=org.omarchy.screensaver --config-file="$OMARCHY_PATH/default/ghostty/screensaver" --font-size=18 -e omarchy-screensaver ;; *foot*) @@ -100,17 +105,17 @@ diff --git i/bin/omarchy-screensaver w/bin/omarchy-screensaver pkill -x ttfx 2>/dev/null pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null exit 0 -@@ -17,6 +43,9 @@ - trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT +@@ -18,6 +44,9 @@ printf '\033]11;rgb:00/00/00\007' # Set background color to black + stty -echo 2>/dev/null # Don't echo the key that stops the screensaver into the corner +# Report mouse clicks (and touches) as input, so a tap ends the screensaver +# like a key press does. Turned back off on exit. +printf '\033[?1000h' hyprctl eval 'hl.config({ cursor = { invisible = true } })' &>/dev/null || hyprctl keyword cursor:invisible true &>/dev/null -@@ -33,6 +62,17 @@ +@@ -34,6 +63,17 @@ done } @@ -128,7 +133,7 @@ diff --git i/bin/omarchy-screensaver w/bin/omarchy-screensaver wait_for_terminal_resize while true; do -@@ -41,7 +81,26 @@ +@@ -42,7 +82,26 @@ --random-effect --no-eol --no-restore-cursor & while pgrep -t "${tty#/dev/}" -x ttfx >/dev/null; do diff --git a/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch b/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch index 4afb85828..3d383a5db 100644 --- a/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch +++ b/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch @@ -1,11 +1,14 @@ # Lock as soon as the user returns to the screensaver (lock-after-screensaver). # Refreshed against Omarchy 4.0.6 (edge 4.0.6-1) so it applies without fuzz; # the hunk lands where the fuzzed one did, before the main idle monitor. +# +# Omarchy 4.5: rebased (one line of offset); 4.5's idle service keeps +# runProcess, lockProcess, screensaverWindowCount and logEvent as used here. + diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml -index 8fb45a6..d694ab9 100644 --- i/shell/plugins/services/idle/Service.qml +++ w/shell/plugins/services/idle/Service.qml -@@ -266,6 +266,32 @@ Item { +@@ -267,6 +267,32 @@ // With both timeouts at 0 the monitor stops reporting, so nothing else would end a running cycle. onIdleTimersEnabledChanged: if (!idleTimersEnabled) cancelIdleCycle("idle-timers-disabled") diff --git a/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch b/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch index 922444404..f14b05dfd 100644 --- a/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch +++ b/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch @@ -4,11 +4,14 @@ # bl_power (the device package's udev rule). # # Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5: unchanged; 4.5 added Apple and DDC display paths after +# this point, and the off/on steps it hooks are as before. + diff --git i/bin/omarchy-brightness-display w/bin/omarchy-brightness-display -index 5a3e534..3c754bb 100755 --- i/bin/omarchy-brightness-display +++ w/bin/omarchy-brightness-display -@@ -82,12 +82,26 @@ if (( $# == 0 )); then +@@ -82,12 +82,26 @@ exit fi diff --git a/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch b/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch index 1cc9b0d69..1eaf5b35a 100644 --- a/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch +++ b/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch @@ -3,11 +3,16 @@ # phone's power button, through omamobile-keys). # # Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5: rebased. The lock's IPC target (ShellIpc "lock") is +# unchanged in 4.5. 4.5 keeps authentication services out of the shell's +# service map (AuthServiceStore), so other code reaches the lock only over +# this IPC, never as an object: this call is the supported way in. + diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml -index ccd496a..113b40d 100644 --- i/shell/plugins/lock/Service.qml +++ w/shell/plugins/lock/Service.qml -@@ -848,6 +848,14 @@ Item { +@@ -899,6 +899,14 @@ return "ok" } diff --git a/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch b/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch index 419dc7856..621a64e8e 100644 --- a/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch +++ b/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch @@ -4,11 +4,18 @@ # wrong password so the keyboard shows again (FINGERPRINT-PLAN.md). # # Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5: rebased (offsets only). 4.5 made polkit an authentication +# service the shell keeps out of its service map (AuthServiceStore); this +# patch changes only the prompt's layer surface and focus, nothing of how +# the agent is loaded or reached. Top rather than Overlay remains the trade +# it was on 4.0: an overlay-layer surface can cover the prompt; the phone +# needs the on-screen keyboard above it. + diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml -index acd6514c..e98356dd 100644 --- i/shell/plugins/polkit/PolkitAgent.qml +++ w/shell/plugins/polkit/PolkitAgent.qml -@@ -103,8 +103,16 @@ Item { +@@ -103,8 +103,16 @@ if (!dialogVisible) return // In fingerprint mode there is no field to type into — park focus on the // key catcher so Escape still cancels; otherwise focus the password field. @@ -27,7 +34,7 @@ index acd6514c..e98356dd 100644 } function submitResponse() { -@@ -149,7 +157,11 @@ Item { +@@ -149,7 +157,11 @@ id: errorTimer interval: 1200 repeat: false @@ -40,7 +47,7 @@ index acd6514c..e98356dd 100644 } SequentialAnimation { -@@ -225,9 +237,17 @@ Item { +@@ -229,9 +241,17 @@ anchors { top: true; bottom: true; left: true; right: true } color: "transparent" WlrLayershell.namespace: "omarchy-polkit" diff --git a/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch b/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch index acf09eb32..67a6db126 100644 --- a/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch +++ b/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch @@ -6,11 +6,15 @@ # its focus or the PIN. The polkit prompt asks squeekboard for its digit # layout for a PIN, with a 123/ABC switch, and a tap refocuses the field. # -# Against Omarchy 4.0.6 (edge 4.0.6-1), which has 0000's Commons.Color fix: -# with the series, LockView.qml is byte for byte the phone's tested file -# (4c72b5be..., F16b). +# Omarchy 4.5 port (on the 4.5 ports of 0003 and 0010): the same behaviour. +# 4.5's focus restore after a VT switch follows the input shown (the pad's +# keys or the field); the "Enter PIN" placeholders sit beside 4.5's i18n +# ones, which a password keeps ("Enter PIN" stays English, as the series' +# strings were); the polkit toggles' FileViews follow 4.5's Style.duration +# shake. The polkit agent is a 4.5 authentication service; nothing here +# changes how it is loaded or reached. + diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml -index 53eef73..1f1b3b0 100644 --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml @@ -1,5 +1,7 @@ @@ -21,7 +25,7 @@ index 53eef73..1f1b3b0 100644 import qs.Commons import qs.Commons as Commons import qs.Ui -@@ -24,9 +26,18 @@ Item { +@@ -26,11 +28,20 @@ // sensor pressed a key. With fingerprints set up, the pad keeps the lower // third clear, and a hint above the field says either works, as on Android. readonly property bool keypadClearsSensor: keypad && fingerprintConfigured @@ -35,14 +39,16 @@ index 53eef73..1f1b3b0 100644 + readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 + readonly property real fieldSideReserve: Math.max(fingerprintReserve, inputSwitchReserve) readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) + // Whichever line sits above the field with the number pad, for its room. + readonly property Item keypadLineAbove: keypadHint.visible || !unavailableNotice.visible ? keypadHint : unavailableNotice -- readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" -+ readonly property string placeholderText: padShown ? "Enter PIN" : "Enter Password" +- readonly property string placeholderText: keypad ? "Enter PIN" : Commons.I18n.t("lock.enterPassword") ++ readonly property string placeholderText: padShown ? "Enter PIN" : Commons.I18n.t("lock.enterPassword") readonly property int fieldWidth: 381 readonly property int fieldHeight: 67 readonly property int outlineThickness: 3 -@@ -62,8 +73,53 @@ Item { - } +@@ -60,8 +71,53 @@ + signal wakeRequested() function forcePasswordFocus() { - if (keypad) keypadKeys.forceActiveFocus() @@ -97,7 +103,16 @@ index 53eef73..1f1b3b0 100644 } function clearPassword() { -@@ -144,7 +200,7 @@ Item { +@@ -88,7 +144,7 @@ + function restorePasswordFocus() { + if (!inputEnabled || !passwordInput.enabled) return + // With the number pad the keys hold focus, not the field. +- if (keypad ? !keypadKeys.activeFocus : !passwordInput.activeFocus) forcePasswordFocus() ++ if (padShown ? !keypadKeys.activeFocus : !passwordInput.activeFocus) forcePasswordFocus() + } + + onPasswordTextChanged: syncPasswordText() +@@ -173,7 +229,7 @@ Keypad { id: numberPad @@ -106,7 +121,7 @@ index 53eef73..1f1b3b0 100644 enabled: root.inputEnabled && !root.authenticatingPassword anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom -@@ -173,9 +229,14 @@ Item { +@@ -202,9 +258,14 @@ width: root.fieldWidth height: root.fieldHeight anchors.horizontalCenter: parent.horizontalCenter @@ -124,7 +139,7 @@ index 53eef73..1f1b3b0 100644 color: Commons.Color.lock.background borderSpec: root.inputBorderSpec radius: Style.cornerRadius -@@ -187,12 +248,12 @@ Item { +@@ -216,12 +277,12 @@ anchors.topMargin: inputField.borderTop // Reserve the fingerprint icon's width on both sides so the centered // dots stay symmetric and never slide under the icon as they grow. @@ -140,7 +155,7 @@ index 53eef73..1f1b3b0 100644 clip: true enabled: root.inputEnabled && !root.authenticatingPassword readOnly: root.authenticatingPassword -@@ -249,6 +310,33 @@ Item { +@@ -282,6 +343,33 @@ elide: Text.ElideRight } @@ -174,10 +189,10 @@ index 53eef73..1f1b3b0 100644 // Fingerprint hint pinned inside the field's right edge when a sensor is // enrolled, so the user knows they can touch to unlock instead of typing. // Matches hyprlock, which draws its fingerprint icon in the same spot. -@@ -278,7 +366,8 @@ Item { +@@ -340,7 +428,8 @@ anchors.horizontalCenter: inputField.horizontalCenter width: parent.width - Style.space(32) - visible: root.keypadClearsSensor + visible: root.keypadClearsSensor && !root.fingerprintUnavailable - text: "Touch the fingerprint sensor or enter your PIN" + text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" + : "Touch the fingerprint sensor or enter your password" @@ -185,10 +200,9 @@ index 53eef73..1f1b3b0 100644 font.family: Style.font.family font.pixelSize: Style.font.subtitle diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml -index 82c2848..36dc118 100644 --- i/shell/plugins/polkit/PolkitAgent.qml +++ w/shell/plugins/polkit/PolkitAgent.qml -@@ -39,6 +39,16 @@ Item { +@@ -39,6 +39,16 @@ // to the password even when a sensor is enrolled. Refreshed per request. property bool laptopClosed: false property int shakeOffset: 0 @@ -205,7 +219,7 @@ index 82c2848..36dc118 100644 readonly property bool dialogVisible: polkitAgent.isActive || closing // We show one method at a time. Fingerprint owns the dialog while PAM is -@@ -93,6 +103,7 @@ Item { +@@ -93,6 +103,7 @@ closeTimer.stop() closing = false submitted = false @@ -213,11 +227,10 @@ index 82c2848..36dc118 100644 passwordInput.text = "" refreshLidState() syncFromFlow() -@@ -170,6 +181,24 @@ Item { - NumberAnimation { target: root; property: "shakeOffset"; to: 8; duration: 50; easing.type: Easing.InOutQuad } - NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: 55; easing.type: Easing.OutQuad } +@@ -171,6 +182,24 @@ + NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: Style.duration(55); easing.type: Easing.OutQuad } } -+ FileView { + FileView { + path: root.togglesDir + "/lock-keypad" + watchChanges: true + printErrors: false @@ -235,10 +248,11 @@ index 82c2848..36dc118 100644 + onFileChanged: reload() + } + - FileView { ++ FileView { path: "/etc/pam.d/polkit-1" watchChanges: true -@@ -324,7 +353,7 @@ Item { + printErrors: false +@@ -328,7 +357,7 @@ } Item { @@ -247,7 +261,7 @@ index 82c2848..36dc118 100644 height: root.fieldHeight TextInput { -@@ -333,6 +362,8 @@ Item { +@@ -337,6 +366,8 @@ verticalAlignment: TextInput.AlignVCenter activeFocusOnPress: true clip: true @@ -256,16 +270,16 @@ index 82c2848..36dc118 100644 selectionColor: Util.alpha(root.accent, 0.45) selectedTextColor: root.foreground font.family: root.fontFamily -@@ -357,7 +388,7 @@ Item { +@@ -361,7 +392,7 @@ anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter -- text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : "Enter password") -+ text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : (root.digitsInput ? "Enter PIN" : "Enter password")) +- text: root.errorFlash ? I18n.t("polkit.wrong") : (root.submitted ? I18n.t("polkit.checking") : I18n.t("polkit.enterPassword")) ++ text: root.errorFlash ? I18n.t("polkit.wrong") : (root.submitted ? I18n.t("polkit.checking") : (root.digitsInput ? "Enter PIN" : I18n.t("polkit.enterPassword"))) color: root.errorFlash ? Commons.Color.polkit.textError : root.foreground opacity: root.errorFlash ? 1 : 0.36 font.family: root.fontFamily -@@ -379,7 +410,36 @@ Item { +@@ -383,7 +414,36 @@ anchors.fill: parent acceptedButtons: Qt.LeftButton enabled: passwordInput.visible diff --git a/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch b/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch index 889da8840..31e8e0870 100644 --- a/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch +++ b/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch @@ -9,11 +9,22 @@ # Omarchy's update runs unwrapped, as before. Escape hatch: # OMAMOBILE_UPDATE=1 omarchy-update. # -# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5 port: the handoff is unchanged and still the first thing the +# script does, before 4.5's transcript (script), its update lock and its +# sudo keep-alive. 4.5 split the restart step into --services-only (found +# on PATH, so the phone's stand-in runs it) and a final --reboot-only run +# by its absolute path in $OMARCHY_PATH/bin, which would skip the stand-in +# and decide "kernel updated" from vmlinuz/modules ownership, wrong for a +# phone booting slot B. Under OMAMOBILE_UPDATE only, that last call goes +# through PATH too; a desktop runs it exactly as before. 4.5's new boot +# verification (omarchy-update-boot) is a stand-in on the phone as well +# (packages/omamobile-omarchy lib/update-bin). + diff --git i/bin/omarchy-update w/bin/omarchy-update --- i/bin/omarchy-update +++ w/bin/omarchy-update -@@ -7,6 +7,14 @@ +@@ -8,6 +8,14 @@ set -e @@ -25,6 +36,21 @@ diff --git i/bin/omarchy-update w/bin/omarchy-update + exec /usr/bin/omamobile-update "$@" +fi + - if [[ -z ${OMARCHY_UPDATE_LOGGED:-} ]]; then - script_command=$(printf '%q ' "$0" "$@") - exec env OMARCHY_UPDATE_LOGGED=1 script -qefc "$script_command" "/tmp/omarchy-update.log" + update_stay_awake_stopped=0 + sudo_keepalive_pid="" + +@@ -147,7 +155,13 @@ + fi + + if (( boot_verified )); then +- "$OMARCHY_PATH/bin/omarchy-update-restart" --reboot-only ++ # Omarchy Mobile: under omamobile-update the phone's stand-in on PATH ++ # decides about a restart (slot B, not a vmlinuz), and asks nothing. ++ if [[ -n ${OMAMOBILE_UPDATE:-} ]]; then ++ omarchy-update-restart --reboot-only ++ else ++ "$OMARCHY_PATH/bin/omarchy-update-restart" --reboot-only ++ fi + else + echo -e "\e[31m\nThe update is not finished: its boot files did not pass verification (see above). Do not reboot until omarchy update completes.\e[0m" >&2 + exit 1 diff --git a/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch b/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch index 0fe310e1f..e244a411e 100644 --- a/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch +++ b/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch @@ -4,10 +4,16 @@ # next unlock: a day of a lit screen on the phone. # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0007. +# +# Omarchy 4.5: rebased (offsets only). It reaches the lock over its IPC +# target (omarchy-shell lock wake): 4.5 keeps the lock out of the shell's +# service map, so IPC is the way in; the fallback to omarchy-system-wake +# stays for no lock or no answer. + diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml --- i/shell/plugins/services/idle/Service.qml +++ w/shell/plugins/services/idle/Service.qml -@@ -119,7 +119,9 @@ +@@ -120,7 +120,9 @@ lockTimer.stop() screensaverLaunchGraceTimer.stop() diff --git a/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch b/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch index 1e715673d..d0f94c708 100644 --- a/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch +++ b/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch @@ -5,11 +5,15 @@ # carrier (TELEPHONY-APPS-PLAN §3.3) that is the warning that it doesn't # work yet, never a dialpad. The lock stays as it is. # -# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0011. +# Omarchy 4.5 port: the same button, after the 4.5 ports of 0003 and 0011. +# 4.5's "shell call" IPC (shell.qml callIfLoaded) still reaches a loaded +# panel plugin by id, so the call is unchanged; it does nothing when +# omamobile.call is not loaded, as before. + diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -374,5 +374,42 @@ +@@ -436,5 +436,42 @@ wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter } diff --git a/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch b/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch index 89ec9a5f9..156108e09 100644 --- a/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch +++ b/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Notifications: inline reply (the freedesktop `inline-reply` action and # NotificationReplied signal, which Quickshell implements). The server # advertises it, and a toast whose sender asked for it gets a Reply button @@ -9,224 +10,180 @@ # app (TELEPHONY-APPS-PLAN §7.2). # # Against Omarchy 4.0.6 (edge 4.0.6-1). -diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +# +# Omarchy 4.5: Port inline reply to the keyed live references and Toast scene. Keep the +# store, deck and markup limits; a failed send preserves the draft. + --- i/shell/plugins/notifications/Service.qml +++ w/shell/plugins/notifications/Service.qml -@@ -314,6 +314,52 @@ Item { - removePopup(index, "dismiss") +@@ -816,6 +816,7 @@ + } + + function finishClose(key, reason) { ++ if (replyKey === key) replyKey = "" + unmarkLeaving(key) + var at = rowIndexFor(key) + if (!liveKeys[key]) return +@@ -905,6 +906,35 @@ + return out } -+ // The live notification behind a popup row, or null. A restored row has -+ // none (see removePopup). -+ function liveRefAt(index) { -+ if (index < 0 || index >= popupModel.count) return null -+ var entry = popupModel.get(index) -+ if (!entry || entry.originalId < 0 || isRestoredRow(entry)) return null -+ var ref = liveRefs[entry.originalId] ++ // Only a live sender may receive an inline reply; restored rows have none. ++ property string replyKey: "" ++ function replyPlaceholder(key, revision) { ++ if (leaving[key]) return "" ++ var ref = refs[key] + try { -+ return ref && ref.tracked ? ref : null -+ } catch (e) { -+ return null -+ } ++ return ref && ref.tracked && ref.hasInlineReply ++ ? Security.bounded(String(ref.inlineReplyPlaceholder || "Reply"), 160) : "" ++ } catch (e) { return "" } + } -+ -+ // The reply field's placeholder for a popup whose sender asked for an -+ // inline reply, or "" when it can't take one. -+ function replyPlaceholderAt(index) { -+ var ref = liveRefAt(index) -+ if (!ref || !ref.hasInlineReply) return "" -+ return String(ref.inlineReplyPlaceholder || "") || "Reply" ++ function beginReply(key) { ++ if (!replyPlaceholder(key, refsRevision)) return false ++ stopKeyboard() ++ replyKey = key ++ return true + } -+ -+ // Popups with the reply field open. While any is, the popup surface takes -+ // keyboard focus so the field can be typed into. -+ property int openReplies: 0 -+ -+ // Send the reply to its sender (NotificationReplied), then take the toast -+ // off the screen. A sender that has meanwhile closed the notification -+ // gets nothing; the popup opens its app instead, so the reply isn't lost -+ // silently. -+ function sendReply(index, text) { -+ var ref = liveRefAt(index) -+ if (!ref || !ref.hasInlineReply) { -+ invokePopupDefault(index) -+ return -+ } ++ function sendReply(key, text) { ++ if (leaving[key] || !liveKeys[key]) return false ++ if (typeof text !== "string" || !text.trim() || text.length > 4096) return false ++ var ref = refs[key] + try { ++ if (!ref || !ref.tracked || !ref.hasInlineReply) return false + ref.sendInlineReply(text) -+ } catch (e) { -+ console.warn("inline reply failed:", e) -+ invokePopupDefault(index) -+ return -+ } -+ dismissPopup(index) ++ } catch (e) { return false } ++ replyKey = "" ++ closeToast(key, "dismissed") ++ return true + } + - function expirePopup(index) { - removePopup(index, "expire") - } -@@ -936,6 +982,7 @@ Item { + function invokeAction(key, identifier) { + if (typeof identifier !== "string" || identifier.length > Security.MAX_ACTION_ID) return + invokeSenderAction(key, identifier) +@@ -1358,6 +1388,7 @@ bodyMarkupSupported: true bodyHyperlinksSupported: true persistenceSupported: true + inlineReplySupported: true - onNotification: function(notification) { - service.handleNotification(notification) -@@ -960,7 +1007,9 @@ Item { - + onNotification: function(notification) { service.handleNotification(notification) } + } +@@ -1515,7 +1546,8 @@ WlrLayershell.namespace: "omarchy-notifications" WlrLayershell.layer: WlrLayer.Overlay -- WlrLayershell.keyboardFocus: WlrKeyboardFocus.None -+ // Passive, except while a reply field is open (OnDemand, as the -+ // polkit prompt uses, so an on-screen keyboard can type into it). -+ WlrLayershell.keyboardFocus: service.openReplies > 0 ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + readonly property bool takesKeyboard: service.keyboardMode && service.targetDisplayName === String(modelData.name) +- WlrLayershell.keyboardFocus: takesKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None ++ WlrLayershell.keyboardFocus: service.replyKey && showingNotifications ? WlrKeyboardFocus.OnDemand ++ : (takesKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None) exclusionMode: ExclusionMode.Ignore - color: "transparent" -@@ -1012,7 +1061,19 @@ Item { - - readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) - property real remainingLifetime: 1.0 -- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered -+ readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying + // Constant width and full height, so the buffer is allocated once. +@@ -1631,6 +1663,11 @@ + hovered: service.keyboardMode ? service.keyboardKey === model.key : service.hoverKey === model.key + selected: service.keyboardMode && service.keyboardKey === model.key + actions: service.actionsOf(model.key, service.refsRevision) ++ replyPlaceholder: service.replyPlaceholder(model.key, service.refsRevision) ++ replyOpen: service.replyKey === model.key && replyPlaceholder.length > 0 ++ onReplyRequested: service.beginReply(model.key) ++ onReplyCancelled: if (service.replyKey === model.key) service.replyKey = "" ++ onReplySent: function(text) { service.sendReply(model.key, text) } + hoverX: service.hoverX + hoverY: service.hoverY + // A click is the mouse taking over: it ends keyboard mode, which +--- i/shell/plugins/notifications/Toast.qml ++++ w/shell/plugins/notifications/Toast.qml +@@ -26,6 +26,12 @@ + property bool selected: false // the keyboard's card + property double now: Date.now() + property real cardWidth: Style.space(380) ++ property string replyPlaceholder: "" ++ property bool replyOpen: false ++ signal replyRequested() ++ signal replyCancelled() ++ signal replySent(string text) + -+ // Inline reply. The placeholder is looked up again whenever the -+ // row's content changes, as an update can add or drop the action. -+ readonly property string replyPlaceholder: { -+ cardSlot.summary -+ cardSlot.body -+ return service.replyPlaceholderAt(cardSlot.index) -+ } -+ property bool replying: false -+ onReplyingChanged: service.openReplies += replying ? 1 : -1 -+ onReplyPlaceholderChanged: if (replyPlaceholder.length === 0) replying = false -+ Component.onDestruction: if (replying) service.openReplies -= 1 + property var actions: [] // what the sender put on the wire - // A client updating this notification in place rewrites the row - // under the card (see refreshPopup). New text deserves a full look, -@@ -1052,8 +1113,22 @@ Item { - fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" - glyph: cardSlot.glyph + // The pointer in the deck's coordinates: the deck owns hover, so cards and +@@ -151,7 +157,7 @@ + // time, and gets a fresh display period of its own duration. Its picture + // may be new at the same path, so the image is read again too. + property real remaining: Number(row.duration || 0) +- readonly property bool ticking: Number(row.duration || 0) > 0 && !paused ++ readonly property bool ticking: Number(row.duration || 0) > 0 && !paused && !replyOpen + readonly property string arrival: String(row.ts) + ":" + String(row.duration) + property bool reloading: false + onArrivalChanged: { +@@ -200,7 +206,7 @@ -+ replyPlaceholder: cardSlot.replyPlaceholder -+ replying: cardSlot.replying -+ - onCloseRequested: service.dismissPopup(cardSlot.index) - onCardClicked: service.invokePopupDefault(cardSlot.index) -+ onReplyRequested: cardSlot.replying = true -+ onReplyCancelled: { -+ cardSlot.replying = false -+ // A fresh countdown, so the toast doesn't vanish the -+ // moment the field closes. -+ cardSlot.remainingLifetime = 1.0 -+ } -+ onReplySent: function(text) { -+ cardSlot.replying = false -+ service.sendReply(cardSlot.index, text) -+ } - } - } - } -diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml ---- i/shell/plugins/notifications/components/NotificationCard.qml -+++ w/shell/plugins/notifications/components/NotificationCard.qml -@@ -33,8 +33,33 @@ BorderSurface { + // The height this card's *state* implies, a step function the deck lays out + // from. Feeding a mid-animation height back into the layout stalls the stack. +- readonly property real targetHeight: fixedHeight + deedArea.wanted ++ readonly property real targetHeight: fixedHeight + deedArea.wanted + replyArea.wanted - readonly property bool hovered: hoverTracker.hovered + // The height the scene says it is right now, on the way there. + property real drawnHeight: targetHeight +@@ -233,7 +239,7 @@ + Rectangle { + anchors.fill: plate + anchors { leftMargin: plate.borderLeft; rightMargin: plate.borderRight +- topMargin: plate.borderTop; bottomMargin: plate.borderBottom } ++ topMargin: plate.borderTop; bottomMargin: plate.borderBottom + replyArea.wanted } + visible: card.selected + color: Style.hoverFillFor(Commons.Color.notifications.text, Commons.Color.accent) + } +@@ -539,7 +545,7 @@ + // What the state asks for; the drawn height is whatever slack the + // scene has given the card so far. + readonly property real wanted: shown ? barHeight : 0 +- height: Math.max(0, card.drawnHeight - card.fixedHeight) ++ height: Math.max(0, card.drawnHeight - card.fixedHeight - replyArea.wanted) + visible: height > 0 + clip: true -+ // Inline reply (the freedesktop `inline-reply` action): the popup container -+ // sets the sender's placeholder text while the live notification takes a -+ // reply. The history panel leaves it empty: a stored notification can't be -+ // answered. -+ property string replyPlaceholder: "" -+ // The reply field is open. The container keeps the toast on screen and -+ // gives its surface keyboard focus meanwhile. -+ property bool replying: false -+ - signal closeRequested() - signal cardClicked() -+ signal replyRequested() -+ signal replySent(string text) -+ signal replyCancelled() -+ -+ function sendReply() { -+ var text = replyField.text -+ if (text.trim().length === 0) return -+ root.replySent(text) -+ } -+ -+ // A field that opens gets focus, so an on-screen keyboard shows; one that -+ // closes forgets what was typed. -+ onReplyingChanged: { -+ if (replying) Qt.callLater(function() { replyField.forceActiveFocus() }) -+ else replyField.text = "" -+ } - // Prefer per-notification media/avatar data, then fall back to the app icon. - // The `check` flag avoids Qt's missing-texture placeholder for unknown names. - readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) -@@ -82,7 +107,9 @@ BorderSurface { - onClicked: function(mouse) { - if (mouse.button === Qt.RightButton) { - root.closeRequested() -- } else { -+ } else if (!root.replying) { -+ // A tap beside the open reply field must not open the app and -+ // throw the reply away. - root.cardClicked() +@@ -579,6 +585,45 @@ } } -@@ -192,6 +219,53 @@ BorderSurface { - } - } - } -+ -+ // Reply, then a field with Send and Cancel, each tall enough to tap on -+ // a touch screen. -+ RowLayout { -+ id: replyRow -+ readonly property real controlHeight: Style.space(40) -+ Layout.fillWidth: true -+ Layout.leftMargin: Style.space(12) -+ Layout.rightMargin: Style.space(12) -+ Layout.bottomMargin: Style.space(10) -+ visible: root.replyPlaceholder.length > 0 -+ spacing: Style.space(8) -+ + ++ Column { ++ id: replyArea ++ anchors { left: parent.left; right: parent.right; bottom: parent.bottom ++ leftMargin: Style.space(10); rightMargin: Style.space(10) ++ bottomMargin: plate.borderBottom } ++ readonly property real wanted: card.replyPlaceholder && (card.place.front || card.replyOpen) ++ ? (card.replyOpen ? replyField.implicitHeight + replyButtons.implicitHeight + Style.space(12) ++ : replyButton.implicitHeight + Style.space(8)) : 0 ++ height: wanted ++ spacing: Style.space(4) ++ visible: wanted > 0 ++ Button { ++ id: replyButton ++ visible: !card.replyOpen ++ text: "Reply" ++ onClicked: { ++ card.replyRequested() ++ Qt.callLater(function() { if (card.replyOpen) replyField.forceActiveFocus() }) ++ } ++ } + TextField { + id: replyField -+ objectName: "notificationReplyField" -+ Layout.fillWidth: true -+ visible: root.replying -+ Layout.preferredHeight: replyRow.controlHeight -+ placeholderText: root.replyPlaceholder -+ foreground: Commons.Color.notifications.text -+ onAccepted: root.sendReply() -+ Keys.onEscapePressed: root.replyCancelled() -+ } -+ -+ Item { -+ Layout.fillWidth: true -+ visible: !root.replying ++ visible: card.replyOpen ++ width: parent.width ++ placeholderText: card.replyPlaceholder ++ maximumLength: 4096 ++ onAccepted: if (text.trim()) card.replySent(text) ++ Keys.onEscapePressed: card.replyCancelled() + } -+ -+ Button { -+ visible: root.replying -+ text: "Cancel" -+ Layout.preferredHeight: replyRow.controlHeight -+ foreground: Commons.Color.notifications.text -+ onClicked: root.replyCancelled() -+ } -+ -+ Button { -+ objectName: "notificationReplyButton" -+ Layout.preferredHeight: replyRow.controlHeight -+ text: root.replying ? "Send" : "Reply" -+ bordered: true -+ foreground: Commons.Color.notifications.text -+ onClicked: root.replying ? root.sendReply() : root.replyRequested() ++ Row { ++ id: replyButtons ++ visible: card.replyOpen ++ spacing: Style.space(8) ++ Button { text: "Send"; enabled: replyField.text.trim().length > 0 ++ onClicked: card.replySent(replyField.text) } ++ Button { text: "Cancel"; onClicked: card.replyCancelled() } + } + } - } - - } ++ + // Under the content (z: -1) so buttons get their clicks first; anything + // that does not accept a click falls through to here. + MouseArea { diff --git a/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch b/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch index 726b6c144..15b970dfe 100644 --- a/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch +++ b/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Phone only, not for upstream: omarchy-channel-set and omarchy-refresh-pacman # refuse on a phone and point at RELEASES.md section 5.4. Both copy Omarchy's # x86_64 pacman.conf and mirrorlist over the phone's (no [omamobile], no Arch @@ -8,43 +9,39 @@ # this keeps a terminal from doing the same. # # Against Omarchy 4.0.6 (stable 4.0.6-1). +# +# Omarchy 4.5: Guard the platform and channel reset entry points before they can replace +# the phone's repositories. + diff --git i/bin/omarchy-channel-set w/bin/omarchy-channel-set --- i/bin/omarchy-channel-set +++ w/bin/omarchy-channel-set -@@ -6,6 +6,16 @@ - - set -euo pipefail +@@ -1,5 +1,12 @@ + #!/bin/bash -+# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux -+# ARM, which the channel's x86_64 pacman.conf (omarchy-refresh-pacman) drops. ++# A phone's pinned package repository and Arch Linux ARM mirrors are owned ++# by omamobile-update, never the desktop channel/reset commands. +if [[ -x /usr/bin/omamobile-update ]]; then -+ echo "omarchy-channel-set: not on an Omarchy Mobile phone. It would replace this phone's" >&2 -+ echo "pacman.conf with Omarchy's x86_64 one (no [omamobile], no Arch Linux ARM) and upgrade" >&2 -+ echo "everything from it. The phone follows Omarchy's stable channel; update it with" >&2 -+ echo "'omarchy update'. See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ echo "omarchy-channel-set: use 'omarchy update' on Omarchy Mobile; see docs/RELEASES.md 5.4." >&2 + exit 1 +fi + - usage() { echo "Usage: omarchy-channel-set [stable|rc|edge|dev]"; } - fail() { echo "Error: $*" >&2; exit 1; } - + # omarchy:summary=Set the Omarchy package channel. + # omarchy:args= + # omarchy:requires-sudo=true diff --git i/bin/omarchy-refresh-pacman w/bin/omarchy-refresh-pacman --- i/bin/omarchy-refresh-pacman +++ w/bin/omarchy-refresh-pacman -@@ -3,6 +3,16 @@ - # omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. - # omarchy:requires-sudo=true +@@ -1,5 +1,12 @@ + #!/bin/bash -+# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux -+# ARM, which Omarchy's x86_64 pacman.conf and mirrorlist would replace. ++# A phone's pinned package repository and Arch Linux ARM mirrors are owned ++# by omamobile-update, never the desktop channel/reset commands. +if [[ -x /usr/bin/omamobile-update ]]; then -+ echo "omarchy-refresh-pacman: not on an Omarchy Mobile phone. It would replace this phone's" >&2 -+ echo "pacman.conf and mirrorlist with Omarchy's x86_64 ones (no [omamobile], no Arch Linux" >&2 -+ echo "ARM) and upgrade everything from them. Update the phone with 'omarchy update'." >&2 -+ echo "See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ echo "omarchy-refresh-pacman: use 'omarchy update' on Omarchy Mobile; see docs/RELEASES.md 5.4." >&2 + exit 1 +fi + - sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak - sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak + # omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. + # omarchy:requires-sudo=true diff --git a/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch b/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch index cd2462d33..539b9e083 100644 --- a/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch +++ b/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Notifications: swipe to dismiss, and a close button on touch screens. On a # touch screen a tap runs the toast's default action and there is no right # button, so a toast could only be got rid of by letting it launch something, @@ -13,249 +14,57 @@ # swiped doesn't expire under the finger. Right-click still closes. # # Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 (inline reply) applied. -diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml ---- i/shell/plugins/notifications/Service.qml -+++ w/shell/plugins/notifications/Service.qml -@@ -455,6 +455,29 @@ - - Process { id: focusAppProc; running: false } - -+ // Whether the seat has a touch screen, asked of Hyprland once at startup. -+ // Toasts then show a close button: a tap runs the default action, and a -+ // finger has no right button to dismiss with. A seat with only a mouse -+ // keeps the toasts as they were. -+ property bool touchScreen: false -+ -+ Process { -+ id: touchScreenProc -+ command: ["hyprctl", "-j", "devices"] -+ running: false -+ stdout: StdioCollector { -+ waitForEnd: true -+ onStreamFinished: { -+ try { -+ var touch = JSON.parse(text || "{}").touch -+ service.touchScreen = Array.isArray(touch) && touch.length > 0 -+ } catch (e) { -+ service.touchScreen = false -+ } -+ } -+ } -+ } -+ - Process { - id: ensureDirsProc - command: ["mkdir", "-p", service.stateDir, service.popupStateDir, service.historyDir, service.imagesDir] -@@ -880,6 +903,7 @@ - - Component.onCompleted: { - ensureDirsProc.running = true -+ touchScreenProc.running = true - // Once mkdir has had a tick, load the existing settings file. FileView - // surfaces an empty string when the file doesn't exist; loadSettings - // handles that path. -@@ -1061,7 +1085,7 @@ - - readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) - property real remainingLifetime: 1.0 -- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying -+ readonly property bool ticking: cardSlot.lifetime > 0 && !card.held && !cardSlot.replying - - // Inline reply. The placeholder is looked up again whenever the - // row's content changes, as an update can add or drop the action. -@@ -1115,6 +1139,7 @@ - - replyPlaceholder: cardSlot.replyPlaceholder - replying: cardSlot.replying -+ closeButtonShown: service.touchScreen - - onCloseRequested: service.dismissPopup(cardSlot.index) - onCardClicked: service.invokePopupDefault(cardSlot.index) -diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml ---- i/shell/plugins/notifications/components/NotificationCard.qml -+++ w/shell/plugins/notifications/components/NotificationCard.qml -@@ -32,6 +32,22 @@ - property string fontFamily: "" - - readonly property bool hovered: hoverTracker.hovered -+ // The card is under the user's hand: a mouse over it, or a finger -+ // swiping it. The popup container pauses the countdown meanwhile. -+ readonly property bool held: hovered || swipeHandler.active -+ -+ // Touch: a horizontal swipe dismisses (swipeEnabled), and a close button -+ // shows in the top-right corner (closeButtonShown), as a tap runs the -+ // default action and a touch screen has no right button. The container -+ // shows the button when the seat has a touch screen, so a mouse-only -+ // desktop looks and behaves as before. -+ property bool swipeEnabled: true -+ property bool closeButtonShown: false -+ // How far the card has been swiped sideways, in pixels. +# +# Omarchy 4.5: Use the Toast scene's independent horizontal translation and a persistent +# 40 px close target. Preserve mouse actions and disable dragging during reply. + +diff --git i/shell/plugins/notifications/Toast.qml w/shell/plugins/notifications/Toast.qml +--- i/shell/plugins/notifications/Toast.qml ++++ w/shell/plugins/notifications/Toast.qml +@@ -28,6 +28,23 @@ + property real cardWidth: Style.space(380) + property string replyPlaceholder: "" + property bool replyOpen: false + property real swipeOffset: 0 -+ // Release speed of the last swipe, pixels per second. -+ property real swipeVelocity: 0 -+ property bool dismissing: false - - // Inline reply (the freedesktop `inline-reply` action): the popup container - // sets the sender's placeholder text while the live notification takes a -@@ -77,6 +93,23 @@ - readonly property color accentColor: urgency === 2 ? Commons.Color.urgent : (urgency === 0 ? dimColor : Commons.Color.notifications.countdown) - readonly property var cardBorderSpec: Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) - -+ // A swipe ends: past 35% of the width, or flicked fast enough the same -+ // way, the card flies off that side and closes; otherwise it springs back. -+ function finishSwipe() { -+ var distance = Math.abs(root.swipeOffset) -+ var sameWay = root.swipeVelocity * root.swipeOffset > 0 -+ var flung = sameWay && Math.abs(root.swipeVelocity) >= Style.space(900) && distance >= root.width * 0.1 -+ if (root.width > 0 && (distance >= root.width * 0.35 || flung)) { -+ root.dismissing = true -+ swipeAnimation.to = (root.swipeOffset < 0 ? -1 : 1) * (root.width + Style.space(24)) -+ swipeAnimation.dismiss = true -+ } else { -+ swipeAnimation.to = 0 -+ swipeAnimation.dismiss = false -+ } -+ swipeAnimation.restart() -+ } -+ - function sanitizeBody(s) { - return NotificationLogic.sanitizeBody(s, app, appIcon) - } -@@ -92,13 +125,23 @@ - implicitWidth: Style.space(380) - // Add vertical border insets so mainColumn (inset by border on top/left/right) - // doesn't push content under the bottom edge. -- implicitHeight: mainColumn.implicitHeight + borderTop + borderBottom -+ implicitHeight: Math.max(mainColumn.implicitHeight, closeButtonShown ? closeButton.height : 0) + borderTop + borderBottom - radius: cornerRadius - color: Commons.Color.notifications.background - borderSpec: cardBorderSpec - clip: true - -- HoverHandler { id: hoverTracker } -+ // The swipe moves the card sideways and fades it as it goes. -+ transform: Translate { x: root.swipeOffset } -+ opacity: 1 - 0.6 * Math.min(1, Math.abs(root.swipeOffset) / Math.max(1, root.width)) -+ -+ // A mouse or stylus resting on the card pauses its countdown. A finger -+ // doesn't hover, so touch is left out: a toast that was touched must not -+ // count as hovered and stop expiring. -+ HoverHandler { -+ id: hoverTracker -+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus -+ } - - MouseArea { - anchors.fill: parent -@@ -115,6 +158,61 @@ - } - } - -+ // Swipe to dismiss. Only sideways movement past the threshold starts it, -+ // so a tap still runs the default action and a right-click still closes. -+ // Off while a reply is being typed, so selecting text can't throw the -+ // reply away. ++ transform: Translate { x: card.swipeOffset } + DragHandler { -+ id: swipeHandler + target: null ++ enabled: !card.replyOpen && !card.place.hidden && !card.place.leaving ++ acceptedDevices: PointerDevice.TouchScreen ++ xAxis.enabled: true + yAxis.enabled: false -+ dragThreshold: Style.space(12) -+ enabled: root.swipeEnabled && !root.replying && !root.dismissing ++ onActiveTranslationChanged: if (active) card.swipeOffset = activeTranslation.x + onActiveChanged: { -+ if (active) { -+ swipeAnimation.stop() -+ root.swipeVelocity = 0 -+ } else { -+ root.finishSwipe() ++ if (!active) { ++ var dismiss = Math.abs(card.swipeOffset) >= Math.min(Style.space(90), card.width * 0.25) ++ card.swipeOffset = 0 ++ if (dismiss) card.dismissed() + } + } -+ onActiveTranslationChanged: { -+ if (!active) return -+ root.swipeOffset = activeTranslation.x -+ root.swipeVelocity = centroid.velocity.x -+ } -+ } -+ -+ SequentialAnimation { -+ id: swipeAnimation -+ property real to: 0 -+ property bool dismiss: false -+ NumberAnimation { -+ target: root -+ property: "swipeOffset" -+ to: swipeAnimation.to -+ duration: swipeAnimation.dismiss ? 140 : 200 -+ easing.type: swipeAnimation.dismiss ? Easing.InQuad : Easing.OutBack -+ } -+ ScriptAction { -+ script: { -+ if (!swipeAnimation.dismiss) return -+ root.closeRequested() -+ // A container that keeps the card (nothing removes it) gets it back. -+ swipeResetTimer.restart() -+ } -+ } -+ } -+ -+ Timer { -+ id: swipeResetTimer -+ interval: 400 -+ onTriggered: { -+ root.dismissing = false -+ root.swipeOffset = 0 -+ } -+ } -+ - ColumnLayout { - id: mainColumn - // Inset by the card border so the content doesn't paint over the card's -@@ -131,7 +229,8 @@ - RowLayout { - Layout.fillWidth: true - Layout.leftMargin: Style.space(12) -- Layout.rightMargin: Style.space(12) -+ // Text stays clear of the close button's touch target. -+ Layout.rightMargin: root.closeButtonShown ? closeButton.width : Style.space(12) - Layout.topMargin: root.singleLineToast ? Style.space(7) : Style.space(10) - Layout.bottomMargin: root.singleLineToast ? Style.space(7) : Style.space(10) - spacing: root.collapseRedundantIcon ? 0 : (root.compactGlyph ? Style.space(8) : Style.space(12)) -@@ -268,4 +367,39 @@ - } - } - -+ // Close button: a small glyph with a 44 px touch target in the top-right -+ // corner, inside the border. -+ MouseArea { -+ id: closeButton -+ objectName: "notificationCloseButton" -+ visible: root.closeButtonShown -+ anchors.top: parent.top -+ anchors.right: parent.right -+ anchors.topMargin: root.borderTop -+ anchors.rightMargin: root.borderRight -+ width: Style.space(44) -+ height: Style.space(44) -+ cursorShape: Qt.PointingHandCursor -+ Accessible.role: Accessible.Button -+ Accessible.name: "Dismiss notification" -+ onClicked: root.closeRequested() -+ -+ Rectangle { -+ anchors.centerIn: parent -+ width: Style.space(28) -+ height: width -+ radius: width / 2 -+ color: Commons.Color.notifications.text -+ opacity: closeButton.pressed ? 0.18 : 0 -+ } -+ -+ Text { -+ textFormat: Text.PlainText -+ anchors.centerIn: parent -+ text: "󰅖" -+ color: root.dimColor -+ font.family: root.fontFamily -+ font.pixelSize: Style.font.icon -+ } + } - } + signal replyRequested() + signal replyCancelled() + signal replySent(string text) +@@ -454,7 +471,7 @@ + anchors.centerIn: parent + text: card.ago() + color: card.dimColor +- opacity: card.hovered ? 0 : 1 ++ opacity: 0 + visible: opacity > 0.01 + font.family: Style.font.family + font.pixelSize: Style.font.bodySmall +@@ -465,10 +482,10 @@ + id: shut + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter +- implicitWidth: closeMark.implicitWidth + Style.space(6) +- implicitHeight: closeMark.implicitHeight ++ implicitWidth: Math.max(Style.space(40), closeMark.implicitWidth + Style.space(6)) ++ implicitHeight: Math.max(Style.space(40), closeMark.implicitHeight) + enabled: card.hovered +- opacity: card.hovered ? 1 : 0 ++ opacity: 1 + visible: opacity > 0.01 + readonly property bool hot: card.pointerOver(shut) + Behavior on opacity { NumberAnimation { duration: card.fade; easing.type: Easing.InOutQuad } } diff --git a/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch b/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch index 410f8cf80..7730f09be 100644 --- a/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch +++ b/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Menu: a back button in the header and swipe right to go back. Below the # top level, going up was Backspace, Left or Escape-and-reopen, none of which # a touch screen has. The header now shows a chevron (a 44 px target) that @@ -10,10 +11,14 @@ # uninstall question is open. The keys work as before. # # Against Omarchy 4.0.6 (edge 4.0.6-1), before the menu-first-frame bridge. +# +# Omarchy 4.5: Use FilterInput without intercepting input-method commits. Preserve the +# root, dmenu, confirmation and scrolling guards. + diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml --- i/shell/plugins/menu/Menu.qml +++ w/shell/plugins/menu/Menu.qml -@@ -1066,6 +1066,50 @@ +@@ -1317,6 +1317,51 @@ MouseArea { anchors.fill: parent; onClicked: {} } @@ -29,6 +34,7 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml + DragHandler { + id: backSwipe + target: null ++ acceptedDevices: PointerDevice.TouchScreen + yAxis.enabled: false + dragThreshold: Style.space(12) + enabled: card.canGoBack && !resultList.moving @@ -41,7 +47,7 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml + // The finger's travel (the card follows at half speed). + var distance = card.swipeOffset * 2 + var flung = card.swipeVelocity >= Style.space(900) && distance >= Style.space(24) -+ if (distance >= Math.max(Style.space(64), card.width * 0.25) || flung) root.goBack() ++ if (card.canGoBack && !resultList.moving && (distance >= Math.max(Style.space(64), card.width * 0.25) || flung)) root.goBack() + backSwipeSettle.restart() + } + onActiveTranslationChanged: { @@ -64,13 +70,10 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml Item { id: keyCatcher anchors.fill: parent -@@ -1151,9 +1195,46 @@ +@@ -1400,9 +1445,31 @@ radius: root.cornerRadius color: "transparent" -+ // Back, for touch: shown below the top level, does what -+ // Backspace does. A 44 px target, overhanging the header's -+ // height into the margins around it. + MouseArea { + id: backButton + objectName: "menuBackButton" @@ -79,35 +82,23 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml + anchors.verticalCenter: parent.verticalCenter + width: Style.space(44) + height: Math.max(parent.height, Style.space(44)) -+ hoverEnabled: true -+ cursorShape: Qt.PointingHandCursor ++ z: 2 + Accessible.role: Accessible.Button + Accessible.name: "Back" + onClicked: root.goBack() -+ -+ Rectangle { -+ anchors.centerIn: parent -+ width: Style.space(32) -+ height: width -+ radius: root.cornerRadius -+ color: root.selectedBackground -+ opacity: backButton.pressed ? 0.9 : (backButton.containsMouse ? 0.5 : 0) -+ } -+ + Text { -+ textFormat: Text.PlainText + anchors.centerIn: parent -+ text: "󰅁" ++ text: "‹" ++ textFormat: Text.PlainText + color: root.foreground -+ font.family: root.fontFamily + font.pixelSize: Style.font.heading + } + } + - Text { - textFormat: Text.PlainText + FilterInput { + id: filterInput anchors.left: parent.left + anchors.leftMargin: backButton.visible ? backButton.width : 0 anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - text: root.filterText || (root.dmenuActive ? (root.dmenuPrompt + "…") : ((root.item(root.activeMenu) ? (root.item(root.activeMenu).title || root.item(root.activeMenu).label) : "Go") + "…")) + keyHandler: keyCatcher diff --git a/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch b/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch index e718492ef..465a5e00d 100644 --- a/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch +++ b/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Notifications: forget one notification by IPC. Omarchy Mobile's quick # settings list the toasts on screen and the history under the sheet, and a # sideways swipe on a row there takes away that one notification. The @@ -14,60 +15,50 @@ # a notification file name does nothing. # # Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 and 0017 applied. +# +# Omarchy 4.5: Forget keyed live and history records without sender actions or +# re-archiving. Sender-owned image paths are not deleted. + diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml --- i/shell/plugins/notifications/Service.qml +++ w/shell/plugins/notifications/Service.qml -@@ -376,9 +376,11 @@ - // The popup is leaving the screen — for any reason — so its file must not - // survive to the next shell restart. It becomes the newest history entry - // instead. Rows that never had a file (a history replay, the empty-history -- // placeholder) archive to nothing, which the move tolerates. -+ // placeholder) archive to nothing, which the move tolerates. A forgotten -+ // popup (forgetNotification) leaves no history entry: its file goes. - if (entry) { -- archivePopupFileFor(entry) -+ if (reason === "forget") deletePopupFileFor(entry) -+ else archivePopupFileFor(entry) - if (restored) delete restoredPopups[NotificationLogic.popupFileName(entry)] - } - popupModel.remove(index) -@@ -398,6 +400,26 @@ - while (popupModel.count > 0) dismissPopup(0) +@@ -826,7 +826,7 @@ + delete heights[key] + delete fresh[key] + // A placeholder (the empty-history notice) was never recorded. +- if (key.indexOf("placeholder") !== 0) storeClose(key, reason) ++ if (key.indexOf("placeholder") !== 0 && reason !== "forget") storeClose(key, reason) + layoutRevision += 1 + } + +@@ -1218,6 +1218,21 @@ } -+ // Forget one notification for good, named by its file (-.json, -+ // popupFileName): a toast on screen with that name, a history replay of it -+ // included, closes at its sender without moving into history, and the -+ // history entry and its image copies are deleted. The delete runs on the -+ // file queue, after any archive already queued for the same notification, -+ // so a toast that has just left the screen can't come back as history. + // A row that closes moves from live to history. ++ // Key-based4.5 store deletion. Never construct an arbitrary path or run ++ // notification actions; forget removes only the named logical record. + function forgetNotification(name) { -+ var file = String(name || "") -+ if (!/^[0-9]+-[0-9]+\.json$/.test(file)) return "none" -+ for (var i = popupModel.count - 1; i >= 0; i--) { -+ var row = popupModel.get(i) -+ if (row && row.originalId >= 0 && NotificationLogic.popupFileName(row) === file) -+ removePopup(i, "forget") -+ } -+ enqueuePopupFileJob(["bash", "-c", -+ "rm -f \"$1/$3\" \"$2/${3%.json}\"-*", "--", -+ historyDir, imagesDir, file]) ++ var key = String(name || "") ++ if (!Store.KEY.test(key)) return "none" ++ var exists = !!liveKeys[key] || !!Store.liveEntry(liveEntries, key) ++ || historyEntries.some(function(entry) { return entry.key === key }) ++ if (!exists) return "ok" ++ storeDrop(key) ++ historyEntries = historyEntries.filter(function(entry) { return entry.key !== key }) ++ saveSoon("history") ++ closeToast(key, "forget", true) + return "ok" + } + - // Run the popup's click action, then dismiss. Omarchy's own toasts carry the - // action as an argv vector in the `execArgv` role (see execArgvFromHints), - // which the persistence files preserve, so restored toasts stay clickable. -@@ -993,6 +1015,12 @@ - return hit ? "ok" : "none" - } + function storeClose(key, reason) { + var entry = Store.liveEntry(liveEntries, key) + if (!entry) return +@@ -1428,6 +1443,8 @@ -+ // Forget one notification, toast or history entry, by its file name -+ // (`forget 1760000000000-3.json`); the rest of the history stays. -+ function forget(name: string): string { -+ return service.forgetNotification(name) -+ } -+ function ping(): string { return "ok" } - } ++ function forget(name: string): string { return service.forgetNotification(name) } ++ + function isDnd(): string { return service.doNotDisturb ? "on" : "off" } + + function toggleDnd(): string { diff --git a/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch b/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch index 2f30027af..1316977a4 100644 --- a/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch +++ b/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch @@ -14,10 +14,13 @@ # dropped too, but 0001 skips that toast on a phone. # # Against Omarchy 4.0.6 (stable 4.0.6-1). +# +# Omarchy 4.5: Keep touch-friendly notification phrasing on the current sender path. + diff --git i/bin/omarchy-notification-send w/bin/omarchy-notification-send --- i/bin/omarchy-notification-send +++ w/bin/omarchy-notification-send -@@ -136,6 +136,50 @@ +@@ -176,6 +176,50 @@ fi done diff --git a/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch b/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch index cc9bfac30..117cf1cf8 100644 --- a/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch +++ b/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch @@ -12,11 +12,13 @@ # patch 0023), so the glance is up on the next wake. # # Against Omarchy 4.0.6 (4.0.6-1). +# +# Omarchy 4.5: Retain display-off-before-suspend behavior on the current sleep path. + diff --git i/bin/omarchy-system-sleep-lock w/bin/omarchy-system-sleep-lock -index d471cea..b278615 100755 --- i/bin/omarchy-system-sleep-lock +++ w/bin/omarchy-system-sleep-lock -@@ -104,6 +104,25 @@ report_unsecured() { +@@ -105,6 +105,25 @@ exit 1 } @@ -42,7 +44,7 @@ index d471cea..b278615 100755 # Request the lock before touching monitor state, so a stuck Hyprland IPC call # cannot consume the window before Quickshell has begun securing the session. request_lock -@@ -113,7 +132,7 @@ sync_clamshell +@@ -114,7 +133,7 @@ # inside the reserve derive_budget_ms already held back for logind. while (( $(remaining_ms) > 0 )); do case $(lock_state) in diff --git a/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch b/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch index 13c9da150..a728ba7ec 100644 --- a/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch +++ b/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Lock: fingerprint only when a finger is enrolled. A backport of the probe # half of upstream Omarchy's 879d6583d ("Fix fingerprint enrollment and # lock-screen recovery", omacom/omarchy#7158, on quattro for 4.5; no stable @@ -26,161 +27,32 @@ # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0009. Drop it once the # phone's Omarchy has 879d6583d (the 4.5 line); its Service.qml and # omarchy-apply-lock differ from 4.0.6's, so this will not apply there. +# +# Omarchy 4.5: Enrollment classification and recovery are already upstream, so retain +# them unchanged. The remaining setup guard preserves existing root-owned +# mobile PAM configuration and qualified fingerprint recovery hooks. + diff --git i/bin/omarchy-apply-lock w/bin/omarchy-apply-lock --- i/bin/omarchy-apply-lock +++ w/bin/omarchy-apply-lock -@@ -40,16 +40,24 @@ - account include system-local-login - EOF +@@ -26,6 +26,20 @@ + fi + } --if [[ -x /usr/bin/fprintd-list ]] && -- /usr/bin/fprintd-list "$target_user" 2>/dev/null | grep -qi finger; then -+# Keep the privileged probe pinned to /usr/bin; failure is not empty enrollment. -+if [[ -x /usr/bin/fprintd-list ]]; then -+ fingerprint_status=$(/usr/bin/fprintd-list "$target_user" 2>&1 || true) -+else -+ fingerprint_status="no" ++# Mobile owns its existing PAM policy (including a single-try fingerprint ++# conversation paired with graceful client release). Desktop setup must not ++# overwrite it, or install unqualified fprintd sleep/restart hooks beside it. ++if [[ -x /usr/bin/omamobile-update && -f /etc/pam.d/omarchy-lock-password ]]; then ++ if [[ -L /etc/pam.d/omarchy-lock-password ]] || ++ [[ $(stat -c %u /etc/pam.d/omarchy-lock-password) != 0 ]] || ++ [[ -n $(find /etc/pam.d/omarchy-lock-password -perm /022 -print) ]]; then ++ echo "Unsafe existing mobile password PAM policy; refusing setup." >&2 ++ exit 1 ++ fi ++ echo "Preserving existing mobile lock PAM and fprintd recovery policy." ++ exit 0 +fi + -+if grep -qE '^[[:space:]]*-[[:space:]]*#[0-9]+:' <<< "$fingerprint_status"; then - echo "Configuring lock screen fingerprint authentication..." - as_root tee /etc/pam.d/omarchy-lock-fingerprint >/dev/null <<'EOF' - #%PAM-1.0 - auth required pam_fprintd.so - account include system-local-login - EOF --else -+elif [[ $fingerprint_status == "no" ]] || grep -qi 'has no fingers enrolled' <<< "$fingerprint_status"; then - as_root rm -f /etc/pam.d/omarchy-lock-fingerprint -+else -+ echo "Could not check fingerprint enrollment; keeping the existing configuration." >&2 - fi - - # omarchy-shell can't reach a running shell during chroot install. The echo -diff --git i/shell/plugins/lock/FingerprintModel.js w/shell/plugins/lock/FingerprintModel.js -new file mode 100644 ---- /dev/null -+++ w/shell/plugins/lock/FingerprintModel.js -@@ -0,0 +1,33 @@ -+// The probe half of upstream's FingerprintModel.js (879d6583d): what -+// fprintd-list's answer means, and how often to ask again when it had none. -+var MATCH_RETRY_MS = 250 -+var ERROR_RETRY_BASE_MS = 1000 -+// Leave enough idle time for fprintd to exit and clear a wedged claim. -+var FPRINTD_IDLE_EXIT_MS = 30000 -+var ERROR_RETRY_CAP_MS = 40000 -+ -+function retryDelayMs(streak) { -+ if (streak <= 0) return MATCH_RETRY_MS -+ var delay = ERROR_RETRY_BASE_MS * Math.pow(2, streak - 1) -+ return Math.min(delay, ERROR_RETRY_CAP_MS) -+} -+ -+// A failed probe is unknown, so it cannot disable authentication for the lock. -+function classifyProbe(text) { -+ var s = String(text || "").trim() -+ if (/^[ \t]*-[ \t]*#[0-9]+:/m.test(s)) return "yes" -+ if (s === "no") return "no" -+ if (/has no fingers enrolled/i.test(s)) return "no" -+ return "unknown" -+} -+ -+if (typeof module !== "undefined") { -+ module.exports = { -+ MATCH_RETRY_MS: MATCH_RETRY_MS, -+ ERROR_RETRY_BASE_MS: ERROR_RETRY_BASE_MS, -+ ERROR_RETRY_CAP_MS: ERROR_RETRY_CAP_MS, -+ FPRINTD_IDLE_EXIT_MS: FPRINTD_IDLE_EXIT_MS, -+ classifyProbe: classifyProbe, -+ retryDelayMs: retryDelayMs -+ } -+} -diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml ---- i/shell/plugins/lock/Service.qml -+++ w/shell/plugins/lock/Service.qml -@@ -5,6 +5,7 @@ - import Quickshell.Wayland - import qs.Commons - import qs.Commons as Commons -+import "FingerprintModel.js" as FingerprintModel - - Item { - id: root -@@ -23,6 +24,7 @@ - property bool fingerprintAuthenticating: false - property bool passwordPamConfigured: false - property bool fingerprintConfigured: false -+ property int fingerprintProbeStreak: 0 - property bool keypad: false - property bool previewVisible: false - property string enteredPassword: "" -@@ -119,6 +121,32 @@ - if (!fingerprintCheckProc.running) fingerprintCheckProc.running = true - } - -+ // Only definitive enrollment results may disable authentication. -+ function applyFingerprintProbe(text) { -+ var status = FingerprintModel.classifyProbe(text) -+ if (status === "unknown") { -+ if (fingerprintConfigured) return -+ fingerprintProbeStreak += 1 -+ if (lockRequested) { -+ fingerprintRecheckTimer.interval = FingerprintModel.retryDelayMs(fingerprintProbeStreak) -+ fingerprintRecheckTimer.restart() -+ } -+ return -+ } -+ fingerprintProbeStreak = 0 -+ fingerprintRecheckTimer.stop() -+ fingerprintConfigured = status === "yes" -+ if (lockRequested && fingerprintConfigured) { -+ // A pending retry already owns the next attempt. -+ if (!fingerprintRetryTimer.running) startFingerprint() -+ } else if (!fingerprintConfigured) { -+ // abort() delivers no completion signal, so close the attempt here. -+ if (fingerprintPam.active) fingerprintPam.abort() -+ fingerprintAuthenticating = false -+ fingerprintRetryTimer.stop() -+ } -+ } -+ - function logEvent(event) { - lastEvent = event - lastEventAt = new Date().toISOString() -@@ -132,6 +160,8 @@ - failedAttempts = 0 - authenticatingPassword = false - fingerprintAuthenticating = false -+ fingerprintProbeStreak = 0 -+ fingerprintRecheckTimer.stop() - fingerprintRetryTimer.stop() - if (passwordPam.active) passwordPam.abort() - if (fingerprintPam.active) fingerprintPam.abort() -@@ -390,15 +420,21 @@ - } - } - -+ // Keep fprintd errors distinguishable from an explicit empty enrollment. - Process { - id: fingerprintCheckProc -- command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1 && fprintd-list \"$USER\" 2>/dev/null | grep -qi finger; then echo yes; else echo no; fi"] -+ command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1; then LC_ALL=C fprintd-list \"$USER\" 2>&1; else echo no; fi"] - stdout: StdioCollector { id: fingerprintCheckStdout; waitForEnd: true } -- onExited: { -- root.fingerprintConfigured = String(fingerprintCheckStdout.text || "").trim() === "yes" -- if (root.lockRequested && root.fingerprintConfigured) root.startFingerprint() -- else if (!root.fingerprintConfigured && fingerprintPam.active) fingerprintPam.abort() -- } -+ onExited: root.applyFingerprintProbe(fingerprintCheckStdout.text) -+ } -+ -+ // Retries a probe that could not reach fprintd, paced like the attempt -+ // retries so a daemon that stays unreachable is asked about ever less often. -+ Timer { -+ id: fingerprintRecheckTimer -+ interval: FingerprintModel.ERROR_RETRY_BASE_MS -+ repeat: false -+ onTriggered: root.refreshFingerprintStatus() - } + echo "Configuring lock screen password authentication..." - Process { + as_root tee /etc/pam.d/omarchy-lock-password >/dev/null <<'EOF' diff --git a/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch b/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch index 8f08ea8b7..f01017d6b 100644 --- a/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch +++ b/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Lock: a glance view on touch-only devices (the lock-keypad toggle), as a # phone's lock screen opens: the time, the date, the home screen's last # weather reading and the newest notifications, over the lock's blurred @@ -49,8 +50,12 @@ # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0017 # and 0019. -diff --git i/shell/plugins/lock/LockGlance.js w/shell/plugins/lock/LockGlance.js -new file mode 100644 +# +# Omarchy 4.5: Adapt the glance to the current authentication, wake and compact +# notification-store fields. Restore the licensed standalone NotificationLogic +# and NotificationCard used by the glance; Toast is a scene-bound type with a +# different API. Read do-not-disturb from quiet.json and retain keyed IPC forget. + --- /dev/null +++ w/shell/plugins/lock/LockGlance.js @@ -0,0 +1,164 @@ @@ -218,8 +223,6 @@ new file mode 100644 + var text = String(w.text || "").trim() + return Math.round(w.temperature) + "°" + (text ? ", " + text.charAt(0).toLowerCase() + text.slice(1) : "") +} -diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml -new file mode 100644 --- /dev/null +++ w/shell/plugins/lock/LockGlance.qml @@ -0,0 +1,628 @@ @@ -542,7 +545,7 @@ new file mode 100644 + } + + FileView { -+ path: glance.active ? glance.home + "/.local/state/omarchy/notifications.json" : "" ++ path: glance.active ? glance.home + "/.local/state/omarchy/notifications/quiet.json" : "" + watchChanges: true + printErrors: false + onLoaded: glance.doNotDisturb = Glance.doNotDisturb(text()) @@ -851,10 +854,9 @@ new file mode 100644 + } + } +} -diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -31,6 +31,16 @@ +@@ -33,6 +33,16 @@ // The ABC/123 switch in the field swaps either way, so a password with // letters and digits can always be typed. property bool passwordFirst: false @@ -871,18 +873,15 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml property bool switchedInput: false readonly property bool padShown: keypad && (passwordFirst === switchedInput) readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 -@@ -73,6 +83,10 @@ - } +@@ -71,6 +81,7 @@ + signal wakeRequested() function forcePasswordFocus() { -+ if (glance.showing) { -+ glance.forceActiveFocus() -+ return -+ } ++ if (glance.showing) { glance.forceActiveFocus(); return } if (padShown) { keypadKeys.forceActiveFocus() return -@@ -200,7 +214,8 @@ +@@ -229,7 +240,8 @@ Keypad { id: numberPad @@ -892,7 +891,7 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml enabled: root.inputEnabled && !root.authenticatingPassword anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom -@@ -226,6 +241,8 @@ +@@ -255,6 +267,8 @@ BorderSurface { id: inputField @@ -901,17 +900,27 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml width: root.fieldWidth height: root.fieldHeight anchors.horizontalCenter: parent.horizontalCenter -@@ -365,7 +382,8 @@ +@@ -408,7 +422,8 @@ + width: parent.width - Style.space(32) + wrapMode: root.keypad ? Text.WordWrap : Text.NoWrap + anchors.horizontalCenter: inputField.horizontalCenter +- visible: root.fingerprintConfigured && root.fingerprintUnavailable ++ visible: root.fingerprintConfigured && root.fingerprintUnavailable && root.pinVisible ++ opacity: root.pinOpacity + text: Commons.I18n.t("lock.fingerprintUnavailable") + color: Commons.Color.lock.textError + font.family: Style.font.family +@@ -427,7 +442,8 @@ anchors.bottomMargin: Style.space(18) anchors.horizontalCenter: inputField.horizontalCenter width: parent.width - Style.space(32) -- visible: root.keypadClearsSensor -+ visible: root.keypadClearsSensor && root.pinVisible +- visible: root.keypadClearsSensor && !root.fingerprintUnavailable ++ visible: root.keypadClearsSensor && !root.fingerprintUnavailable && root.pinVisible + opacity: root.pinOpacity text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" : "Touch the fingerprint sensor or enter your password" color: Commons.Color.lock.text -@@ -383,9 +401,10 @@ +@@ -445,9 +461,10 @@ Item { id: emergencyButton objectName: "lockEmergencyCall" @@ -924,7 +933,7 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml anchors.topMargin: Style.space(20) width: emergencyLabel.implicitWidth + Style.space(40) height: Math.max(Style.space(44), emergencyLabel.implicitHeight + Style.space(16)) -@@ -411,5 +430,12 @@ +@@ -473,5 +490,12 @@ } } } @@ -937,67 +946,51 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml + } } } -diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml --- i/shell/plugins/lock/Service.qml +++ w/shell/plugins/lock/Service.qml -@@ -31,6 +31,15 @@ - property int failedAttempts: 0 +@@ -54,6 +54,9 @@ property string backgroundPath: "" + property string videoPosterPath: "" property int backgroundVersion: 0 -+ // Bumped by the wake call (a phone's power button): the lock's glance view -+ // comes back each time the screen is woken. + property int wakeSerial: 0 -+ // Bumped whenever the locked display goes dark: the lock's own blank, or -+ // the dark call (a phone's power button, sleep). The glance view comes -+ // back each time, and displayDark holds until the display is lit through -+ // the lock again, so the touch that wakes a dark screen only wakes it. + property int blankSerial: 0 + property bool displayDark: false - property string lastEvent: "init" - property string lastEventAt: "" - property bool strandedLock: false -@@ -178,14 +187,22 @@ + // The wallpaper file's mtime and size. The lock caches its wallpaper by + // version, so a file overwritten in place must bump the version too. + property string backgroundSignature: "" +@@ -257,6 +260,7 @@ } function runWake() { + displayDark = false if (!wakeProcess.running) wakeProcess.running = true if (lockRequested) armBlankTimer() + resumeFingerprint() +@@ -351,8 +355,15 @@ } function runBlank() { + markDark() + pauseFingerprint() if (!blankProcess.running) blankProcess.running = true - } - ++ } ++ + function markDark() { + if (!lockRequested) return + blankSerial += 1 + displayDark = true -+ } -+ - function submitPassword(value) { - var password = String(value || "") - if (!lockRequested || authenticatingPassword || password.length === 0) return -@@ -280,6 +297,9 @@ + } - LockView { - keypad: root.keypad -+ wakeSerial: root.wakeSerial -+ blankSerial: root.blankSerial -+ displayDark: root.displayDark - id: lockView - anchors.fill: parent - backgroundPath: root.backgroundPath -@@ -548,10 +568,21 @@ + function submitPassword(value) { +@@ -903,7 +914,18 @@ // it and re-arm the blank timer (a phone's power button). function wake(): string { if (!root.currentlyLocked()) return "unlocked" + root.wakeSerial += 1 root.runWake() - return "ok" - } - ++ return "ok" ++ } ++ + // The locked display went dark some other way than the lock's own blank + // (a phone's power button, or just before sleep): back to the glance + // view, and the touch that next wakes the screen only wakes it. The @@ -1005,44 +998,877 @@ diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml + function dark(): string { + if (!root.currentlyLocked()) return "unlocked" + root.markDark() -+ return "ok" + return "ok" + } + +--- /dev/null ++++ w/shell/plugins/notifications/NotificationLogic.js +@@ -0,0 +1,515 @@ ++// SPDX-License-Identifier: MIT ++// Retained licensed4.0.6 compatibility component; not the4.5 daemon. ++// Copyright (c) David Heinemeier Hansson ++// ++// Permission is hereby granted, free of charge, to any person obtaining ++// a copy of this software and associated documentation files (the ++// "Software"), to deal in the Software without restriction, including ++// without limitation the rights to use, copy, modify, merge, publish, ++// distribute, sublicense, and/or sell copies of the Software, and to ++// permit persons to whom the Software is furnished to do so, subject to ++// the following conditions: ++// ++// The above copyright notice and this permission notice shall be ++// included in all copies or substantial portions of the Software. ++// ++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ++// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION ++// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++// Mobile touch changes: Copyright (c) 2026 Derek Ross ++function isChromiumDerived(app, appIcon) { ++ var source = (String(app || "") + "\n" + String(appIcon || "")).toLowerCase() ++ return source.indexOf("chrom") >= 0 || source.indexOf("brave") >= 0 || ++ source.indexOf("vivaldi") >= 0 || source.indexOf("microsoft-edge") >= 0 || ++ source.indexOf("opera") >= 0 ++} ++ ++// True when a `<...>` run is an image tag, so the name is read the way Qt's ++// parser reads it: after the `<`, the leading run of letters and digits. ++// ++// Skip everything up to that run rather than matching the separator, because ++// there is no JavaScript expression for what Qt skips. QQuickStyledText calls ++// skipSpace(), which is QChar::isSpace(), and that set is not `\s`: Qt counts ++// U+0085 NEL and `\s` does not, while `\s` counts U+FEFF and Qt does not. A ++// name read with `\s` therefore misses a tag written as `<`, U+0085, `img`: ++// Qt skips the NEL, reads `img` and issues the GET, while the regex finds no ++// name at all and the tag is kept. Measured against Qt 6.11.2. ++// ++// Over-skipping is the safe direction. It can only classify more runs as ++// images, and dropping a run never manufactures a tag: a dropped run joins two ++// stretches of text that each contain no `<`. ++function isImageTag(tag) { ++ var name = /^<[^A-Za-z0-9]*([A-Za-z0-9]+)/.exec(tag) ++ return !!name && name[1].toLowerCase() === "img" ++} ++ ++// The body renders as StyledText so notifications can use the markup the ++// body-markup capability advertises (see Service.qml). StyledText honours ++// , and a remote src makes the shell issue an unauthenticated GET ++// with no user action, so image tags go before the renderer sees them. ++// ++// Work in whole tags, never in substrings of one. A `<` opens a tag that runs ++// to the next `>`, nested `<` and all, and only a tag whose own name is `img` ++// is dropped. ++// ++// That is the conservative bound, not Qt's exact one: Qt lets a `>` inside a ++// quoted attribute value pass without closing the tag, so a Qt tag can be ++// longer than the run taken here. Do not "correct" this to match Qt. Taking ++// the shorter run only ever splits one Qt tag into several, and a split can ++// only expose an `` through. ++// ++// Deleting a substring is what makes a naive `/]*>/g` unsafe. Given ++// ++// g src="http://a/beacon.png"> ++// ++// Qt reads ONE malformed tag named `im` and renders nothing, but removing the ++// inner match closes the surviving halves up into `` ++// — a live tag the input never contained. The stripper would be manufacturing ++// the very thing it exists to remove. ++// ++// Because every `<` opens a tag, the text between tags never contains one, so ++// dropping a tag cannot splice its neighbours into a new one. That makes a ++// single pass sufficient, with no re-scanning and no input bound to police. ++function stripImageTags(text) { ++ var out = "" ++ var i = 0 ++ ++ while (i < text.length) { ++ var open = text.indexOf("<", i) ++ if (open === -1) { ++ out += text.slice(i) ++ break + } + - function isLocked(): string { - return root.currentlyLocked() ? "true" : "false" - } -diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml ---- i/shell/plugins/notifications/components/NotificationCard.qml ++ out += text.slice(i, open) ++ ++ // An unterminated tag at the end of the string still reaches the renderer, ++ // which closes it itself, so treat the remainder as one tag. ++ var close = text.indexOf(">", open) ++ var tag = close === -1 ? text.slice(open) : text.slice(open, close + 1) ++ ++ if (!isImageTag(tag)) out += tag ++ i = close === -1 ? text.length : close + 1 ++ } ++ ++ return out ++} ++ ++// What the card renders, and the last thing to touch the string before Qt parses ++// it. The newline rewrite belongs here rather than in the card because it inserts ++// `
` into text stripImageTags chose to KEEP, and a kept tag may hold a `<` of ++// its own: `` is one tag named `x` to both the ++// stripper and Qt, until the rewrite splits it into `` and a live image tag ++// the input never contained. Measured against Qt 6.11.2 — the rewritten form ++// fetches, the original does not. So strip again after, and what Qt parses is what ++// was checked last. ++function styledBody(body, app, appIcon) { ++ return stripImageTags(sanitizeBody(body, app, appIcon).replace(/\r\n|\r|\n/g, "
")) ++} ++ ++function sanitizeBody(body, app, appIcon) { ++ var text = stripImageTags(String(body || "")) ++ if (!isChromiumDerived(app, appIcon)) return text ++ ++ return text ++ .replace(/^\s*]*>\s*(?:https?:\/\/|www\.)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/[^<\s]*)?\s*<\/a>\s*/i, "") ++ .replace(/^\s*(?:https?:\/\/|www\.)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?\s+/i, "") ++} ++ ++function summaryStartsWithGlyph(summary) { ++ var text = String(summary || "").replace(/^\s+/, "") ++ if (!text) return false ++ ++ var offset = 1 ++ var first = text.charCodeAt(0) ++ if (first >= 0xd800 && first <= 0xdbff && text.length > 1) offset = 2 ++ ++ var spaces = 0 ++ while (offset < text.length && text.charAt(offset) === " ") { ++ spaces++ ++ offset++ ++ } ++ ++ return spaces >= 2 ++} ++ ++function shouldBypassDnd(notification, criticalUrgency) { ++ var appName = String((notification && notification.appName) || "") ++ if (appName === "omarchy-action") return true ++ return appName === "notify-send" && notification && notification.urgency === criticalUrgency ++} ++ ++function isEphemeralApp(appName) { ++ var name = String(appName || "") ++ return name === "notify-send" || name === "omarchy-action" ++} ++ ++function stringHint(hints, name) { ++ try { ++ if (hints) { ++ var value = hints[name] ++ if (value !== undefined && value !== null) return String(value) ++ } ++ } catch (e) { ++ } ++ return "" ++} ++ ++function glyphFromHints(hints) { ++ return stringHint(hints, "omarchy-glyph") ++} ++ ++// The click action: a JSON argv string from omarchy-notification-send ++// --exec. Carried as data so a toast restored after a shell restart stays ++// clickable (a libnotify action can't — its sender is gone). Run via ++// Util.execArgv as bash positional parameters, never a shell string, so ++// attacker-controlled values (a title, a filename) can't become commands. ++function execArgvFromHints(hints) { ++ return stringHint(hints, "omarchy-exec-argv") ++} ++ ++// Validate a persisted omarchy-exec-argv into a runnable argv, or null. This is ++// a STRUCTURAL check only: it fails closed on a malformed hint (non-array, a ++// non-string or empty program, or a leading-dash program that argv would read as ++// an option). It does not judge intent — a well-formed ["bash","-c",…] is ++// accepted. WHICH senders may set this hint is a separate boundary: any ++// session-bus process can, by the freedesktop protocol's design (see ++// docs/notifications.md), which is equivalent to same-uid code execution. ++function parseExecArgv(value) { ++ var text = String(value || "") ++ if (!text) return null ++ ++ var parsed ++ try { ++ parsed = JSON.parse(text) ++ } catch (e) { ++ return null ++ } ++ ++ if (!Array.isArray(parsed) || parsed.length === 0) return null ++ for (var i = 0; i < parsed.length; i++) { ++ if (typeof parsed[i] !== "string") return null ++ } ++ if (!parsed[0] || parsed[0].charAt(0) === "-") return null ++ return parsed ++} ++ ++function shouldRenderCompactGlyph(glyph, iconSource, singleLineToast) { ++ return String(glyph || "").length > 0 && String(iconSource || "").length === 0 && !!singleLineToast ++} ++ ++function snapshotOf(notification, timestamp) { ++ var n = notification || {} ++ var id = n.id || 0 ++ var expireTimeout = Number(n.expireTimeout || 0) ++ if (!isFinite(expireTimeout) || expireTimeout < 0) expireTimeout = 0 ++ return { ++ id: id, ++ originalId: id, ++ app: n.appName || "", ++ appIcon: n.appIcon || "", ++ summary: String(n.summary || ""), ++ body: n.body || "", ++ image: n.image || "", ++ glyph: glyphFromHints(n.hints), ++ execArgv: execArgvFromHints(n.hints), ++ urgency: n.urgency, ++ expireTimeout: expireTimeout, ++ timestamp: timestamp === undefined ? Date.now() : timestamp ++ } ++} ++ ++// Everything the popup card draws, and therefore everything an in-place ++// update has to write through to the row and its file. ++var POPUP_ROLES = ["app", "appIcon", "summary", "body", "image", "glyph", "execArgv", "urgency", "expireTimeout"] ++ ++function popupRoles() { ++ return POPUP_ROLES ++} ++ ++// Whether a refresh has anything to write. Each property a client updates ++// emits its own signal, and the catch-up refresh after a row is inserted ++// usually finds the object exactly as it was snapshotted — without this, ++// one update would rewrite the file several times over. ++function popupRowChanged(row, updated) { ++ var current = row || {} ++ var next = updated || {} ++ for (var i = 0; i < POPUP_ROLES.length; i++) { ++ var role = POPUP_ROLES[i] ++ if (current[role] !== next[role]) return true ++ } ++ return false ++} ++ ++// A client updating a notification through replaces_id keeps the identity of ++// the popup it took over: the file name is the timestamp and id the popup was ++// first persisted under, and the restore, replace and archive paths all key ++// off that name. Only what the card draws comes from the updated object. ++function replacementSnapshot(notification, originalId, timestamp) { ++ var updated = snapshotOf(notification, timestamp) ++ updated.id = originalId ++ updated.originalId = originalId ++ return updated ++} ++ ++function historyEntry(value, normalUrgency) { ++ var e = value || {} ++ var out = { ++ id: e.id || 0, ++ originalId: e.originalId || e.id || 0, ++ app: e.app || "", ++ appIcon: e.appIcon || "", ++ summary: e.summary || "", ++ body: e.body || "", ++ image: e.image || "", ++ glyph: e.glyph || "", ++ execArgv: e.execArgv || "", ++ urgency: typeof e.urgency === "number" ? e.urgency : normalUrgency, ++ expireTimeout: 0, ++ timestamp: e.timestamp || 0 ++ } ++ if (typeof e.key === "string" && /^[A-Za-z0-9_-]{1,120}$/.test(e.key)) out.key = e.key ++ return out ++} ++ ++// notifications.json holds nothing but the last-set DND preference now that ++// history is a directory of files. Older versions kept `pending`/`past` ++// (and, older still, `entries`) arrays in there; their presence is reported ++// so the service can rewrite the file without the dead payload. ++function parseSettings(raw) { ++ var text = String(raw || "").trim() ++ if (!text) return { error: false, dnd: null, legacy: false } ++ ++ try { ++ var parsed = JSON.parse(text) ++ return { ++ error: false, ++ dnd: parsed && typeof parsed.dnd === "boolean" ? parsed.dnd : null, ++ legacy: !!(parsed && (parsed.pending || parsed.past || parsed.entries)) ++ } ++ } catch (e) { ++ return { error: true, errorMessage: String(e), dnd: null, legacy: false } ++ } ++} ++ ++// ---------------------------------------------------- popup persistence ++// ++// Each on-screen popup is mirrored to its own file under ++// ~/.local/state/omarchy/notifications/ so toasts survive shell restarts ++// (e.g. the restart `omarchy-update` performs). The file exists exactly as ++// long as the popup is on screen: it is written when the toast appears and ++// moved into the history/ subdirectory when the toast expires, is dismissed, ++// or its action is invoked. History is those moved files, newest last-10. ++ ++function popupEntry(value, normalUrgency) { ++ var entry = historyEntry(value, normalUrgency) ++ var expire = Number((value || {}).expireTimeout || 0) ++ if (!isFinite(expire) || expire < 0) expire = 0 ++ entry.expireTimeout = expire ++ // Absolute expiry deadline, set only when a restore resets a surviving ++ // popup's display lifetime. Kept out of the entry entirely when unset so ++ // restored rows match the roles of freshly received ones. ++ var deadline = Number((value || {}).deadline || 0) ++ if (isFinite(deadline) && deadline > 0) entry.deadline = deadline ++ return entry ++} ++ ++function popupFileName(entry) { ++ if (entry && typeof entry.key === "string" && /^[A-Za-z0-9_-]{1,120}$/.test(entry.key)) return entry.key ++ return imageStem(entry) + ".json" ++} ++ ++// ---------------------------------------------------- persisted images ++// ++// A notification's images only exist while it is live: Chromium-family ++// senders (all Omarchy web apps) delete their scoped /tmp files on close, ++// and image-data hints surface as in-process image:// URLs that die with ++// the server object. Persisted entries therefore reference their own ++// copies, named by the entry's file stem so cleanup can find them from ++// the JSON file name alone. ++ ++var PERSISTED_IMAGE_ROLES = ["appIcon", "image"] ++ ++function imageStem(entry) { ++ var e = entry || {} ++ return String(e.timestamp || 0) + "-" + String(e.originalId || 0) ++} ++ ++// The filesystem path behind a file-backed image value, or "" for anything ++// a copy can't capture: themed icon names, in-process image:// URLs, empty. ++function localImageFile(value) { ++ var s = String(value || "") ++ if (s.indexOf("file://") === 0) { ++ s = s.slice(7) ++ try { s = decodeURIComponent(s) } catch (e) {} ++ } ++ return s.charAt(0) === "/" ? s : "" ++} ++ ++// The entry as it should hit the disk, plus the copies that make it true. ++// File-backed images redirect to their copy under imagesDir; dead image:// ++// URLs drop to "" (the card falls back to the app icon). Already-redirected ++// values map onto themselves and produce no copy, keeping restores no-ops. ++function persistablePopup(entry, imagesDir) { ++ var e = entry || {} ++ var out = {} ++ for (var key in e) out[key] = e[key] ++ var copies = [] ++ for (var i = 0; i < PERSISTED_IMAGE_ROLES.length; i++) { ++ var role = PERSISTED_IMAGE_ROLES[i] ++ var value = String(out[role] || "") ++ if (!value) continue ++ var source = localImageFile(value) ++ if (source) { ++ var copy = String(imagesDir || "") + imageStem(e) + "-" + role ++ if (source !== copy) copies.push({ from: source, to: copy }) ++ out[role] = "file://" + copy ++ } else if (value.indexOf("image://") === 0) { ++ out[role] = "" ++ } ++ } ++ return { entry: out, copies: copies } ++} ++ ++function serializePopup(entry, normalUrgency) { ++ // Compact (single-line) on purpose: restore cats every file together and ++ // parses line by line, which only works when each file is one line. ++ return JSON.stringify(popupEntry(entry, normalUrgency)) ++} ++ ++// Parse the concatenation of every persisted popup file into entries, ++// newest-first. Deliberately NO dedupe by originalId: ids restart from 1 ++// with every server process, so two files sharing an id are usually ++// different generations — dropping the older one would silently discard a ++// restored critical alert the moment a fresh notification reuses its id. ++// The one case that leaves a genuine duplicate (a crash between a ++// replacement's write and the replaced file's delete) merely re-shows a ++// superseded toast, which expires or is dismissed and cleans itself up. ++function parsePopupFiles(raw, normalUrgency) { ++ var lines = String(raw || "").split("\n") ++ var entries = [] ++ for (var i = 0; i < lines.length; i++) { ++ var line = lines[i].trim() ++ if (!line) continue ++ try { ++ var value = JSON.parse(line) ++ var values = Array.isArray(value) ? value : [value] ++ for (var j = 0; j < values.length && j < 1000; j++) { ++ var row = values[j] ++ if (!row || typeof row !== "object" || Array.isArray(row)) continue ++ //4.5live/history are compact arrays; quiet state is not a row. ++ if (typeof row.key === "string") { ++ if (!/^[A-Za-z0-9_-]{1,120}$/.test(row.key) || typeof row.ts !== "number" || !isFinite(row.ts)) continue ++ row = Object.assign({}, row, { timestamp: row.ts * 1000 }) ++ } else if (!row.timestamp && !row.summary && !row.body) continue ++ entries.push(popupEntry(row, normalUrgency)) ++ } ++ } catch (e) { ++ // A torn write from a crash mid-save — skip the line, keep the rest. ++ } ++ } ++ entries.sort(function(a, b) { return (b.timestamp || 0) - (a.timestamp || 0) }) ++ return entries ++} ++ ++// A persisted popup whose lifetime already ran out would have expired on ++// screen had the shell kept running, so it is not restored. duration 0 means ++// the popup never expires (critical urgency) and always survives restarts. ++// A restore-reset deadline outranks the original timestamp: without it, a ++// second restart would judge a re-shown toast by a clock that no longer ++// governs its display and drop it while it is still on screen. ++function popupExpired(entry, duration, now) { ++ var deadline = Number((entry || {}).deadline || 0) ++ if (isFinite(deadline) && deadline > 0) return Number(now) >= deadline ++ var lifetime = Number(duration || 0) ++ if (!isFinite(lifetime) || lifetime <= 0) return false ++ return (Number(now) - Number((entry || {}).timestamp || 0)) >= lifetime ++} ++ ++function popupPlacement(barPosition, barClearance, gapsOut) { ++ var position = String(barPosition || "top") ++ var clearance = Number(barClearance) ++ var gap = Number(gapsOut) ++ if (!isFinite(clearance)) clearance = 0 ++ if (!isFinite(gap)) gap = 0 ++ ++ return { ++ anchors: { top: true, bottom: false, left: false, right: true }, ++ margins: { ++ top: position === "top" ? clearance : gap, ++ bottom: gap, ++ left: gap, ++ right: position === "right" ? clearance : gap ++ } ++ } ++} ++ ++// The archived files are the history. They are read back exactly like the ++// live popup files, then normalized into history rows: replaying a toast ++// must not inherit the original's expire timeout or restore deadline, so it ++// gets the standard on-screen lifetime for its urgency instead. ++// ++// liveRows are the toasts still on screen when the replay was asked for. ++// They belong in it — they're the newest notifications there are — but the ++// directory read races their archival, so they're carried across by hand and ++// keyed by file name (timestamp + id) to drop the copy the read already saw. ++function historyRows(raw, liveRows, normalUrgency, limit) { ++ var max = limit === undefined || limit === null ? 10 : Number(limit) ++ if (isNaN(max)) max = 10 ++ max = Math.max(0, max) ++ ++ var out = [] ++ var seen = {} ++ function collect(rows) { ++ for (var i = 0; i < rows.length; i++) { ++ var entry = rows[i] ++ if (!entry) continue ++ var key = popupFileName(entry) ++ if (seen[key]) continue ++ seen[key] = true ++ out.push(historyEntry(entry, normalUrgency)) ++ } ++ } ++ ++ collect(Array.isArray(liveRows) ? liveRows : []) ++ collect(parsePopupFiles(raw, normalUrgency)) ++ out.sort(function(a, b) { return (b.timestamp || 0) - (a.timestamp || 0) }) ++ return out.slice(0, max) ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { ++ isChromiumDerived: isChromiumDerived, ++ sanitizeBody: sanitizeBody, ++ styledBody: styledBody, ++ summaryStartsWithGlyph: summaryStartsWithGlyph, ++ shouldBypassDnd: shouldBypassDnd, ++ isEphemeralApp: isEphemeralApp, ++ stringHint: stringHint, ++ glyphFromHints: glyphFromHints, ++ execArgvFromHints: execArgvFromHints, ++ parseExecArgv: parseExecArgv, ++ shouldRenderCompactGlyph: shouldRenderCompactGlyph, ++ snapshotOf: snapshotOf, ++ popupRoles: popupRoles, ++ popupRowChanged: popupRowChanged, ++ replacementSnapshot: replacementSnapshot, ++ historyEntry: historyEntry, ++ parseSettings: parseSettings, ++ historyRows: historyRows, ++ popupEntry: popupEntry, ++ popupFileName: popupFileName, ++ imageStem: imageStem, ++ localImageFile: localImageFile, ++ persistablePopup: persistablePopup, ++ serializePopup: serializePopup, ++ parsePopupFiles: parsePopupFiles, ++ popupExpired: popupExpired, ++ popupPlacement: popupPlacement ++ } ++} +--- /dev/null +++ w/shell/plugins/notifications/components/NotificationCard.qml -@@ -27,6 +27,11 @@ - property int urgency: 1 - property double timestamp: 0 - property int cornerRadius: 0 +@@ -0,0 +1,443 @@ ++// SPDX-License-Identifier: MIT ++// Retained licensed4.0.6 compatibility component; not the4.5 daemon. ++// Copyright (c) David Heinemeier Hansson ++// ++// Permission is hereby granted, free of charge, to any person obtaining ++// a copy of this software and associated documentation files (the ++// "Software"), to deal in the Software without restriction, including ++// without limitation the rights to use, copy, modify, merge, publish, ++// distribute, sublicense, and/or sell copies of the Software, and to ++// permit persons to whom the Software is furnished to do so, subject to ++// the following conditions: ++// ++// The above copyright notice and this permission notice shall be ++// included in all copies or substantial portions of the Software. ++// ++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ++// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION ++// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++// Mobile touch changes: Copyright (c) 2026 Derek Ross ++// Notification card. Pure presentational — no service, Notification, or ++// ListModel references. The popup container drives lifetime; the history ++// panel drives static rendering. Both use the same component. ++ ++import QtQuick ++import QtQuick.Layouts ++import Quickshell ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++import "../NotificationLogic.js" as NotificationLogic ++ ++BorderSurface { ++ id: root ++ ++ property string app: "" ++ property string appIcon: "" ++ property string summary: "" ++ property string body: "" ++ property string image: "" ++ // Nerd Font glyph rendered in the icon slot when no real icon is set. ++ // Used by omarchy-notification-send so user-action toasts (`Silenced ++ // notifications` etc.) show their bell/lock/etc. glyph without leaking ++ // into the summary text. ++ property string glyph: "" ++ // NotificationUrgency: Low=0, Normal=1, Critical=2 (upstream). ++ property int urgency: 1 ++ property double timestamp: 0 ++ property int cornerRadius: 0 + // A static summary (a phone's lock screen) keeps each card short, and + // says beside the summary how many there are and how old ("2 new, 5m"). + property int summaryLines: 2 + property int bodyLines: 3 + property string detail: "" - - // System monospace font injected by the container. - property string fontFamily: "" -@@ -300,7 +305,7 @@ - font.bold: true - wrapMode: Text.WordWrap - elide: Text.ElideRight -- maximumLineCount: 2 ++ ++ // System monospace font injected by the container. ++ property string fontFamily: "" ++ ++ readonly property bool hovered: hoverTracker.hovered ++ // The card is under the user's hand: a mouse over it, or a finger ++ // swiping it. The popup container pauses the countdown meanwhile. ++ readonly property bool held: hovered || swipeHandler.active ++ ++ // Touch: a horizontal swipe dismisses (swipeEnabled), and a close button ++ // shows in the top-right corner (closeButtonShown), as a tap runs the ++ // default action and a touch screen has no right button. The container ++ // shows the button when the seat has a touch screen, so a mouse-only ++ // desktop looks and behaves as before. ++ property bool swipeEnabled: true ++ property bool closeButtonShown: false ++ // How far the card has been swiped sideways, in pixels. ++ property real swipeOffset: 0 ++ // Release speed of the last swipe, pixels per second. ++ property real swipeVelocity: 0 ++ property bool dismissing: false ++ ++ // Inline reply (the freedesktop `inline-reply` action): the popup container ++ // sets the sender's placeholder text while the live notification takes a ++ // reply. The history panel leaves it empty: a stored notification can't be ++ // answered. ++ property string replyPlaceholder: "" ++ // The reply field is open. The container keeps the toast on screen and ++ // gives its surface keyboard focus meanwhile. ++ property bool replying: false ++ ++ signal closeRequested() ++ signal cardClicked() ++ signal replyRequested() ++ signal replySent(string text) ++ signal replyCancelled() ++ ++ function sendReply() { ++ var text = replyField.text ++ if (text.trim().length === 0) return ++ root.replySent(text) ++ } ++ ++ // A field that opens gets focus, so an on-screen keyboard shows; one that ++ // closes forgets what was typed. ++ onReplyingChanged: { ++ if (replying) Qt.callLater(function() { replyField.forceActiveFocus() }) ++ else replyField.text = "" ++ } ++ // Prefer per-notification media/avatar data, then fall back to the app icon. ++ // The `check` flag avoids Qt's missing-texture placeholder for unknown names. ++ readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) ++ readonly property bool hasGlyph: glyph.length > 0 ++ readonly property bool compactGlyph: NotificationLogic.shouldRenderCompactGlyph(glyph, smallIconSource, singleLineToast) ++ readonly property bool hasSmallIcon: smallIconSource.length > 0 ++ readonly property bool summaryStartsWithGlyph: NotificationLogic.summaryStartsWithGlyph(summary) ++ readonly property bool singleLineToast: sanitizedBody.length === 0 ++ readonly property bool collapseRedundantIcon: singleLineToast && !hasGlyph && summaryStartsWithGlyph ++ readonly property string sanitizedBody: sanitizeBody(body) ++ readonly property string styledBody: NotificationLogic.styledBody(body, app, appIcon) ++ ++ readonly property color dimColor: Qt.darker(Commons.Color.notifications.text, 1.4) ++ readonly property color bodyColor: Qt.darker(Commons.Color.notifications.text, 1.15) ++ readonly property color accentColor: urgency === 2 ? Commons.Color.urgent : (urgency === 0 ? dimColor : Commons.Color.notifications.countdown) ++ readonly property var cardBorderSpec: Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) ++ ++ // A swipe ends: past 35% of the width, or flicked fast enough the same ++ // way, the card flies off that side and closes; otherwise it springs back. ++ function finishSwipe() { ++ var distance = Math.abs(root.swipeOffset) ++ var sameWay = root.swipeVelocity * root.swipeOffset > 0 ++ var flung = sameWay && Math.abs(root.swipeVelocity) >= Style.space(900) && distance >= root.width * 0.1 ++ if (root.width > 0 && (distance >= root.width * 0.35 || flung)) { ++ root.dismissing = true ++ swipeAnimation.to = (root.swipeOffset < 0 ? -1 : 1) * (root.width + Style.space(24)) ++ swipeAnimation.dismiss = true ++ } else { ++ swipeAnimation.to = 0 ++ swipeAnimation.dismiss = false ++ } ++ swipeAnimation.restart() ++ } ++ ++ function sanitizeBody(s) { ++ return NotificationLogic.sanitizeBody(s, app, appIcon) ++ } ++ ++ function iconSource(icon) { ++ var value = String(icon || "") ++ if (value.length === 0) return "" ++ if (value.indexOf("file://") === 0 || value.indexOf("image://") === 0) return value ++ if (value.charAt(0) === "/") return Util.fileUrl(value) ++ return Quickshell.iconPath(value, true) ++ } ++ ++ implicitWidth: Style.space(380) ++ // Add vertical border insets so mainColumn (inset by border on top/left/right) ++ // doesn't push content under the bottom edge. ++ implicitHeight: Math.max(mainColumn.implicitHeight, closeButtonShown ? closeButton.height : 0) + borderTop + borderBottom ++ radius: cornerRadius ++ color: Commons.Color.notifications.background ++ borderSpec: cardBorderSpec ++ clip: true ++ ++ // The swipe moves the card sideways and fades it as it goes. ++ transform: Translate { x: root.swipeOffset } ++ opacity: 1 - 0.6 * Math.min(1, Math.abs(root.swipeOffset) / Math.max(1, root.width)) ++ ++ // A mouse or stylus resting on the card pauses its countdown. A finger ++ // doesn't hover, so touch is left out: a toast that was touched must not ++ // count as hovered and stop expiring. ++ HoverHandler { ++ id: hoverTracker ++ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus ++ } ++ ++ MouseArea { ++ anchors.fill: parent ++ cursorShape: Qt.PointingHandCursor ++ acceptedButtons: Qt.LeftButton | Qt.RightButton ++ onClicked: function(mouse) { ++ if (mouse.button === Qt.RightButton) { ++ root.closeRequested() ++ } else if (!root.replying) { ++ // A tap beside the open reply field must not open the app and ++ // throw the reply away. ++ root.cardClicked() ++ } ++ } ++ } ++ ++ // Swipe to dismiss. Only sideways movement past the threshold starts it, ++ // so a tap still runs the default action and a right-click still closes. ++ // Off while a reply is being typed, so selecting text can't throw the ++ // reply away. ++ DragHandler { ++ id: swipeHandler ++ target: null ++ yAxis.enabled: false ++ dragThreshold: Style.space(12) ++ enabled: root.swipeEnabled && !root.replying && !root.dismissing ++ onActiveChanged: { ++ if (active) { ++ swipeAnimation.stop() ++ root.swipeVelocity = 0 ++ } else { ++ root.finishSwipe() ++ } ++ } ++ onActiveTranslationChanged: { ++ if (!active) return ++ root.swipeOffset = activeTranslation.x ++ root.swipeVelocity = centroid.velocity.x ++ } ++ } ++ ++ SequentialAnimation { ++ id: swipeAnimation ++ property real to: 0 ++ property bool dismiss: false ++ NumberAnimation { ++ target: root ++ property: "swipeOffset" ++ to: swipeAnimation.to ++ duration: swipeAnimation.dismiss ? 140 : 200 ++ easing.type: swipeAnimation.dismiss ? Easing.InQuad : Easing.OutBack ++ } ++ ScriptAction { ++ script: { ++ if (!swipeAnimation.dismiss) return ++ root.closeRequested() ++ // A container that keeps the card (nothing removes it) gets it back. ++ swipeResetTimer.restart() ++ } ++ } ++ } ++ ++ Timer { ++ id: swipeResetTimer ++ interval: 400 ++ onTriggered: { ++ root.dismissing = false ++ root.swipeOffset = 0 ++ } ++ } ++ ++ ColumnLayout { ++ id: mainColumn ++ // Inset by the card border so the content doesn't paint over the card's ++ // outer border. ++ anchors.top: parent.top ++ anchors.left: parent.left ++ anchors.right: parent.right ++ anchors.topMargin: root.borderTop ++ anchors.leftMargin: root.borderLeft ++ anchors.rightMargin: root.borderRight ++ spacing: 0 ++ ++ // Text content. ++ RowLayout { ++ Layout.fillWidth: true ++ Layout.leftMargin: Style.space(12) ++ // Text stays clear of the close button's touch target. ++ Layout.rightMargin: root.closeButtonShown ? closeButton.width : Style.space(12) ++ Layout.topMargin: root.singleLineToast ? Style.space(7) : Style.space(10) ++ Layout.bottomMargin: root.singleLineToast ? Style.space(7) : Style.space(10) ++ spacing: root.collapseRedundantIcon ? 0 : (root.compactGlyph ? Style.space(8) : Style.space(12)) ++ ++ Item { ++ id: smallIconSlot ++ Layout.preferredWidth: visible ? Style.space(40) : 0 ++ Layout.preferredHeight: visible ? Style.space(40) : 0 ++ Layout.alignment: Qt.AlignVCenter ++ // Hide the slot when the icon failed to resolve (themed-icon name ++ // not in the user's icon theme) AND we don't have a glyph fallback ++ // — prevents rendering Qt's pink broken-image placeholder. ++ visible: !root.collapseRedundantIcon && !root.compactGlyph && (root.hasSmallIcon || root.hasGlyph) && (root.hasGlyph || smallIconImage.status !== Image.Error) ++ ++ Image { ++ id: smallIconImage ++ anchors.fill: parent ++ source: root.smallIconSource ++ sourceSize.width: smallIconSlot.width * Screen.devicePixelRatio ++ sourceSize.height: smallIconSlot.height * Screen.devicePixelRatio ++ fillMode: Image.PreserveAspectFit ++ asynchronous: true ++ smooth: true ++ visible: !root.hasGlyph || smallIconImage.status === Image.Ready ++ } ++ ++ // Glyph fallback (Nerd Font character) when no image icon is ++ // available. Used by omarchy-notification-send's `-g` flag. ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ visible: root.hasGlyph && smallIconImage.status !== Image.Ready ++ text: root.glyph ++ color: Commons.Color.notifications.text ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.displayLarge ++ } ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ Layout.alignment: Qt.AlignVCenter ++ visible: root.compactGlyph ++ text: root.glyph ++ color: Commons.Color.notifications.text ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.icon ++ } ++ ++ ColumnLayout { ++ Layout.fillWidth: true ++ Layout.alignment: Qt.AlignVCenter ++ spacing: Style.space(2) ++ ++ Text { ++ // The spec defines the summary as a single line of plain text, so ++ // AutoText could only ever promote a hostile string to rich text. ++ // The body below is StyledText on purpose — see Service.qml's ++ // bodyMarkupSupported — and is stripped in NotificationLogic. ++ textFormat: Text.PlainText ++ Layout.fillWidth: true ++ visible: root.summary.length > 0 ++ text: root.summary ++ font.family: "Liberation Sans" ++ color: Commons.Color.notifications.text ++ font.pixelSize: Style.font.title ++ font.bold: true ++ wrapMode: Text.WordWrap ++ elide: Text.ElideRight + maximumLineCount: root.summaryLines - } - - Text { -@@ -314,9 +319,19 @@ - font.pixelSize: Style.font.title - wrapMode: Text.WordWrap - elide: Text.ElideRight -- maximumLineCount: 3 ++ } ++ ++ Text { ++ Layout.fillWidth: true ++ Layout.topMargin: Style.space(2) ++ visible: root.sanitizedBody.length > 0 ++ text: root.styledBody ++ textFormat: Text.StyledText ++ font.family: "Liberation Sans" ++ color: root.bodyColor ++ font.pixelSize: Style.font.title ++ wrapMode: Text.WordWrap ++ elide: Text.ElideRight + maximumLineCount: root.bodyLines - } - } ++ } ++ } + + Text { + textFormat: Text.PlainText @@ -1053,6 +1879,89 @@ diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell + font.family: root.fontFamily + font.pixelSize: Style.font.bodySmall + } - } - - // Reply, then a field with Send and Cancel, each tall enough to tap on ++ } ++ ++ // Reply, then a field with Send and Cancel, each tall enough to tap on ++ // a touch screen. ++ RowLayout { ++ id: replyRow ++ readonly property real controlHeight: Style.space(40) ++ Layout.fillWidth: true ++ Layout.leftMargin: Style.space(12) ++ Layout.rightMargin: Style.space(12) ++ Layout.bottomMargin: Style.space(10) ++ visible: root.replyPlaceholder.length > 0 ++ spacing: Style.space(8) ++ ++ TextField { ++ id: replyField ++ objectName: "notificationReplyField" ++ Layout.fillWidth: true ++ visible: root.replying ++ Layout.preferredHeight: replyRow.controlHeight ++ placeholderText: root.replyPlaceholder ++ foreground: Commons.Color.notifications.text ++ onAccepted: root.sendReply() ++ Keys.onEscapePressed: root.replyCancelled() ++ } ++ ++ Item { ++ Layout.fillWidth: true ++ visible: !root.replying ++ } ++ ++ Button { ++ visible: root.replying ++ text: "Cancel" ++ Layout.preferredHeight: replyRow.controlHeight ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replyCancelled() ++ } ++ ++ Button { ++ objectName: "notificationReplyButton" ++ Layout.preferredHeight: replyRow.controlHeight ++ text: root.replying ? "Send" : "Reply" ++ bordered: true ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replying ? root.sendReply() : root.replyRequested() ++ } ++ } ++ } ++ ++ // Close button: a small glyph with a 44 px touch target in the top-right ++ // corner, inside the border. ++ MouseArea { ++ id: closeButton ++ objectName: "notificationCloseButton" ++ visible: root.closeButtonShown ++ anchors.top: parent.top ++ anchors.right: parent.right ++ anchors.topMargin: root.borderTop ++ anchors.rightMargin: root.borderRight ++ width: Style.space(44) ++ height: Style.space(44) ++ cursorShape: Qt.PointingHandCursor ++ Accessible.role: Accessible.Button ++ Accessible.name: "Dismiss notification" ++ onClicked: root.closeRequested() ++ ++ Rectangle { ++ anchors.centerIn: parent ++ width: Style.space(28) ++ height: width ++ radius: width / 2 ++ color: Commons.Color.notifications.text ++ opacity: closeButton.pressed ? 0.18 : 0 ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ text: "󰅖" ++ color: root.dimColor ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.icon ++ } ++ } ++} diff --git a/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch b/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch index f8ad213c4..47271c088 100644 --- a/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch +++ b/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch @@ -5,10 +5,13 @@ # screen at 64 logical (192 physical) pixels. An SVG or a "scalable" path # still wins over any size; then the larger NxN directory (@Nx scaled). # Candidate for upstream Omarchy. +# +# Omarchy 4.5: Retain the largest app-icon choice with the current icon scanner. + diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml --- i/shell/services/AppLibrary.qml +++ w/shell/services/AppLibrary.qml -@@ -136,6 +136,17 @@ +@@ -151,6 +151,17 @@ ].join(' ') } @@ -26,7 +29,7 @@ diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml function indexIconLine(path) { var value = String(path || "").trim() if (value.length === 0) return -@@ -143,7 +154,9 @@ +@@ -158,7 +169,9 @@ var file = slash >= 0 ? value.slice(slash + 1) : value var dot = file.lastIndexOf(".") var name = dot > 0 ? file.slice(0, dot) : file diff --git a/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch b/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch index faabb29e4..33d0a73ac 100644 --- a/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch +++ b/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch @@ -1,19 +1,21 @@ +# SPDX-License-Identifier: MIT # App launch: no "Launching ..." toast for a desktop entry that runs # omarchy-shell. Such an entry opens a shell surface (on the phone the # Updates entry summons the update sheet), never a toplevel, so the toast # waited for a window that never came and sat over the sheet's buttons # until its timeout. Every other launch keeps the toast. Candidate for # upstream Omarchy. +# +# Omarchy 4.5: Suppress the launch toast for shell surfaces while retaining terminal-app +# launch routing. + diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml --- i/shell/services/AppLibrary.qml +++ w/shell/services/AppLibrary.qml -@@ -74,10 +74,19 @@ +@@ -74,10 +74,16 @@ if (!iconIndexScan.running) iconIndexScan.running = true } -+ // An entry that runs omarchy-shell opens a shell surface (a panel or a -+ // sheet), never a window, so the launch toast would wait for a toplevel -+ // that doesn't come and cover the surface until it times out. + function launchesShellSurface(id) { + var entry = DesktopEntries.byId(id) + var command = entry && entry.command ? entry.command : [] @@ -25,6 +27,6 @@ diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml if (!id) return - root.beginLaunchFeedback(name) + if (!root.launchesShellSurface(id)) root.beginLaunchFeedback(name) - // Start gtk-launch inside a scope under app-graphical.slice so apps do not - // inherit wayland-wm@.service. Keeping gtk-launch as the desktop-entry - // resolver supports IDs with spaces and entries that UWSM rejects. + // A terminal app goes through Omarchy's TUI launcher, which names its + // terminal window after the command (org.omarchy.nvim), so the dock and + // titlebars can tell Neovim from the terminal it runs in. diff --git a/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch b/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch index daae350e2..5524af094 100644 --- a/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch +++ b/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch @@ -23,6 +23,9 @@ # goes dark so a wake never paints a stale one before its own reading. # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0023. +# +# Omarchy 4.5: Retain bounded local battery status with the current lock. + diff --git i/shell/plugins/lock/LockBattery.js w/shell/plugins/lock/LockBattery.js new file mode 100644 --- /dev/null @@ -219,7 +222,7 @@ new file mode 100644 diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -437,5 +437,16 @@ Item { +@@ -497,5 +497,16 @@ lock: root pinTop: root.keypadClearsSensor ? keypadHint.y : inputField.y } diff --git a/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch b/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch index 44f47da71..075847482 100644 --- a/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch +++ b/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch @@ -28,6 +28,9 @@ # while it is dark. On a computer (keypad off) nothing shows. # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0023 and 0026. +# +# Omarchy 4.5: local transport-only media controls. + diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml --- i/shell/plugins/lock/LockGlance.qml +++ w/shell/plugins/lock/LockGlance.qml diff --git a/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch b/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch index 00119b92d..bf63f2884 100644 --- a/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch +++ b/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch @@ -11,6 +11,9 @@ # for upstream Omarchy. # # Against Omarchy 4.0.6 (4.0.6-1). +# +# Omarchy 4.5: mobile narrow terminal logo sizing. + diff --git i/bin/omarchy-show-logo w/bin/omarchy-show-logo --- i/bin/omarchy-show-logo +++ w/bin/omarchy-show-logo diff --git a/packages/omamobile-omarchy/test/all b/packages/omamobile-omarchy/test/all index dbd0f43c8..683b518b9 100755 --- a/packages/omamobile-omarchy/test/all +++ b/packages/omamobile-omarchy/test/all @@ -71,13 +71,17 @@ done pass "every patch has a header" python3 -B test/patches.py || fail "re-patch tool" +python3 -I test/sleep-lock-family.py || fail "sleep-lock source family" # The lock's PAM file (lib/lock-pam), and against the real omarchy-apply-lock # when the package is at hand, found as test/patches.py finds it. pkg=${OMARCHY_PKG:-$(ls ~/.cache/omamobile-rootfs/pkg/omarchy-[0-9]*-aarch64.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | sort | tail -1 || true)} if [[ -n $pkg ]] && command -v bsdtar >/dev/null; then mkdir -p "$t/omarchy-pkg" - bsdtar -xf "$pkg" -C "$t/omarchy-pkg" usr/bin/omarchy-apply-lock usr/share/omarchy/bin/omarchy-system-sleep-lock + bsdtar -xf "$pkg" -C "$t/omarchy-pkg" .PKGINFO usr/bin/omarchy-apply-lock usr/bin/omarchy-system-sleep-lock + # The packaged source alias is absolute /usr/bin. Normalize this one test + # input inside the fake root; never follow it into the host's installed tree. + install -Dm755 "$t/omarchy-pkg/usr/bin/omarchy-system-sleep-lock" "$t/omarchy-pkg/usr/share/omarchy/bin/omarchy-system-sleep-lock" OMARCHY_PKG_ROOT=$t/omarchy-pkg bash test/lock-pam.sh || fail "lock-pam" # Patch 0021 run against the real sleep lock, with fakes. OMARCHY_PKG_ROOT=$t/omarchy-pkg bash test/sleep-lock.sh || fail "sleep-lock" @@ -90,6 +94,7 @@ fi || fail "install and upgrade write the lock's PAM file" pass "install and upgrade write the lock's PAM file when it is missing" bash test/update.sh || fail "omamobile-update" +python3 -I test/migration-mobile-holds.py || fail "mobile migration holds" # Patch 0015 end to end (inline reply on a private bus), in the OWL # conformance container, when asked: OMAMOBILE_NOTIFY_TEST=1. @@ -101,4 +106,4 @@ if [[ -n ${OMAMOBILE_NOTIFY_TEST:-} ]]; then pass "inline reply end to end" fi -python3 -I test/migration-mobile-holds.py || fail "mobile-critical migration holds" +python3 -I test/source-family.py || fail "source-family selection" diff --git a/packages/omamobile-omarchy/test/lock-glance b/packages/omamobile-omarchy/test/lock-glance index e44a7b19f..21f934fac 100755 --- a/packages/omamobile-omarchy/test/lock-glance +++ b/packages/omamobile-omarchy/test/lock-glance @@ -18,11 +18,16 @@ trap 'rm -rf "$work"' EXIT mkdir -p "$work/qs" "$work/plugins" "$work/home/.local/state/omarchy/toggles" \ "$work/home/.local/state/omamobile" "$work/home/.config/omarchy" cp -r "$shell/Commons" "$shell/Ui" "$work/qs/" +mkdir -p "$work/home/omarchy/default" +[[ ! -d $shell/../default/i18n ]] || cp -r "$shell/../default/i18n" "$work/home/omarchy/default/" cp -r "$shell/plugins/lock" "$shell/plugins/notifications" "$work/plugins/" # Omarchy's media service's model, which the lock's media controls (0027) use. mkdir -p "$work/plugins/services" cp -r "$shell/plugins/services/media" "$work/plugins/services/" cp "$here/lock-glance.qml" "$work/tst_lock_glance.qml" +if ! grep -q "notifications/quiet.json" "$shell/plugins/lock/LockGlance.qml"; then + sed -i "s|notifications/quiet.json|notifications.json|g" "$work/tst_lock_glance.qml" +fi printf '.pragma library\nvar HOME = "%s"\n' "$work/home" > "$work/TestEnv.js" export QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software QML_DISABLE_DISK_CACHE=1 diff --git a/packages/omamobile-omarchy/test/lock-glance.qml b/packages/omamobile-omarchy/test/lock-glance.qml index 12684747e..683da3245 100644 --- a/packages/omamobile-omarchy/test/lock-glance.qml +++ b/packages/omamobile-omarchy/test/lock-glance.qml @@ -166,7 +166,7 @@ Item { harness.supplies = "Battery\t1\t87\tDischarging\t\nUSB\t\t\tCharging\t1\n" harness.suppliesHang = false Mpris.players.values = [] - Quickshell.vars = { HOME: harness.home } + Quickshell.vars = { HOME: harness.home, OMARCHY_PATH: harness.home + "/omarchy" } Quickshell.started = [] Quickshell.responder = function(argv) { var cmd = argv.join(" ") @@ -184,7 +184,7 @@ Item { return cmd.indexOf("/.local/state/omarchy/notifications/") >= 0 ? harness.notificationsRaw : null } writeFile(".local/state/omarchy/toggles/lock-hide-notification-text", "") - writeFile(".local/state/omarchy/notifications.json", "") + writeFile(".local/state/omarchy/notifications/quiet.json", "") writeFile(".local/state/omamobile/weather.json", "") writeFile(".config/omarchy/shell.json", "") writeFile(".local/state/omarchy/toggles/credential-password", "") @@ -577,12 +577,12 @@ Item { entry("omarchy-action", 3 * minute, 2, "Theme changed", ""), entry("notify-send", 4 * minute, 3, "Ping", "") ].join("\n") + "\n" - writeFile(".local/state/omarchy/notifications.json", '{"version": 3, "dnd": true}\n') + writeFile(".local/state/omarchy/notifications/quiet.json", '{"version": 3, "dnd": true}\n') show() var cards = byName("lockGlanceCard").filter(function(c) { return c.visible }) compare(cards.length, 1) compare(cards[0].summary, "Theme changed") - writeFile(".local/state/omarchy/notifications.json", '{"version": 3, "dnd": false}\n') + writeFile(".local/state/omarchy/notifications/quiet.json", '{"version": 3, "dnd": false}\n') settle() compare(byName("lockGlanceCard").filter(function(c) { return c.visible }).length, 3) compare(glance().cards[2].app, "Notifications", "a bare notify-send goes by Notifications") diff --git a/packages/omamobile-omarchy/test/mobile-pam-preserve.py b/packages/omamobile-omarchy/test/mobile-pam-preserve.py new file mode 100644 index 000000000..f8df9a872 --- /dev/null +++ b/packages/omamobile-omarchy/test/mobile-pam-preserve.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Run the real PAM-preservation branch with isolated paths and fake UID metadata. + +No PAM, service or privilege helper is invoked. Modes, symlinks and hashes use +real temporary files. +""" +import hashlib +import os +from pathlib import Path +import subprocess +import sys +import tempfile + +source = Path(sys.argv[1]).read_text() +start = source.index('# Mobile owns its existing PAM policy') +end = source.index('echo "Configuring lock screen password authentication..."', start) +guard = source[start:end] + +with tempfile.TemporaryDirectory() as temporary: + root = Path(temporary) + helper = root / 'mobile-update' + helper.write_text('#!/bin/sh\nexit 0\n') + helper.chmod(0o755) + policy = root / 'password' + policy.write_text('synthetic customized password PAM\n') + policy.chmod(0o644) + fingerprint = root / 'fingerprint' + fingerprint.write_text('synthetic fingerprint max-tries=1\n') + fingerprint.chmod(0o644) + + def hashes(): + return [hashlib.sha256(path.read_bytes()).hexdigest() for path in (policy, fingerprint)] + + baseline = hashes() + isolated_guard = guard.replace('/usr/bin/omamobile-update', str(helper)) + isolated_guard = isolated_guard.replace('/etc/pam.d/omarchy-lock-password', str(policy)) + script = 'set -eu\nstat() { echo "$FAKE_UID"; }\n' + isolated_guard + '\nexit 77\n' + + def run(uid='0'): + return subprocess.run( + ['bash', '-c', script], env=dict(os.environ, FAKE_UID=uid), + capture_output=True, text=True, + ) + + assert run().returncode == 0 + assert hashes() == baseline + assert run('1000').returncode == 1 + policy.chmod(0o666) + assert run().returncode == 1 + policy.chmod(0o644) + original = root / 'saved' + policy.rename(original) + policy.symlink_to(original) + assert run().returncode == 1 + policy.unlink() + assert run().returncode == 77, 'absent policy permits fresh setup' + +print('PASS actual PAM guard: secure policy unchanged; unsafe metadata refused; absent policy permits setup; no privileged commands') diff --git a/packages/omamobile-omarchy/test/notification-store45.cjs b/packages/omamobile-omarchy/test/notification-store45.cjs new file mode 100644 index 000000000..13b40e539 --- /dev/null +++ b/packages/omamobile-omarchy/test/notification-store45.cjs @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT +const fs = require('fs') +const vm = require('vm') +const assert = require('assert/strict') +const path = require('path') + +const root = process.argv[2] +assert(root, 'usage: node notification-store45.cjs SHELL') + +function load(file, extras = {}) { + const scope = { module: { exports: {} }, ...extras } + vm.createContext(scope) + const source = fs.readFileSync(file, 'utf8').replace(/^\.(?:pragma|import).*$/mg, '') + vm.runInContext(source, scope) + return scope +} + +const logic = load(path.join(root, 'plugins/notifications/NotificationLogic.js')).module.exports +const glance = load(path.join(root, 'plugins/lock/LockGlance.js'), { NotificationLogic: logic, Date }) +const now = Date.now() +const notification = { + key: 'nSynthetic1', ts: now / 1000, originalId: 1, app: 'Fixture', + summary: 'Synthetic summary', body: 'Synthetic body', + image: 'file:///tmp/synthetic.png', urgency: 1, +} +const history = [ + { ...notification, summary: 'older copy', ts: notification.ts - 1 }, + { ...notification, key: 'nSynthetic2', originalId: 2, ts: notification.ts - 2 }, +] +const raw = JSON.stringify([notification]) + '\n' + JSON.stringify(history) + '\n' + JSON.stringify({ dnd: false }) +const rows = logic.historyRows(raw, [], 1, 10) +assert.equal(rows.length, 2) +assert.equal(rows[0].key, 'nSynthetic1') +assert.equal(rows[0].timestamp, now) +assert.equal(logic.popupFileName(rows[0]), 'nSynthetic1') +assert.equal(rows[0].summary, notification.summary) +assert.equal(glance.cards(raw, now, false, false).length, 2) + +const hidden = glance.cards(raw, now, true, false)[0] +assert.equal(hidden.summary, 'Fixture') +assert.equal(hidden.body, 'Unlock to read') +assert.equal(hidden.image, '') +assert.equal(hidden.file, 'nSynthetic1') +assert.equal(glance.cards(raw, now, false, true).length, 0) +assert.equal(glance.doNotDisturb('{"dnd":true}'), true) +assert.equal(logic.historyRows(JSON.stringify([{ ...notification, key: '../bad' }]), [], 1, 10).length, 0) +assert.equal(logic.historyRows(JSON.stringify([{ ...notification, ts: 'bad' }]), [], 1, 10).length, 0) +assert.equal(logic.historyRows('{"dnd":true}\n', [], 1, 10).length, 0) + +const legacy = { originalId: 8, timestamp: now, app: 'Fixture', summary: 'Legacy synthetic' } +const legacyRow = logic.historyRows(JSON.stringify(legacy) + '\n', [], 1, 10)[0] +assert.equal(logic.popupFileName(legacyRow), String(now) + '-8.json') +console.log('PASS 4.5 store/lock-glance: merge, dedupe, timestamp, privacy/DND, malformed rows and legacy records') diff --git a/packages/omamobile-omarchy/test/patches.py b/packages/omamobile-omarchy/test/patches.py index 6e49f4349..3723976d1 100755 --- a/packages/omamobile-omarchy/test/patches.py +++ b/packages/omamobile-omarchy/test/patches.py @@ -321,6 +321,7 @@ def real_package(t): subprocess.run(["bsdtar", "-xf", pkg, "-C", ex], check=True) info = dict(l.split(" = ", 1) for l in open(os.path.join(ex, ".PKGINFO")).read().splitlines() if " = " in l) version = info["pkgver"] + selected_series = os.path.join(PKG, "legacy-4.0.6") if version.startswith("4.0.6-") else SERIES def make_root(name, mtree_from): root = os.path.join(t, name) @@ -334,11 +335,16 @@ def make_root(name, mtree_from): shutil.copy(mtree_from, os.path.join(entry, "mtree")) return root, entry + if version.startswith("4.5.0-"): + import port45 + port45.actual(t, ex, version, make_root, run, ok, read, selected_series, PKG, qml_parse) + return + root, _ = make_root("real", os.path.join(ex, ".MTREE")) - rc, out = run(root, "apply", series=SERIES) + rc, out = run(root, "apply", series=selected_series) ok(rc == 0, "real omarchy %s: the shipped series applies (%s)" % (version, out.strip().splitlines()[-1])) status = json.load(open(os.path.join(root, STATE, "status.json"))) - ok(not status["upstream"] and len(status["applied"]) == len(glob.glob(os.path.join(SERIES, "*.patch"))), + ok(not status["upstream"] and len(status["applied"]) == len(glob.glob(os.path.join(selected_series, "*.patch"))), "real omarchy %s: every patch applied, none upstream" % version) ok("omamobile-update" in read(root, "usr/bin/omarchy-update"), "real omarchy: omarchy-update hands over (0012)") ok(os.path.isfile(os.path.join(root, "usr/share/omarchy/shell/plugins/lock/Keypad.qml")), "real omarchy: the lock's keypad is there (0003)") @@ -382,7 +388,7 @@ def make_root(name, mtree_from): ok("(event.key === Qt.Key_Backspace || event.key === Qt.Key_Left) && !root.filterText) {\n root.goBack()" in menu, "real omarchy: Backspace and Left still go back (0018)") ok("property bool cardSettled: false" in menu, "real omarchy: the menu-first-frame bridge applies after 0018") - qml_parse(root) + qml_parse(root, selected_series) lock_glance(root) lock_battery(t, root) lock_media(root) @@ -404,7 +410,7 @@ def make_root(name, mtree_from): notification_phrasing(t, os.path.join(root, "usr/bin/omarchy-notification-send"), os.path.join(ex, "usr/bin/omarchy-notification-send")) lock_fingerprint_probe(t, root) - rc, out = run(root, "apply", series=SERIES) + rc, out = run(root, "apply", series=selected_series) ok(rc == 0 and "already applied" in out, "real omarchy: already applied") rc, _ = run(root, "verify") ok(rc == 0, "real omarchy: verify") @@ -418,7 +424,7 @@ def touches_no_links(path): names = [l[6:].split("\t")[0].rstrip("\n") for l in open(path) if l.startswith("+++ w/")] return names and not any(os.path.islink(os.path.join(root2, "usr/share/omarchy", n)) for n in names) - patch0000 = next(p for p in sorted(glob.glob(os.path.join(SERIES, "*.patch"))) if touches_no_links(p)) + patch0000 = next(p for p in sorted(glob.glob(os.path.join(selected_series, "*.patch"))) if touches_no_links(p)) p = mod_patch(root2, patch0000) subprocess.run(["patch", "-s", "-p1", "-d", root2, "-i", p], check=True) lines = ["#mtree", "/set type=file uid=0 gid=0 mode=644"] @@ -432,14 +438,14 @@ def touches_no_links(path): lines.append("./%s sha256digest=%s" % (rel, sha(open(full, "rb").read()))) with gzip.open(os.path.join(entry, "mtree"), "wt") as f: f.write("\n".join(lines) + "\n") - rc, out = run(root2, "apply", series=SERIES) + rc, out = run(root2, "apply", series=selected_series) status = json.load(open(os.path.join(root2, STATE, "status.json"))) ok(rc == 0 and status["upstream"] == [os.path.basename(patch0000)], "real omarchy with %s upstream: skipped and reported, the rest applied" % os.path.basename(patch0000)) - ok(len(status["applied"]) == len(glob.glob(os.path.join(SERIES, "*.patch"))) - 1, "real omarchy with one patch upstream: the others apply on it") + ok(len(status["applied"]) == len(glob.glob(os.path.join(selected_series, "*.patch"))) - 1, "real omarchy with one patch upstream: the others apply on it") -def qml_parse(root): +def qml_parse(root, series=None): """Every QML file the series touches still parses, when qmlformat is at hand (it reports syntax errors without needing the shell's imports).""" tool = shutil.which("qmlformat") or ("/usr/lib/qt6/bin/qmlformat" if os.path.isfile("/usr/lib/qt6/bin/qmlformat") else "") @@ -447,7 +453,7 @@ def qml_parse(root): print("ok - real omarchy: the patched QML parses # SKIP no qmlformat") return files = set() - for p in glob.glob(os.path.join(SERIES, "*.patch")): + for p in glob.glob(os.path.join(series or SERIES, "*.patch")): for line in open(p): if line.startswith("+++ w/") and line.rstrip().endswith(".qml"): files.add(line[6:].rstrip()) @@ -460,6 +466,10 @@ def app_icons_largest(root): """Patch 0024: the icon index keeps the largest size per name. The patched indexIconLine and iconPathSize run in node against paths in the scan's order (SVGs first, then PNGs in directory order).""" + node = shutil.which("node") + if not node: + print("ok - real omarchy: the largest icon rule # SKIP no node") + return lib = read(root, "usr/share/omarchy/shell/services/AppLibrary.qml") fns = [] for name in ("iconPathSize", "indexIconLine"): @@ -480,7 +490,7 @@ def app_icons_largest(root): "/usr/share/icons/hicolor/64x64/apps/foot.png", "/usr/share/pixmaps/odd.png", "/usr/share/icons/hicolor/24x24/apps/odd.png"] - p = subprocess.run(["node", "-e", js, "--"] + paths, capture_output=True, text=True) + p = subprocess.run([node, "-e", js, "--"] + paths, capture_output=True, text=True) got = json.loads(p.stdout) if p.returncode == 0 and p.stdout.strip() else {} ok(got.get("chromium", "").endswith("/256x256/apps/chromium.png") and got.get("foot", "").endswith("/scalable/apps/foot.svg") diff --git a/packages/omamobile-omarchy/test/port45.py b/packages/omamobile-omarchy/test/port45.py new file mode 100644 index 000000000..a6add4421 --- /dev/null +++ b/packages/omamobile-omarchy/test/port45.py @@ -0,0 +1,115 @@ +# SPDX-License-Identifier: MIT +"""Rehearse the actual 4.5 package without executing its hooks or scripts.""" +import glob +import json +import os +from pathlib import Path +import shutil +import subprocess +import sys + + +def actual(t, ex, version, make_root, run, ok, read, series, package, parse_qml): + root, _ = make_root('real45', os.path.join(ex, '.MTREE')) + for folder in ('patches', 'legacy-4.0.6'): + shutil.copytree( + os.path.join(package, folder), + os.path.join(root, 'usr/share/omamobile/omarchy', folder), + ) + + policy_fixture = Path(root) / 'home/fixture/.config/omarchy/plugins/custom-lock/Policy.qml' + policy_fixture.parent.mkdir(parents=True) + sentinel = 'synthetic external policy fixture\n' + policy_fixture.write_text(sentinel) + auth = 'usr/share/omarchy/shell/services/AuthServiceStore.js' + auth_before = read(root, auth) + + rc, output = run(root, 'apply') + ok(rc == 0, 'real4.5: version-selected runtime series applies to signed aarch64 package') + if rc: + print(output) + return + + pam = subprocess.run( + [sys.executable, os.path.join(package, 'test', 'mobile-pam-preserve.py'), + os.path.join(root, 'usr/bin/omarchy-apply-lock')], + capture_output=True, text=True, + ) + ok(pam.returncode == 0, 'real4.5: actual PAM preservation guard passes isolated behavioral tests') + if pam.returncode: + print(pam.stdout + pam.stderr) + + status_path = Path(root) / 'var/lib/omamobile/omarchy-patches/status.json' + status = json.loads(status_path.read_text()) + count = len(glob.glob(os.path.join(series, '*.patch'))) + ok(len(status['applied']) == count and not status['upstream'], + 'real4.5: every shipped runtime patch applied') + ok(status['series'].endswith('/patches'), 'real4.5: selects the 4.5 family') + ok(policy_fixture.read_text() == sentinel, 'real4.5: external policy fixture untouched') + ok('omamobile-update' in read(root, 'usr/bin/omarchy-update'), + 'real4.5: packaged absolute bin symlink routes updater handoff correctly') + + notifications = 'usr/share/omarchy/shell/plugins/notifications/' + ok('inlineReplySupported: true' in read(root, notifications + 'Service.qml'), + 'real4.5: live-only reply capability present') + toast = read(root, notifications + 'Toast.qml') + ok('card.replyOpen' in toast and 'PointerDevice.TouchScreen' in toast, + 'real4.5: scene toast touch/reply controls present') + ok(os.path.isfile(os.path.join(root, notifications + 'components/NotificationCard.qml')) + and os.path.isfile(os.path.join(root, notifications + 'NotificationLogic.js')), + 'real4.5: lock-glance presentation imports remain compatible') + + lock = 'usr/share/omarchy/shell/plugins/lock/' + ok('notifications/quiet.json' in read(root, lock + 'LockGlance.qml'), + 'real4.5: DND follows the keyed quiet store') + ok('Preserving existing mobile lock PAM' in read(root, 'usr/bin/omarchy-apply-lock'), + 'real4.5: setup preserves existing mobile PAM and recovery hooks') + ok('OverlayWindow {' in read(root, 'usr/share/omarchy/shell/plugins/menu/Menu.qml') + and 'contentReady' in read(root, 'usr/share/omarchy/shell/Ui/OverlayWindow.qml'), + 'real4.5: first-frame bridge replaced by upstream geometry/scale guard') + parse_qml(root, series) + + rc, _ = run(root, 'verify') + ok(rc == 0, 'real4.5: verify patched package state') + rc, output = run(root, 'apply') + ok(rc == 0 and 'already applied' in output, 'real4.5: apply is idempotent') + + env = dict(os.environ) + env['OMARCHY_SHELL_DIR'] = os.path.join(root, 'usr/share/omarchy/shell') + node = shutil.which('node') + node_tests = [ + ('upstream45/notifications/logic.cjs', [], 'actual notification functions'), + ('notification-store45.cjs', [env['OMARCHY_SHELL_DIR']], 'keyed store and lock-glance compatibility'), + ] + for script, arguments, label in node_tests: + if not node: + print(f'ok - real4.5: {label} # SKIP no node') + continue + result = subprocess.run( + [node, os.path.join(package, 'test', script), *arguments], + env=env, capture_output=True, text=True, + ) + ok(result.returncode == 0, f'real4.5: {label}') + if result.returncode: + print(result.stdout + result.stderr) + + # Refuse externally changed package files instead of overwriting them. + lock_service = Path(root) / (lock + 'Service.qml') + patched = lock_service.read_text() + lock_service.write_text(patched + '\n// synthetic external edit\n') + rc, _ = run(root, 'apply') + ok(rc != 0 and lock_service.read_text().endswith('// synthetic external edit\n'), + 'real4.5: external lock edits cause refusal and remain unchanged') + lock_service.write_text(patched) + rc, _ = run(root, 'restore') + ok(rc == 0, 'real4.5: restore original packaged files') + ok(read(root, auth) == auth_before and policy_fixture.read_text() == sentinel, + 'real4.5: restore leaves authentication store and external fixture unchanged') + + # An unsupported future version must not borrow either family's contexts. + future_root, database = make_root('real-unknown', os.path.join(ex, '.MTREE')) + description = Path(database) / 'desc' + description.write_text(description.read_text().replace(version, '4.6.0-1')) + rc, output = run(future_root, 'apply') + ok(rc != 0 and 'no qualified mobile patch series' in output, + 'unknown Omarchy family refuses before patch writes') diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml new file mode 100644 index 000000000..6a7947645 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma Singleton +import QtQuick +QtObject { + property var monitors: ({ values: [] }) + property var focusedMonitor: null + signal rawEvent(var event) + function dispatch(command) {} + function monitorFor(screen) { return null } +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir new file mode 100644 index 000000000..4c43ca833 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir @@ -0,0 +1,2 @@ +module Quickshell.Hyprland +singleton Hyprland 1.0 Hyprland.qml diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml new file mode 100644 index 000000000..bb0e081d0 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT +import QtQuick +QtObject { + property string target: "" + property bool enabled: true + property bool connected: false +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml index 2592f407a..fab7c1020 100644 --- a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml @@ -6,6 +6,8 @@ import Quickshell // the test's responder answers the command, finishes with that output. QtObject { id: proc + property bool stdinEnabled: false + function write(value) {} property var command: [] property bool running: false property var stdout: null diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml new file mode 100644 index 000000000..9129028d3 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +import QtQuick +QtObject { + property string text: "" + property string splitMarker: "\n" + signal read(string data) + signal streamFinished() +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir index 3a532e8e6..0ea290560 100644 --- a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir @@ -2,3 +2,6 @@ module Quickshell.Io Process 1.0 Process.qml StdioCollector 1.0 StdioCollector.qml FileView 1.0 FileView.qml + +SplitParser 1.0 SplitParser.qml +IpcHandler 1.0 IpcHandler.qml diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml new file mode 100644 index 000000000..1e9491f10 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma Singleton +import QtQuick +QtObject { + property var defaultAudioSource: null + property var defaultAudioSink: null + property var nodes: ({values: []}) +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir new file mode 100644 index 000000000..e1875d0dd --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir @@ -0,0 +1,2 @@ +module Quickshell.Services.Pipewire +singleton Pipewire 1.0 Pipewire.qml diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml new file mode 100644 index 000000000..f56839815 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: MIT +import QtQuick +Item {} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir index d4cee017a..a34f15a09 100644 --- a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir @@ -2,3 +2,5 @@ module Quickshell singleton Quickshell 1.0 Quickshell.qml SystemClock 1.0 SystemClock.qml singleton DesktopEntries 1.0 DesktopEntries.qml + +Singleton 1.0 Singleton.qml diff --git a/packages/omamobile-omarchy/test/sleep-lock-family.py b/packages/omamobile-omarchy/test/sleep-lock-family.py new file mode 100644 index 000000000..7e32423d9 --- /dev/null +++ b/packages/omamobile-omarchy/test/sleep-lock-family.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Observe the actual sleep test's patch input; no sleep/display command runs.""" +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +PACKAGE = Path(__file__).resolve().parent.parent +PATCH = '0021-sleep-turn-the-display-off-before-suspend.patch' + + +class SourceFamily(unittest.TestCase): + def capture(self, version, wrong_family=False): + with tempfile.TemporaryDirectory(prefix='sleep-family-') as temporary: + root = Path(temporary) + package = root / 'package' + (package / 'test').mkdir(parents=True) + for family in ['patches', 'legacy-4.0.6']: + target = package / family / PATCH + target.parent.mkdir() + target.write_bytes((PACKAGE / family / PATCH).read_bytes()) + source = (PACKAGE / 'test/sleep-lock.sh').read_text() + if wrong_family: + source = source.replace('series=legacy-4.0.6', 'series=patches') + script = package / 'test/sleep-lock.sh' + script.write_text(source) + extracted = root / 'extracted' + binary = extracted / 'usr/share/omarchy/bin/omarchy-system-sleep-lock' + binary.parent.mkdir(parents=True) + binary.write_text('#!/bin/sh\nexit 99\n') + (extracted / '.PKGINFO').write_text(f'pkgname = omarchy\npkgver = {version}\n') + fake = root / 'fake' + fake.mkdir() + recorder = fake / 'patch' + recorder.write_text('#!/bin/sh\ncat > "$PATCH_CAPTURE"\nexit 73\n') + recorder.chmod(0o755) + capture = root / 'captured-patch' + env = dict(os.environ, OMARCHY_PKG_ROOT=str(extracted), + PATH=str(fake) + os.pathsep + os.environ['PATH'], PATCH_CAPTURE=str(capture)) + result = subprocess.run(['bash', str(script)], env=env, capture_output=True, text=True) + self.assertNotEqual(result.returncode, 0, 'inert recorder must stop before display/sleep helpers') + return capture.read_bytes() if capture.exists() else None + + def test_current_phone_family(self): + self.assertEqual(self.capture('4.0.6-1'), (PACKAGE / 'legacy-4.0.6' / PATCH).read_bytes()) + + def test_new_source_family(self): + self.assertEqual(self.capture('4.5.0-3'), (PACKAGE / 'patches' / PATCH).read_bytes()) + + def test_unsupported_family_stops_before_patch(self): + self.assertIsNone(self.capture('4.6.0-1')) + + def test_old_flat_selection_negative(self): + self.assertNotEqual(self.capture('4.0.6-1', wrong_family=True), + (PACKAGE / 'legacy-4.0.6' / PATCH).read_bytes()) + + +unittest.main() diff --git a/packages/omamobile-omarchy/test/sleep-lock.sh b/packages/omamobile-omarchy/test/sleep-lock.sh index 83daacdf5..e43ec1f91 100755 --- a/packages/omamobile-omarchy/test/sleep-lock.sh +++ b/packages/omamobile-omarchy/test/sleep-lock.sh @@ -9,12 +9,20 @@ set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; } pass() { printf 'ok - %s\n' "$1"; } -src=${OMARCHY_PKG_ROOT:?an extracted omarchy package}/usr/share/omarchy +package_root=${OMARCHY_PKG_ROOT:?an extracted omarchy package} +src=$package_root/usr/share/omarchy +[[ -f $package_root/.PKGINFO ]] || fail "the extracted package has no .PKGINFO version" +version=$(sed -n 's/^pkgver = //p' "$package_root/.PKGINFO") +case $version in + 4.0.6-*) series=legacy-4.0.6 ;; + 4.5.0-*) series=patches ;; + *) fail "no sleep-lock patch family for package version '$version'" ;; +esac t=$(mktemp -d); trap 'rm -rf "$t"' EXIT mkdir -p "$t/omarchy/bin" "$t/fake" "$t/backlight/panel" cp "$src/bin/omarchy-system-sleep-lock" "$t/omarchy/bin/" -(cd "$t/omarchy" && patch -p1 --fuzz=0 -s) /dev/null 2>&1 || true +if ! systemctl --user enable owed.service; then + wants_dir="$HOME/.config/systemd/user/graphical-session.target.wants" + mkdir -p "$wants_dir" + ln -sfn /usr/lib/systemd/user/owed.service "$wants_dir/owed.service" +fi + +# A TTY update enables the next graphical login without starting a renderer +# against a missing Wayland session. A failed live start leaves this pending. +if [[ ${OMARCHY_UPGRADE_TO_QUATTRO_LIVE:-0} != 1 ]] && systemctl --user is-active --quiet graphical-session.target; then + systemctl --user start owed.service +fi diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh new file mode 100644 index 000000000..d34bbd0a9 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh @@ -0,0 +1,28 @@ +echo "Install the fingerprint resume hook on existing fingerprint setups" + +# Existing enrolled machines never rerun setup. Install only missing files +# so administrator changes survive an upgrade. + +hook_src="${OMARCHY_FPRINTD_RESUME_SRC:-$OMARCHY_PATH/default/systemd/system-sleep/fprintd-resume}" +hook_dst="${OMARCHY_FPRINTD_RESUME_DST:-/usr/lib/systemd/system-sleep/fprintd-resume}" +stop_timeout_src="${OMARCHY_FPRINTD_STOP_TIMEOUT_SRC:-$OMARCHY_PATH/default/systemd/system/fprintd.service.d/10-stop-timeout.conf}" +stop_timeout_dst="${OMARCHY_FPRINTD_STOP_TIMEOUT_DST:-/etc/systemd/system/fprintd.service.d/10-stop-timeout.conf}" +lock_pam="${OMARCHY_LOCK_FINGERPRINT_PAM:-/etc/pam.d/omarchy-lock-fingerprint}" + +[[ -f $lock_pam ]] || exit 0 + +if [[ -f $hook_src && ! -e $hook_dst ]]; then + echo "Installing the fprintd resume hook" + sudo install -Dm755 "$hook_src" "$hook_dst" +fi + +if [[ -f $stop_timeout_src && ! -e $stop_timeout_dst ]]; then + sudo install -Dm644 "$stop_timeout_src" "$stop_timeout_dst" +fi + +if [[ -f $stop_timeout_dst ]]; then + reload_needed=$(systemctl show fprintd.service --property=NeedDaemonReload --value) + if [[ $reload_needed == "yes" ]]; then + sudo systemctl daemon-reload + fi +fi diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh new file mode 100644 index 000000000..84b5c2557 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh @@ -0,0 +1,4 @@ +echo "Configure shared input-method defaults and free desktop shortcuts" + +omarchy-pkg-add fcitx5-mozc fcitx5-hangul fcitx5-chinese-addons fcitx5-chewing +omarchy-input-method configure --defaults diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh new file mode 100644 index 000000000..515df9433 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh @@ -0,0 +1,21 @@ +echo "Remove the files the 4.0 notification engine left behind" + +# They hold old message content: its per-popup files, history and images. +# rm and find never follow a symlink they are given. +dir="$HOME/.local/state/omarchy/notifications" +legacy="$HOME/.local/state/omarchy/notifications.json" + +# 4.0 kept Do Not Disturb on its own. It carries over unless the shell has +# already written quiet state of its own. +if [[ -f $legacy && ! -s $dir/quiet.json ]] && jq -e '.dnd == true' "$legacy" >/dev/null 2>&1; then + mkdir -p "$dir" + chmod 700 "$dir" + rm -f "$dir/quiet.json" + (umask 077 && printf '%s\n' '{"snoozes":{},"dnd":true,"silencedSince":0,"codesBypassQuiet":true}' >"$dir/quiet.json") +fi +rm -f "$legacy" + +rm -rf "$dir/history" "$dir/images" +if [[ -d $dir ]]; then + find "$dir/" -maxdepth 1 -type f -regex '.*/[0-9]+-[^/]+\.json' -delete +fi diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/README.md b/packages/omamobile-omarchy/test/upstream45/migrations/README.md new file mode 100644 index 000000000..3f13d7b34 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/README.md @@ -0,0 +1,8 @@ + +# Inert Omarchy 4.5 migration inputs + +Exact MIT-licensed files from the verified Omarchy 4.5 source/package snapshot: +https://github.com/basecamp/omarchy/tree/v4.5.0/migrations + +The mobile hold regression reads these files; it never executes their commands. +They test the real release changes rather than invented keyword-only fixtures. diff --git a/packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs b/packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs new file mode 100644 index 000000000..08c79afa7 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) David Heinemeier Hansson +// Mobile fixture extensions: Copyright (c) 2026 Marsel Nenaj +// Load a notification-plugin JS module the way QML does: `.pragma library` +// dropped, each `.import "X.js" as Alias` resolved to that module's scope. +const fs = require('node:fs') +const vm = require('node:vm') +const path = require('node:path') +const dir = process.env.OMARCHY_SHELL_DIR ? path.join(process.env.OMARCHY_SHELL_DIR, 'plugins', 'notifications') + : path.join(__dirname, '..', '..', '..', 'shell', 'plugins', 'notifications') +const cache = {} +function load(name) { + if (cache[name]) return cache[name] + const scope = { console, Qt: { openUrlExternally: u => u } } + const code = fs.readFileSync(path.join(dir, name + '.js'), 'utf8') + .replace(/^\.pragma.*$/mg, '') + .replace(/^\.import "([^"]+)" as (\w+)$/mg, (_, file, alias) => { + scope[alias] = load(file.replace(/\.js$/, '')) + return '' + }) + vm.createContext(scope) + vm.runInContext(code, scope) + return cache[name] = scope +} +load.dir = dir +module.exports = load diff --git a/packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs b/packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs new file mode 100644 index 000000000..5a7145bb5 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs @@ -0,0 +1,1113 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) David Heinemeier Hansson +// Mobile fixture extensions: Copyright (c) 2026 Marsel Nenaj +// The notification plugin's pure JS modules, plus the service's own functions +// lifted out of Service.qml and run against a fake ListModel and fake senders. +const assert = require('node:assert/strict'), fs = require('node:fs'), vm = require('node:vm') +const { URL } = require('node:url') +const load = require('./loader.cjs') +const S = load('Security'), M = load('Markup'), D = load('Detect'), Store = load('Store') +const Layout = load('Layout'), Delivery = load('Delivery'), Icons = load('Icons') +const snap = (n, key = 'k') => Store.snapshot(n, key, { Normal: 1 }) + +// ---------------------------------------------------------------- URL policy +// Hosts a WHATWG parser reads as IPv4. Node's URL proves each canonicalisation +// is real before the policy is checked to refuse it. +const numericHosts = [ + ['http://0x7f.0x0.0x0.0x1/', '127.0.0.1'], ['http://0X7F.0X0.0X0.0X1/', '127.0.0.1'], + ['http://0xa.0x0.0x0.0x1/', '10.0.0.1'], ['http://0177.0.0.1/', '127.0.0.1'], + ['http://0177.00.00.01/', '127.0.0.1'], ['http://2130706433/', '127.0.0.1'], + ['http://0x7f000001/', '127.0.0.1'], ['http://10.0.0x0.0x1/', '10.0.0.1'], + ['http://10.0.00.01/', '10.0.0.1'], ['http://127.0x/', '127.0.0.0'], ['https://127.1', '127.0.0.1'], +] +for (const [u, ip] of numericHosts) assert.equal(new URL(u).hostname, ip, 'sanity: ' + u) +const bad = ['https://paypal.com@evil.example', 'https://user:pass@example.com', 'javascript:alert(1)', 'file:///etc/passwd', + 'smb://server/share', 'data:text/html,test', 'https://example.com/\n', 'https://example.com/%0d%0a', 'https://example.com/%250a', + 'https://example.com%40evil.example', 'https://[::1]', 'https://[::ffff:127.0.0.1]', 'https://éxample.com', 'https://example..com', + 'https://example.com:99999', 'https://example.com\\@evil.example', 'https://example.com/' + 'x'.repeat(4096), + ...numericHosts.map(([u]) => u)] +for (const u of bad) { + assert.equal(S.safeExternalUrl(u), '', u) + assert.equal(S.openExternalUrl(u), false, u) + assert.ok(!M.render('
click').includes('', '', '', + '