Skip to content

power-ab: the sleep preflight reads the charge, not just tests for the file - #592

Merged
derekross merged 2 commits into
mainfrom
power-ab-preflight-reads
Nov 10, 2026
Merged

derekross merged 2 commits into
mainfrom
power-ab-preflight-reads

Conversation

@derekross

Copy link
Copy Markdown
Owner

Found in the round-47 review of linux-omarchy-mobile#234: tools/power-ab --suspend accepted a gauge whose charge file was merely readable. With #234 the Pixel 9a's gauge answers ENODATA for charge_now after a power-on reset, so the run would start and record no sleep figure. The preflight now reads one of the two files and refuses when neither gives a value.

It doesn't overlap #226, which changes the sampling loop, not this check.

🤖 Generated with Claude Code

derekross and others added 2 commits November 9, 2026 19:41
…e file

The --suspend preflight accepted a gauge whose charge_counter or
charge_now file was readable. A gauge that withholds its charge has
readable files and no figure: with linux-omarchy-mobile#234 the 9a's
MAX77779 answers ENODATA for charge_now while its power-on-reset bit is
set, so the run would start and its sleep phase, whose only number is
the charge difference, would record nothing. The preflight now reads
one of the two and refuses when neither gives a value.

Checked with two stand-in directories: a file holding a number passes;
a file that exists but fails to read is refused, where the old -r test
passed it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With --detach the script re-ran itself in the background before any of
its checks, with its output sent nowhere. A refusal (no battery, no
s2idle, a gauge that withholds its charge) then happened in the detached
copy: the caller read "started; unplug within 60 s", unplugged, and
nothing ran. The checks now run first, in the caller's terminal, and the
detached copy runs them again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@derekross
derekross merged commit 5aa0df8 into main Nov 10, 2026
2 checks passed
@derekross
derekross deleted the power-ab-preflight-reads branch November 10, 2026 13:45
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
… detaching (derekross#592)

The s2idle preflight tested only that the gauge's charge file exists. A gauge that withholds its figure (the 9a's MAX77779 after a power-on reset answers ENODATA) passed, and the sleep phase then had no number. It now reads charge_counter, then charge_now, and refuses when neither answers.

With --detach the script re-ran itself in the background before any check, with its output sent nowhere, so a refusal was never seen. The checks now run first, in the caller's terminal.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant