View Single Post
Old 07-21-2018, 03:17 PM   #30
Mrs_Often
Wizard
Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.
 
Mrs_Often's Avatar
 
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
Custom Sleep/Power-off timeouts

I don't seem to be able to find a main thread for the `Custom Sleep/Power-off timeouts`, so since it came with this lovely package, I'll ask here:

Is there (still) a maximum number of minutes for the power-off timer that the device will understand?

I found the following in the patching instructions thread for 3.15.0:

Quote:
Originally Posted by GeoffR View Post
The code that the `Custom Sleep/Power-off timeouts` patch changes can only use values from 0-255. Although the register used to hold the timeout value is 32-bit and can hold much larger values, the code uses a 16-bit 'thumb' instruction to load the register, and there isn't room to use a wider instruction in the patch. It could be that the timeout function can accept larger values, but there is no way to load those larger values without re-writing the code.
Quote:
Originally Posted by had View Post
I put a value of 960 in KoboReader.conf and it sleeps after approx 16 hours.

Maybe the patch could load the most significant byte of the word, instead of the least significant byte? Then we could set very large values in increments of approximately 4 hours. That is, if the thumb instruction could put a '6' into the other byte of the word, we'd have approximately 6 x 4 (around 24) hours.
Quote:
Originally Posted by GeoffR View Post
There are 32-bit instructions to load constants larger than 255, or to load and shift/rotate small constants in one instruction, but I don't know of any way to do it with a 16-bit instruction.

There are 16-bit instructions to load a value from memory if it is not too far from the location of the loading instruction, but it is a matter of luck whether the value you want to load exists within range.

There are 16-bit instructions that can load one register from another and shift/rotate the value at the same time, but you need to have a register with a known value to start with, which might require re-writing the existing code.

Re-writing the code to make enough room to add some instructions is possible, I did it for the "My 15 line spacing values" patch, but it can be a lot of work.
Is this still applicable? I've been using:

[PowerOptions]
AutoOffMinutes=2880 (48 hours)

...in the Kobo eReader.conf file successfully for my Glo running 4.8.x, but it doesn't seem to work in 4.9.11311 on my Clara HD. I do have it set to even longer (I think 3300 minutes / 55 hours), but instead of switching off after two days of not reading, it switches off after one day of not reading. I'm not sure after how long exactly, but it's somewhere between 24 and 36 hours I think. I haven't paid enough attention. But maybe I should switch to using this patch instead if it would get me more reliable results


By the way, there doesn't seem to be a version number mentioned in this patch. Is that deliberate?
Spoiler:

<Patch>
patch_name = `Custom Sleep/Power-off timeouts`
patch_enable = `no`
#
## Changes the Sleep/Power-off timeout menu options from 5,10,15,30,45,60
## minutes to 10,20,30,60,120,240 minutes.
#
# Values displayed on both menus
replace_string = CEACA0, `5 mins\0`, `10 mins`
replace_string = CEACA8, `10 mins`, `20 mins`
replace_string = CEACB0, `15 mins`, `30 mins`
replace_string = CEACB8, `30 mins`, `1 hour`
replace_string = CEACC0, `45 mins`, `2 hours`
replace_string = CEACC8, `60 mins`, `4 hours`
# Actual values used for sleep menu
replace_int = A6F298, 5, 10
replace_int = A6F2E2, 10, 20
replace_int = A6F326, 15, 30
replace_int = A6F36A, 30, 60
replace_int = A6F3AE, 45, 120
replace_int = A6F3F2, 60, 240
# Actual values used for power menu
replace_int = A6F4A6, 5, 10
replace_int = A6F4E8, 10, 20
replace_int = A6F528, 15, 30
replace_int = A6F568, 30, 60
replace_int = A6F5A8, 45, 120
replace_int = A6F5E6, 60, 240
</Patch>

Last edited by Mrs_Often; 07-22-2018 at 03:16 PM.
Mrs_Often is offline   Reply With Quote