Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/omamobile-device-lynx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Omarchy Mobile's first userspace package for the Google Pixel 7a (codename lynx,
| `bin/omamobile-boot-success` + `vendor/systemd/system/omamobile-boot-success.service` | `/usr/bin`, `/usr/lib/systemd/system` (enabled by a vendor wants link) | Marks the booted A/B slot successful after each boot, as Android's boot-control service does. Without it, the bootloader burns one of slot B's three retries per boot and then falls back to slot A. Same files as the Pixel 7 Pro package |
| `src/omamobile-bootctl.c` | `/usr/bin/omamobile-bootctl` | Reads and updates the slot flags in `devinfo` (`sdd1`, layout 3.15 on lynx as on the Pixel 7 Pro). Only ever changes bytes 0x30-0x37, verified. Same source as the Pixel 7 Pro package |
| `src/reboot-to.c` | `/usr/bin/reboot-to` | Reboot with a reason the bootloader understands. Same bytes as the Pixel 7 Pro package; the test checks |
| `bin/omamobile-lynx-display-start` | `/usr/bin` | Allows the S6E3FC5 panel's DSI commands only when the bootloader names it, restores the saved brightness and then loads `gs_decon` |
| `vendor/systemd/system/omamobile-lynx-display.service` | `/usr/lib/systemd/system` | Runs the display start once per boot, before `display-manager.service` |
| `vendor/modprobe.d/omamobile-display.conf` | `/usr/lib/modprobe.d` | Keeps `gs_decon` out of autoload so it probes after the gate |
| `device.conf` | `/usr/share/omamobile/device.conf` | The descriptor, the same bytes as `device/lynx/device.conf` |

`./build [DIR]` compiles `omamobile-bootctl` and `reboot-to` from this directory, `./install DESTDIR [DIR]` stages the files, and `test/all` checks the two copies when it is run from the repository.
Expand Down
101 changes: 101 additions & 0 deletions packages/omamobile-device-lynx/bin/omamobile-lynx-display-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/bash
# SPDX-License-Identifier: MIT
# Allow the panel's DSI commands only when the bootloader names the
# S6E3FC5 panel on the kernel command line, then load gs_decon (blacklisted
# for autoload) so it probes after the gate. Hang-safe: a marker written and
# synced before modprobe stops the next boot from trying a load that never
# returned; --retry clears it. Lynx also ships S6E3FC3 panels.
# omamobile-lynx-display-start [--retry]
# OMAMOBILE_LYNX_ROOT: a scratch root for the package tests.
set -uo pipefail

root=${OMAMOBILE_LYNX_ROOT:-}
[[ -z $root || ( $root == /* && $root != / && -d $root ) ]] || exit 2

state=$root/var/lib/omamobile
marker=$state/lynx-display-started
cmdline=$root/proc/cmdline
decon=$root/sys/bus/platform/devices/1c240000.display-controller
allow=$root/sys/module/gs_dsim_cmd/parameters/allow_tx
panel=""

log() { echo "omamobile-lynx-display: $*"; }
loaded() { [[ -d $root/sys/module/$1 ]]; }
bound() {
local i
for ((i = 0; i < $3; i++)); do
[[ $(readlink -f "$1/driver" 2>/dev/null) == */$2 ]] && return 0
sleep 0.25
done
return 1
}

for word in $(cat "$cmdline" 2>/dev/null); do
case $word in
exynos_drm.panel_name=*) panel=${word#*=} ;;
esac
done

# systemd-backlight restores the saved level before this start allows the
# panel's commands; send it again now that the panel takes them.
restore_brightness() {
local bl level
for bl in "$root"/sys/class/backlight/*; do
[[ -e $bl/brightness ]] || continue
level=$(cat "$bl/brightness" 2>/dev/null) || continue
echo "$level" > "$bl/brightness" 2>/dev/null \
&& log "brightness of ${bl##*/}: level $level sent"
done
}

case ${1:-} in
'') ;;
--retry) rm -f "$marker" ;;
*) log "usage: omamobile-lynx-display-start [--retry]"; exit 2 ;;
esac

if [[ -e $marker ]]; then
log "the last start ($(cat "$marker" 2>/dev/null)) never finished; the display stays on simple-framebuffer this boot."
log "after checking the previous boot's log, retry with: omamobile-lynx-display-start --retry"
exit 0
fi
if [[ ${1:-} != --retry ]] && loaded gs_decon; then
log "already started this boot"
exit 0
fi

