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 03-07-2014, 02:08 PM   #1
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
New hack to save battery while not using kindle5

When you turn off your kindle by pushing the power button once, it remain running for little bit then raise "ReadyToSuspend" event a little bit after that your kindle goes into sleep mode to save your battery.
Problem is, applications running on kindle can receive the event and request that kindle remain running.
for example if amazon is downloading an update and doesn't wish to be interrupted

the script simply force the kindle going into sleep mode whether the running software liked it or not.

Change log:
* Battery saver is now more aggressive.
It no longer waits for "ReadyToSuspend" signal instead it put the device in sleep mode one minute after turning it off.
That behavior might not be desirable to many since any background operation happening at that time (book being downloaded, system update being downloaded, kindle syncing, ...) will be suspended

* Kindle wakeup when I unplug it from usb cable, and so script has been updated to also put it in sleep 1 minute after unplugging it (but only if its locked!)

Known issues:
Kindle doesn't come out of sleep if it enters sleep mode while there is an active ssh session, you will have to power it off then on again

I own kindle white for a while and noticed that when I turn it off (by pushing the power button) kindle doesn't really turn off it just turn the light of the screen off, show nice screen save and continue running.

I knew for sure its running when I installed usbnetwork and was able to access my kindle through wireless connection while it is supposedly turned off [ shocking ! ]

Anyway I've wrote this simple application which check every 10 minutes [ crontab job ] whether your kindle is turned on or off, if turned off the program put your kindle into sleep mode.

While in sleep mode your kindle will no longer be activated when you plug it into usb and you will have to activate it manually by pushing the power button.

the program put your kindle into sleep mode by issuing the command
echo "mem" > /sys/power/state
That also means you no longer have to worry about turning wifi off before switching kindle off

Notes:

This script is working fine for my kindle paperwhite but I take no responsibility for any damage that might cause to any one try this. USE AT YOUR OWN RISK!

The install script do many validations before doing the actual install to ensure it will not fail.
install log can be found in the root of your sdcard

Install will fail if you tried to install the program twice.
uninstall script is included

EDIT: updated the package to be upstart service instead of cron, Thanks Dsmid for your code contribution and suggestion.
EDIT2: If you have installed the original script, uninstall it before - or after doesn't matter - installing the new script
EDIT3: Fixed a small bug when handling lipc error. no need to uninstall the previous - upstart based - version before installing this one
Attached Files
File Type: zip batter_saver.zip (4.0 KB, 221 views)

Last edited by ramast; 03-25-2014 at 05:03 PM. Reason: coorecting information
ramast is offline   Reply With Quote
Old 03-07-2014, 02:20 PM   #2
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
I take back what I said earlier.
Connecting your kindle to usb does awaken it from sleep mode.

best way to test is to have an ssh session to usbnetwork - either through usb or wireless -
turn off your device - by pushing the power button - and your session should still be working normally but within 10 minutes it should freeze

Last edited by ramast; 03-07-2014 at 03:25 PM.
ramast is offline   Reply With Quote
Advert
Old 03-07-2014, 05:56 PM   #3
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by ramast View Post
I take back what I said earlier.
Connecting your kindle to usb does awaken it from sleep mode.
Of course.
An obvious OS design requirement.

While system is suspended, it has stored hardware setup data, including system bus information.

If you change the system bus configuration, that stored setup data would no longer match the hardware.
So the system comes out of suspend to account for the hardware changes.
knc1 is offline   Reply With Quote
Old 03-07-2014, 06:47 PM   #4
Antoinekamel
Addict
Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.Antoinekamel ought to be getting tired of karma fortunes by now.
 
Antoinekamel's Avatar
 
Posts: 278
Karma: 2511467
Join Date: Feb 2012
Device: ABC W p2
Any like, statistical, result?
Antoinekamel is offline   Reply With Quote
Old 03-07-2014, 11:15 PM   #5
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
I've just wrote and tested the application yesterday.
usually my kindle would consume most of its battery within 3-4 days if wifi is on.
I left it on and will see how long is it gonna last.

And knc this is not always the case, my laptop would turn off its usb port so it doesn't get out of its suspense mode when a new usb is connected
ramast is offline   Reply With Quote
Advert
Old 03-08-2014, 07:58 AM   #6
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by ramast View Post
I've just wrote and tested the application yesterday.
usually my kindle would consume most of its battery within 3-4 days if wifi is on.
I left it on and will see how long is it gonna last.

And knc this is not always the case, my laptop would turn off its usb port so it doesn't get out of its suspense mode when a new usb is connected
And you are running Linux on your laptop ?
Which version of kernel?
Which distribution or home-rolled?
What make/model of laptop?

