fix(power): prevent wake-key rebound after mem resume#96
Draft
enjihn wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Armada already ships
memsuspend for the Odin 3. This PR does not enable, select, or replace that suspend path; it prevents the physical power-key input used to wake the kernel from being interpreted after resume as a newsteam://shortpowerpress.The guard establishes an explicit input boundary around suspend:
systemd-sleephook atomically publishes one root-owned generation aspreparedbefore suspend and the same generation asresumedafterward;powerbuttondinvocation and sendsSIGUSR1;evtestprocess and opens a new descriptor;Normal awake operation remains blocking and event-driven—there is no idle polling loop. Existing short press, long press, lid, and fake-suspend behavior is preserved.
Guard lifetime and failure behavior
preparedgeneration can remain pending across an arbitrarily long suspend dwell; its bounded window begins only at the matchingresumedphase or the first guarded key event.resumedmarker uses absolute monotonic deadlines anchored to publication. A forced post-signal refresh uses fresh bounded deadlines. Both use a 1.5-second soft window and an unconditional 5-second hard limit, checked on timer and event paths.0644, and not a symlink. Invalid or stale data is ignored.powerbuttondstill refreshes the marker before interpreting an input line.powerbuttondlogs and exits instead of running a half-installed path.Why
On a physical Odin 3 running Armada Preview's existing
memimplementation, local instrumentation captured the wake press being translated into another Steam short-power action within milliseconds of resume. One user-visible wake-then-immediate-sleep loop was reproduced.An earlier live guard prototype then published a resume generation before session thaw and prevented the second Steam action in guarded cycles. Those observations establish the race and the value of a wake boundary, but they are local hardware evidence—not CI—and this redesigned descriptor-replacement implementation still needs installed-image qualification on the Odin 3. It does not claim to fix unrelated kernel, controller, audio, fan, or power-consumption behavior.
Scope and attribution
The underlying Odin 3 suspend enablement and Armada's ROCKNIX-derived kernel/GPU work are pre-existing and unchanged; this PR contains no kernel code and claims no credit for making
memwork. PR #34 concerns suspend-mode selection/fallback and is orthogonal to this post-resume input race.Development and analysis used substantial AI assistance, disclosed in the spirit of #27. AI helped inspect logs, refine the state machine, implement the patch, and build the tests. A human directed the scope, performed the physical device actions, and evaluated the observed behavior. The change is presented as a scoped, independently reviewable userspace patch.
Tests
git diff --checkbash tests/run.sh(also wired intojust check), covering:evtestprocess/descriptor replacement with backlog rejectionSIGUSR1interruption of a blocking Bash read and forced refresh