mkdir -p "$state"
printf '%s display\n' "$(date -Is)" > "$marker"
sync -f "$marker" 2>/dev/null || sync

# The parameter appears when the driver loads; do not depend on autoload.
modprobe gs_dsim_cmd 2>/dev/null || true

case $panel in
sdc-s6e3fc5|sdc-s6e3fc5.*|s6e3fc5|s6e3fc5.*)
if echo 1 > "$allow" 2>/dev/null; then
log "panel $panel, DSI commands allowed"
restore_brightness
else
log "panel $panel, cannot write $allow; leaving it read-only"
fi
;;
*)
log "panel ${panel:-unnamed}, DSI commands stay off"
;;
esac

status=0
if ! modprobe gs_decon; then
log "gs_decon failed (see dmesg); the display stays on simple-framebuffer"
status=1
elif ! bound "$decon" gs-decon 60; then
log "the display controller did not bind to gs-decon (see dmesg)"
status=1
else
log "up: display"
fi

rm -f "$marker"
sync -f "$state" 2>/dev/null || sync
exit $status
8 changes: 8 additions & 0 deletions packages/omamobile-device-lynx/install
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ install -Dm644 vendor/systemd/sleep.conf.d/10-omamobile.conf \
"$destination/usr/lib/systemd/sleep.conf.d/10-omamobile.conf"
install -Dm644 vendor/NetworkManager/conf.d/10-omamobile-usb.conf \
"$destination/usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf"
install -Dm644 vendor/modprobe.d/omamobile-display.conf \
"$destination/usr/lib/modprobe.d/omamobile-display.conf"
install -Dm755 bin/omamobile-lynx-display-start \
"$destination/usr/bin/omamobile-lynx-display-start"
install -Dm644 vendor/systemd/system/omamobile-lynx-display.service \
"$destination/usr/lib/systemd/system/omamobile-lynx-display.service"
ln -sfn ../omamobile-lynx-display.service \
"$destination/usr/lib/systemd/system/multi-user.target.wants/omamobile-lynx-display.service"
install -Dm644 device.conf \
"$destination/usr/share/omamobile/device.conf"
install -Dm644 etc/omamobile-mirrorlist \
Expand Down
74 changes: 73 additions & 1 deletion packages/omamobile-device-lynx/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,79 @@ for absent in usr/bin/omamobile-wifi-start usr/bin/omamobile-charge-guard \
usr/bin/omamobile-camera-start; do
[[ ! -e $tmp/root/$absent ]] || fail "install includes $absent"
done
pass "install stages the udev rule, the USB link, the mirrorlist, and the boot-success marker, and nothing that starts hardware"
[[ -f $tmp/root/usr/lib/modprobe.d/omamobile-display.conf ]] \
|| fail "install stages the display modprobe file"
[[ -x $tmp/root/usr/bin/omamobile-lynx-display-start ]] \
|| fail "install stages the display start script"
[[ -f $tmp/root/usr/lib/systemd/system/omamobile-lynx-display.service ]] \
|| fail "install stages the display service"
grep -qx 'ConditionPathExists=/sys/bus/platform/devices/1c240000.display-controller' \
"$tmp/root/usr/lib/systemd/system/omamobile-lynx-display.service" \
|| fail "the display unit names the DECON node"
[[ $(readlink "$tmp/root/usr/lib/systemd/system/multi-user.target.wants/omamobile-lynx-display.service") == ../omamobile-lynx-display.service ]] \
|| fail "the display service is enabled"
# The panel gate: allow only the S6E3FC5 names, create the parameter
# through modprobe first, and load gs_decon after the write.
gate=$tmp/panel-gate
mkdir -p "$gate/proc" "$gate/bin"
cat > "$gate/bin/modprobe" <<'FAKE'
#!/bin/bash
echo "$1 allow=$(cat "$OMAMOBILE_LYNX_ROOT/sys/module/gs_dsim_cmd/parameters/allow_tx" 2>/dev/null || echo none)" >> "$TEST_LOG"
p=$OMAMOBILE_LYNX_ROOT/sys/module/gs_dsim_cmd/parameters
mkdir -p "$p"
[[ -e $p/allow_tx ]] || echo 0 > "$p/allow_tx"
if [[ $1 == gs_decon ]]; then
d=$OMAMOBILE_LYNX_ROOT/sys/bus/platform/devices/1c240000.display-controller
mkdir -p "$d" "$OMAMOBILE_LYNX_ROOT/sys/bus/platform/drivers/gs-decon"
ln -sfn "$OMAMOBILE_LYNX_ROOT/sys/bus/platform/drivers/gs-decon" "$d/driver"
fi
FAKE
chmod +x "$gate/bin/modprobe"
for pair in "sdc-s6e3fc5.20800a:1" "sdc-s6e3fc3-l10:0" ":0"; do
panel=${pair%:*}; want=${pair##*:}
echo "console=null ${panel:+exynos_drm.panel_name=$panel} bootconfig" > "$gate/proc/cmdline"
rm -rf "$gate/sys" "$gate/var"
mkdir -p "$gate/sys/class/backlight/panel"
echo 900 > "$gate/sys/class/backlight/panel/brightness"
: > "$gate/calls"
out=$(TEST_LOG=$gate/calls PATH="$gate/bin:$PATH" OMAMOBILE_LYNX_ROOT=$gate \
bin/omamobile-lynx-display-start 2>&1)
got=$(cat "$gate/sys/module/gs_dsim_cmd/parameters/allow_tx" 2>/dev/null || echo missing)
[[ $got == "$want" ]] || fail "panel '${panel:-none}' wrote allow_tx=$got, want $want"
grep -qx "gs_decon allow=$want" "$gate/calls" \
|| fail "gs_decon was not loaded after allow_tx=$want for '${panel:-none}': $(cat "$gate/calls")"
if [[ $want == 1 ]]; then
[[ $out == *"brightness of panel: level 900 sent"* ]] \
|| fail "the saved brightness is not sent for '${panel:-none}': $out"
else
[[ $out != *brightness* ]] || fail "brightness sent with DSI commands off for '${panel:-none}': $out"
fi
done
grep -qx 'blacklist gs_decon' vendor/modprobe.d/omamobile-display.conf \
|| fail "gs_decon is not blacklisted for autoload"
# Already loaded this boot: no second load.
mkdir -p "$gate/sys/module/gs_decon"
out=$(TEST_LOG=$gate/calls PATH="$gate/bin:$PATH" OMAMOBILE_LYNX_ROOT=$gate \
bin/omamobile-lynx-display-start 2>&1)
[[ $out == *"already started this boot"* ]] || fail "a loaded gs_decon is loaded again: $out"
rm -rf "$gate/sys/module/gs_decon"

# A marker from a load that never returned: nothing is loaded until --retry.
mkdir -p "$gate/var/lib/omamobile"
echo "2026-11-15T00:00:00+00:00 display" > "$gate/var/lib/omamobile/lynx-display-started"
: > "$gate/calls"
out=$(TEST_LOG=$gate/calls PATH="$gate/bin:$PATH" OMAMOBILE_LYNX_ROOT=$gate \
bin/omamobile-lynx-display-start 2>&1)
[[ $out == *"never finished"* && ! -s "$gate/calls" ]] \
|| fail "a stale marker did not stop the load: $out / $(cat "$gate/calls")"
out=$(TEST_LOG=$gate/calls PATH="$gate/bin:$PATH" OMAMOBILE_LYNX_ROOT=$gate \
bin/omamobile-lynx-display-start --retry 2>&1)
[[ $out == *"up: display"* && ! -e "$gate/var/lib/omamobile/lynx-display-started" ]] \
|| fail "--retry did not clear the marker and load: $out"

pass "the panel gate allows only S6E3FC5"

pass "install stages the udev rule, the USB link, the mirrorlist, the boot-success marker and the display gate, and no radio"

# 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).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: MIT
# gs-dsim-cmd starts read-only. omamobile-lynx-display-start enables DSI
# commands only when the bootloader names the S6E3FC5 panel on the command
# line, so an S6E3FC3 unit never receives S6E3FC5 commands.
# gs-decon decides the link rate at probe, so keep it out of autoload:
# the start loads it after allow_tx is set.
blacklist gs_decon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: MIT
[Unit]
Description=Lynx S6E3FC5 display start
After=local-fs.target systemd-modules-load.service
Before=display-manager.service
ConditionPathExists=/sys/bus/platform/devices/1c240000.display-controller

[Service]
Type=oneshot
TimeoutStartSec=60
RemainAfterExit=yes
ExecStart=/usr/bin/omamobile-lynx-display-start

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion packages/omamobile-device-lynx/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.4
0.2.5