Power button not sleeping the system when sleep timer is set to OFF
Checklist
- [x] I am reporting a bug in the Onion OS - Any issues with the closed source frontend (MainUI), or RetroArch or any of the cores should be directed to their respective repositories
- [x] I have reviewed the Onion Docs and did not find the answer
- [x] I have searched the existing (open and closed) issues to ensure I do not log a duplicate
Onions OS Version
4.4.0-beta2
Miyoo Firmware Version
202306282128
Provide a clear and concise description of the issue
Normally, when pressing the power button with the device on, the system goes into a sleep mode, pausing any gameplay, turning the screen off, etc.
With the sleep timer set to OFF, pressing the power button only dims the screen and disables inputs. The device is still running, which is most obvious from there still being sounds playing from whatever game was/is still running.
Steps to Reproduce
- In the setting menu, set the Sleep Timer to OFF
- Start playing any game
- press the power button
Changing the sleep timer to any other option resolves this
Provide any additional context or information that may help us investigate your issue
I have nothing more to add. Thanks!
I did some digging and I think the culprit might be here
There's some logic that might be firing when sleep_timer is set to 0, preventing proper deep sleep when the screen is off.
Not sure if this would solve it, i can try to build keymon later:
void turnOffScreen(void)
{
if (settings.sleep_timer == 0) {
// Immediately turn off screen/suspend
suspend_exec(0); // or whatever value means "suspend now"
} else {
int timeout = (settings.sleep_timer + SHUTDOWN_MIN) * 60000;
bool stay_awake = temp_flag_get("stay_awake");
suspend_exec(stay_awake ? -1 : timeout);
}
}