Skip to content

Anbernic XX: wake on lid open for the clamshells - #1894

Merged
CatalyticArkun merged 2 commits into
spruceUI:Developmentfrom
abalakh:xx_lid_wake
Oct 21, 2026
Merged

CatalyticArkun merged 2 commits into
spruceUI:Developmentfrom
abalakh:xx_lid_wake

Conversation

@abalakh

@abalakh abalakh commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Closes #1893.

Adds "Wake on lid open" to Battery Settings on the clamshells (RG SP, RG34XX SP, RG35XX SP): Off / 10m / 30m / Always. Off by default - keeping the hall sensor awake costs 5-6x the battery while asleep, according to the BaseOS dev, so it's opt-in.

10m/30m let the lid wake it for the first 10/30 minutes of sleep. After that an RTC alarm wakes it for a split second to switch back to Super Standby and keep the original shutdown timer, and from then on only POWER wakes it.

Tested on an RG SP (BaseOS 1.4.0): lid wake inside the window, no lid wake but POWER working after it, Off, and the shutdown timer surviving the switch.

BaseOS keeps the SP kernels in Super Standby (os_sleep 16), which leaves
the hall sensor out of the wake set, so opening the lid doesn't wake the
device. Added "Wake on lid open" to Battery Settings on the RG SP,
RG34XX SP and RG35XX SP: Off (default), 10m, 30m or Always.

The timed options let the lid wake the device for that long into a sleep.
An RTC alarm then wakes it briefly to switch to Super Standby and re-arm
the original shutdown time.

Closes spruceUI#1893
A failed window alarm left os_sleep at 0 for the rest of the sleep. Also
keep the policy local and match PyUI's support check to the shell's -w.
@CatalyticArkun

Copy link
Copy Markdown
Contributor

Follow-up update:
If the alarm that ends a 10m/30m window can't be set, lid wake is now switched off before returning. Before, os_sleep stayed at 0, with its higher battery drain, for the rest of the sleep.
xx_set_lid_wake keeps its policy value local (it was a leaked global _xx_policy).
PyUI's support check uses os.access(..., W_OK), matching the shell's [ -w ].
Tested on an RG35XX SP, BaseOS 1.4.0, with the card synced to this branch:

Off: the lid doesn't wake it; POWER does.
Always: the lid wakes it; POWER with the lid shut re-suspends.
10m: the lid wakes it inside the window. The window ends at +600 s, then only POWER wakes it.
The shutdown timer still fires at its original time after the window switch (15m timer: power-off at +15:02).
30m with a 15m timer and 10m with a 5m timer both take the single-suspend path, with lid wake on throughout.
13/13 checks passed, and the spruce log timings match. The failed-window-alarm path is stub-tested only (dash and bash).

@CatalyticArkun
CatalyticArkun merged commit 79d1590 into spruceUI:Development Oct 21, 2026
1 check failed
@abalakh
abalakh deleted the xx_lid_wake branch October 21, 2026 07:31
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.

Anbernic RG SP: option to wake from sleep by opening the lid (BaseOS os_sleep)

2 participants