- - - -

Plus - the topic was Embedded Linux on the Kindle, not Linux on your laptop.
knc1 is offline   Reply With Quote
Old 03-08-2014, 08:27 AM   #7
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
I am using gentoo linux, will send you a private message to keep this topic for its original prupose
ramast is offline   Reply With Quote
Old 03-12-2014, 05:09 AM   #8
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
After 5 days of not using my kindle - except for checking its battery everyday - here is a screenshot of how much battery has been used.
please note that during the test my wireless was on and aireplane mode was NOT activated at any point.

If it is to continue on this rate I would estimate at most 15% battery decline in two month provided the kindle is never used of course.
Attached Thumbnails
Click image for larger version

Name:	kindle.png
Views:	330
Size:	4.0 KB
ID:	120124  
ramast is offline   Reply With Quote
Old 03-12-2014, 07:25 AM   #9
dsmid
Linux devotee
dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.
 
dsmid's Avatar
 
Posts: 598
Karma: 2069047
Join Date: Feb 2011
Device: Kindle 3, Kindle 4B, Kindle PW2
Wouldn't this simple upstart script be better than fiddling with cron ?

/etc/upstart/battery_saver.conf
Code:
start on framework_ready
stop on stopping framework

respawn

script
    while true
    do
        lipc-wait-event com.lab126.powerd readyToSuspend || true
        echo "mem" > /sys/power/state || true
        # Gives us some time to react if something goes wrong
        sleep 60
    done
end script
dsmid is offline   Reply With Quote
Old 03-12-2014, 08:07 AM   #10
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
its not a bad idea but, you need to give some time for the screensaver to work before initiating the sleep command

Last edited by ramast; 03-12-2014 at 08:11 AM.
ramast is offline   Reply With Quote
Old 03-12-2014, 09:09 AM   #11
dsmid
Linux devotee
dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.
 
dsmid's Avatar
 
Posts: 598
Karma: 2069047
Join Date: Feb 2011
Device: Kindle 3, Kindle 4B, Kindle PW2
Nope, readyToSuspend is fired when the device is already in screensaver mode for some time (about one minute).
I've tested that on my PW2.

See https://www.mobileread.com/forums/sho...61#post1689961

Last edited by dsmid; 03-12-2014 at 09:13 AM.
dsmid is offline   Reply With Quote
Old 03-12-2014, 09:28 AM   #12
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
Awesome I will update the package and test it with the new code.
shall I use "dsmid" to address you in the source code?

Last edited by ramast; 03-12-2014 at 09:31 AM.
ramast is offline   Reply With Quote
Old 03-12-2014, 10:02 AM   #13
dsmid
Linux devotee
dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.
 
dsmid's Avatar
 
Posts: 598
Karma: 2069047
Join Date: Feb 2011
Device: Kindle 3, Kindle 4B, Kindle PW2
Quote:
Originally Posted by ramast View Post
shall I use "dsmid" to address you in the source code?
Sure, you can.
dsmid is offline   Reply With Quote
Old 03-12-2014, 10:16 AM   #14
Akirainblack
abibliophobic
Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.Akirainblack ought to be getting tired of karma fortunes by now.
 
Posts: 220
Karma: 219708
Join Date: Aug 2012
Device: KV jailbroken
Will this work with the PW2 or is it solely for the PW?
Akirainblack is offline   Reply With Quote
Old 03-12-2014, 10:58 AM   #15
ramast
Member
ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'ramast knows the difference between 'who' and 'whom'
 
Posts: 18
Karma: 10000
Join Date: Mar 2014
Device: Kindle Paperwhite
Akirainblack, I compiled the package to support AW2 but whether it will work or not I am not sure.
If you want to volunteer and test it please go ahead.

although you might want to wait until I adopt the code of dsmid before testing
ramast is offline   Reply With Quote
Reply

Tags
kindle5, paperwhite, power save, sleep


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Battery woes after using Jailbreak hack on Kindle 2 US edition ashu_dan Kindle Developer's Corner 6 08-18-2012 08:28 AM
Do you turn wifi off to save battery? jusmee Kobo Reader 24 02-20-2012 10:04 PM
Paid Hack Request: Photo Slideshow Hack for Kindle 3 chmreader Kindle Developer's Corner 0 05-25-2011 01:24 PM
Book titles hack? Time delay hack? re838uk Sony Reader 0 10-08-2009 05:29 AM
Does sleep mode actually save battery? spooky69 Sony Reader 20 01-23-2008 04:36 PM


All times are GMT -4. The time now is 04:26 PM.


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