[Nook Touch General] Exameden:
new additions, please let me know if details are required

First, there's one thing to impove in the Nook that is not about Deep Sleep but about CPU. By defatult, at least in my 4e, CPU Governor was set to 'performance'. Honestly I didn't know what the CPU Governor was before this research with the Nook. This service in the kernel uses different algorithms for handling cpu clocking (mosly under...). "performance" is the most power hungry and that's why I never noticed anything other than 1.8 Ghz for the CPU before digging into the topic. This one can be set to a different strategy, for the most part conservative, interactive (was on my general smartphone) or powersave are enough to consider. With any one of these the CPU starts underclocking and during most of non-taxing activity drops to 480 Mgz. From my observations this can save up to 50% of battery consumption. In my case probably from 5 minutes per 1% to 7 minutes/1% (Note: These numbers are about the device in the unlocked state and without Deep Sleep involved). For tweaking this setting you may use Kernel Adiutor available from F-Droid or elsewhere. For reference, the entries the program used are /sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor (%d should be replaced by 1..4 for number of cores) so before installing anything you can check your current value and get deeper if it's value is 'performance'

As for deep sleep first I will show different results in book reading context. My tempo is about 30 seconds per page. With this I have the following estimations about number of flips with continuing reading

Without CPU Governor optimizations: 6 hours with the screen on, about 720 flips

With CPU Governor optimization: About 9 hours with the screen on, about 1080 page flips.

So the Deep Sleep was researched with this context in mind.

I implemented the case when for every hardware button press a script executed that sends the device into the Deep Sleep (using the mentioned power_enhance_enabled setting). For this I tried different tools and finally a nice program was found - Key Mapper also available on F-Droid. Amongst other nice things (compared to the competition) it allows keeping the default action of the button and performing more than one action. It works with Trigger/Action/Constraint metaphor (MacroDroid is another example) and this allows plenty of useful actions to be performed. ( Side note: the program can act on single press, long press, double press and key sequences so with four buttons and constraining actions to different programs, everything is possible ). As for the actions, the one that worked was its ability to communicate with termux via intent. So a new script was created ( /data/data/com.termux/files/home/sleep.sh) with the following body

and the button press was mapped in Key Mapper to the termux intent running this script. Actually since I had no nook keys remapped to some standard codes, apart from the main action, I made another one that taps at the right part of the screen on nook button clicks. (KM also allows this) emulating flips with taps.

The results (analyzed with the additional logging information). It's important that the tests were made in a third party software (KoReader) since BN reader (bn.ereader) actually already implements this power enhance routine.

The script almost always (with few exceptions) sent the device into DS. With my tempo and BBS stats I got about 83% deep sleep time. From the rest (plus confirmed looking at the log), the procedure for sending to sleep takes about 3.5-4.5 seconds and this probably can't be improved (as you see, the shell script waits only about 200 ms and the rest are usually quick to execute, so it's possibly internal limitation of hardware/software)

I expected that 3 seconds is the pure CPU time (17% of total time) and should correspond to the mentioned conventional screen on time. But unfortunately as longer tests showed the battery drops more than this. Now I suspect that going to DS and back takes much more energy than expected. If someone has any confirmation/information, please let me know.

To confirm that the unexpected drop is not about the reading app or eInk update, I also tested by sleeping/waking with a stand-still screen and the drop was the same.

My real number now with this hack is about 15 minutes per 1% of battery. So about 25 hours of continuous reading or 3000 page flips (with my tempo). Just three times the number with CPU Governor optimization (see above). I really expected more. Please have in mind if your spend a minute on a single page (with smaller fonts and probably more relaxed reading) the results should be better.

Anyway, if anyone is interested in more details joining Key Mapper and termux together, let me know, I'll expand the description.