Quote:
Originally Posted by droopy
Hello, My Forma is a 3-week-old baby, and I love it so much. I spend so much time looking at her and picking her up whenever I am -- in line, lying down, in the bathroom, in the bus.
I think I'm ready to enhance her now in the form of patches/tweaks.
First thing I'd like to do is extend the "Automatically Power Off After" period to something longer than 60 minutes. (60 minutes is the longest period available in the Settings). Is there a patch/tweak that will auto power off my Forma after 24 hours of no taps/button-presses?
|
There is a way to do that. After seeing all the roundabout stuff in this thread, I decided to have a quick look and see if there is any way to increase the maximum timeout. Here are a few notes I made while looking into this:
Code:
N3PowerWorkflowManager::setupAlarm is called (this seems to be what allows it to power off during a sleep, etc):
Gets PowerSettings::getAutoOffMinutes and PowerSettings::getAutoSleepMinutes
Runs ::configureWakup for ::powerOff and ::requestSleep depending on values of autoOffMinutes autoSleepMinutes
::configureWakeup:
Multiplies provided minutes by 60000 (min -> ms)
Schedules a wakeup, when triggered, calls the provided function
N3PowerWorkflowManager::pollBattery (does the check, called through Qt's object system):
Gets PowerSettings::getAutoOffMinutes and PowerSettings::getAutoSleepMinutes
Multiplies each by 60000 (min -> ms)
Compares with PowerManager::timeLastUsed
Performs an action if needed
It seems that these two locations are the only ones which matter.
From a quick glance, it appears that it should be fine to patch these multipliers as long as they fit in a 64-bit signed
integer. But, note that the multiplier is a 32-bit signed integer. But, to be safe, don't make the largest possible timeout
longer than 596 hours (~35800 minutes), as I haven't checked all the places where it is used.
And here is a quick patch I put together for 4.15.12920 (untested, but it should work):
Code:
Larger Sleep/Power-off timeouts:
- Enabled: no
# Multiplier in N3PowerWorkflowManager::configureWakeup
- ReplaceBytes: {Offset: 0xA1194C, FindH: 04 FB 05 F5, ReplaceH: 4F EA C5 45} # mul r5(dest), r4(multiplier), r5(mins) -> lsl r5, r5, #19
# Multiplier in N3PowerWorkflowManager::pollBattery
- ReplaceBytes: {Offset: 0xA13692, FindH: 08 FB 00 F8, ReplaceH: 4F EA C0 48} # mul r8(dest), r8(multiplier), r0(mins) -> lsl r8, r0, #19
- ReplaceBytes: {Offset: 0xA136C2, FindH: 02 FB 00 F2, ReplaceH: 4F EA C0 42} # mul r2(dest), r2(multiplier), r0(mins) -> lsl r2, r0, #19
# Menu text
- BaseAddress: 0xD48754
- ReplaceString: {Offset: 0, Find: "5 mins\0", Replace: "8m"}
- ReplaceString: {Offset: 8, Find: "10 mins", Replace: "34m"}
- ReplaceString: {Offset: 16, Find: "15 mins", Replace: "1h1m"}
- ReplaceString: {Offset: 24, Find: "30 mins", Replace: "4h4m"}
- ReplaceString: {Offset: 32, Find: "45 mins", Replace: "12h5m"}
- ReplaceString: {Offset: 38, Find: "60 mins", Replace: "24h1m"}
# Values
- BaseAddress: 0
- ReplaceInt: {Offset: 0xACF230, Find: 5, Replace: 1}
- ReplaceInt: {Offset: 0xACF3F6, Find: 5, Replace: 1}
- ReplaceInt: {Offset: 0xACF288, Find: 10, Replace: 4}
- ReplaceInt: {Offset: 0xACF432, Find: 10, Replace: 4}
- ReplaceInt: {Offset: 0xACF2C4, Find: 15, Replace: 7}
- ReplaceInt: {Offset: 0xACF46C, Find: 15, Replace: 7}
- ReplaceInt: {Offset: 0xACF300, Find: 30, Replace: 28}
- ReplaceInt: {Offset: 0xACF4A6, Find: 30, Replace: 28}
- ReplaceInt: {Offset: 0xACF33C, Find: 45, Replace: 83}
- ReplaceInt: {Offset: 0xACF4E0, Find: 45, Replace: 83}
- ReplaceInt: {Offset: 0xACF378, Find: 60, Replace: 165}
- ReplaceInt: {Offset: 0xACF518, Find: 60, Replace: 165}
And for custom values: