Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-26-2021, 03:13 AM   #1
MrTick
Enhtusiast
MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.MrTick ought to be getting tired of karma fortunes by now.
 
MrTick's Avatar
 
Posts: 53
Karma: 2340139
Join Date: Dec 2018
Device: K3 DxG PW1 KV PW4
Automatic backlight when waking up

I want to share this small KUAL extension that briefly enables the backlight when the device wakes up.

Code:
SOURCES=$'com.lab126.powerd'

get_light_level () {
    head -n1 /sys/class/backlight/bl/actual_brightness
}

lipc-wait-event -m com.lab126.powerd outOfScreenSaver | while read event; do
    sleep 0.1 
    if [ $(get_light_level) -eq 0 ]; then
        echo -n "10" > /sys/class/backlight/bl/brightness 
        sleep 10
    
        if [ $(get_light_level) -eq 10 ]; then  
            echo -n "0" > /sys/class/backlight/bl/brightness
        fi
    fi
done
Background
Sometimes when reading in a bright daylight I disable the backlight to preserve some battery juice. But often, when I go to sleep and decide to read some more I then realize that BL is turned off, so I had to grab flashlight/phone/jar of fireflies to just find the controls to turn it on.
That is actually pretty annoying so here's a simple solution for that.

Solution
The script waits for device wake-up event then it checks whether the backlight is off and turns it on for 10s if it is.
During that 10s you need to adjust the BL to a desired level, as it'll go off if you don't.
Script does nothing if any level of backlight was set before.

Notes
  • Script adds a single option to KUAL menu that is used to enable/disable the script (when enabled it autostarts, so no need to reenable it after each restart).
  • Script uses lipc-wait-event interface to watch for the wake-up, and I'm still not sure whether it has any effect on the battery life.
  • There's a small bug when you quickly switch Kindle on/off many times in less than 10s, the light will stay on for 10s*number of switch on's...
  • The script should work on any Kindle with a backlight and FW 5.10+
  • If you want to adjust the time light stay's on you can do that by editing the sleep value in bin/autolight.sh.
Attached Files
File Type: zip autolight_1.0.zip (1.9 KB, 126 views)
MrTick is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PW4 problem waking up tomsem Amazon Kindle 5 03-08-2019 09:26 PM
Aura H2O H2O IR sometimes not waking up eenk Kobo Reader 7 09-19-2015 02:41 PM
Automatic Convert and Automatic Add not working together kylliancole Calibre 3 08-03-2012 11:57 PM
A Waking of Rooks delavallad14 Self-Promotions by Authors and Publishers 0 07-10-2012 03:39 AM
Waking up K1 taking longer? KlondikeGeoff Amazon Kindle 10 09-17-2009 07:56 AM


All times are GMT -4. The time now is 03:12 PM.


MobileRead.com is a privately owned, operated and funded community.