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 10-18-2019, 05:31 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
Monitoring battery charge

I feel my Kindle works less and less on a full charge, but maybe I just read more.
Anyway to verify that I've created a simple script to monitor the battery charge and screensaver events.

Code:
#!/bin/bash

VERSION='1.0'
LOGFILE='/mnt/base-us/battery.log'
SOURCES=$'com.lab126.powerd\ncom.lab126.hal'

touch $LOGFILE

echo [`date`] Starting $0 v$VERSION >> $LOGFILE

echo "$SOURCES" | lipc-wait-event -m -l battLevelChanged,goingToScreenSaver,outOfScreenSaver,charging,notCharging | while read event; do
	echo [`date`] $event >> $LOGFILE
	done
It uses lipc-wait-event so should have no visible influence on the battery live.

Example log print:
Code:
[Fri Oct 18 11:00:24 EEST 2019] Starting /mnt/us/extensions/battstat/bin/battstat.sh v1.0
[Fri Oct 18 11:01:28 EEST 2019] Event Source: com.lab126.powerd
[Fri Oct 18 11:01:28 EEST 2019] Event Source: com.lab126.hal
[Fri Oct 18 11:01:28 EEST 2019] Waiting for events...
[Fri Oct 18 11:01:28 EEST 2019] com.lab126.powerd charging
[Fri Oct 18 11:03:24 EEST 2019] com.lab126.powerd battLevelChanged 98
[Fri Oct 18 11:08:28 EEST 2019] com.lab126.powerd battLevelChanged 99
[Fri Oct 18 11:14:58 EEST 2019] com.lab126.powerd battLevelChanged 100
[Fri Oct 18 11:21:22 EEST 2019] com.lab126.powerd goingToScreenSaver 3
I'm attaching also KUAL extension to enable the script. It'll run until the restart, creates the log in battery.log file in the root folder.

Changelog:
Spoiler:
  • battstat_1.3.zip - add autostart option
  • battstat_1.2.zip - add more logged events
  • battstat_1.1.zip - move log to /var/local
  • battstat.zip - initial version
Attached Files
File Type: zip battstat.zip (1.1 KB, 142 views)
File Type: zip battstat_1.1.zip (1.2 KB, 127 views)
File Type: zip battstat_1_2.zip (1.3 KB, 118 views)
File Type: zip battstat_1_3.zip (1.6 KB, 132 views)

Last edited by MrTick; 12-09-2019 at 07:34 AM. Reason: Added changelog
MrTick is offline   Reply With Quote
Old 10-18-2019, 05:53 AM   #2
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 3592925
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
Thank you for sharing.
Have you found anything interesting in your log that caused battery drain?
hius07 is offline   Reply With Quote
Advert
Old 10-18-2019, 05:57 AM   #3
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
Quote:
Originally Posted by hius07 View Post
Thank you for sharing.
Have you found anything interesting in your log that caused battery drain?
I'm monitoring it for less than an hour, so nothing yet
MrTick is offline   Reply With Quote
Old 10-18-2019, 09:01 AM   #4
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
Put your log file in /var/local/your-choice.

That is persistent "user data" for the Kindle system and untouched by the activities of the USB sub-system.
knc1 is offline   Reply With Quote
Old 10-18-2019, 09:25 AM   #5
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
Quote:
Originally Posted by knc1 View Post
Put your log file in /var/local/your-choice.

That is persistent "user data" for the Kindle system and untouched by the activities of the USB sub-system.
Thanks for the tip.
The idea was to have easy access to the log files without the need of using usbNetwork.
The improvement is as follows: now the log is stored in /var/local and can be easily obtained via KUAL menu

EDIT: I can't edit the first post, so I'm adding new attachment here.

Last edited by NiLuJe; 10-18-2019 at 10:06 AM. Reason: Moved attachment to first post -- NiLuJe
MrTick is offline   Reply With Quote
Advert
Old 10-18-2019, 10:15 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 MrTick View Post
Thanks for the tip.
The idea was to have easy access to the log files without the need of using usbNetwork.
The improvement is as follows: now the log is stored in /var/local and can be easily obtained via KUAL menu

EDIT: I can't edit the first post, so I'm adding new attachment here.
Sounds good.

It will take a "few" (unknown number) of posts before this system will give you full access.
Just keep on posting, the system will wake up 'soon'.
knc1 is offline   Reply With Quote
Old 10-18-2019, 10:52 AM   #7
hius07
Wizard
hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.hius07 ought to be getting tired of karma fortunes by now.
 
Posts: 1,161
Karma: 3592925
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
Will it be useful to add monitoring wirelessEnableChanged event?

More events mentioned I've seen here
https://www.mobileread.com/forums/sh...d.php?t=227859
hius07 is offline   Reply With Quote
Old 10-18-2019, 12:48 PM   #8
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
Quote:
Originally Posted by hius07 View Post
Will it be useful to add monitoring wirelessEnableChanged event?
It should be easy to modify the script to log any event you want.
Just add the correct event source (separated by /n) to the SOURCES variable and include the event in the lipc-wait event list.

You can also monitor all events in the system, but that might cause exessive flash wear:
Code:
lipc-probe -l | lipc-wait-event -m -l "*" | while read event; do
	echo [`date`] $event > /mnt/us/events.log
	done
MrTick is offline   Reply With Quote
Old 12-06-2019, 06:04 AM   #9
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
So I've done some measurements, it seems that the battery is quite dead (all measurements were done with frontlight set to 3)

Grey zones are times where PW entered 'suspended' state.
Similar green zones for charging.



It lasted a little more than a day on a single charge.
I've replaced the battery situation improved instantly, so it'll take some time before I discharge it fully and attach a new plot

Dirty python script to generate plot from battery.log attached (python2+matplotlib)
Attached Thumbnails
Click image for larger version

Name:	test.png
Views:	449
Size:	59.7 KB
ID:	175370  
Attached Files
File Type: py plot.py (2.0 KB, 139 views)
MrTick is offline   Reply With Quote
Old 12-06-2019, 06:52 AM   #10
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
Is that your PW1 or PW4? (Your PW1, but future readers may not realize that.)
Also the firmware version in use please.

That is a very pretty little chart.

As you wrote, the old battery is almost a straight line downward, regardless if the device is asleep or awake.
That old battery would probably discharge in less than a day just sitting on a shelf.

Last edited by knc1; 12-06-2019 at 06:56 AM.
knc1 is offline   Reply With Quote
Old 12-06-2019, 07:15 AM   #11
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
Quote:
Originally Posted by knc1 View Post
Is that your PW1 or PW4? (Your PW1, but future readers may not realize that.)
Also the firmware version in use please.
PW1 running the most recent 5.6.1.1
MrTick is offline   Reply With Quote
Old 12-06-2019, 12:01 PM   #12
Junket
Nil adsuetudine maius
Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.Junket ought to be getting tired of karma fortunes by now.
 
Junket's Avatar
 
Posts: 278
Karma: 500000
Join Date: Nov 2019
Location: US
Device: PW4
Nice idea and chart. Thanks for sharing this.

As to being able to edit your older posts, I believe it's > 20 posts and definitely < 53 posts before the forum settings will allow such. As you might gather, I didn't notice exactly when the transition occurred.
Junket is offline   Reply With Quote
Old 12-06-2019, 12:03 PM   #13
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
Quote:
Originally Posted by Junket View Post
As to being able to edit your older posts, I believe it's > 20 posts and definitely < 53 posts before the forum settings will allow such. As you might gather, I didn't notice exactly when the transition occurred.
I think it's exactly 10 posts, as I can already edit my posts for some time
(BTW. Added a little-improved version 1.2 that gather also suspend events)
MrTick is offline   Reply With Quote
Old 12-06-2019, 12:36 PM   #14
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047190
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Just throwing this out there:

While that may be frowned upon in other subforums (as I can't speak for other mods), feel free to PM me if you need an edit on an earlier post .

Or a thread title, because no amount of posting will ever allow you to edit your own thread's title :/.

(Yes, that last one used to drive me mad ^^).
NiLuJe is offline   Reply With Quote
Old 12-19-2019, 03:50 AM   #15
tiandongxv
Junior Member
tiandongxv began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Feb 2016
Device: kindle voyage
Quote:
Originally Posted by MrTick View Post
So I've done some measurements, it seems that the battery is quite dead (all measurements were done with frontlight set to 3)



Grey zones are times where PW entered 'suspended' state.

Similar green zones for charging.







It lasted a little more than a day on a single charge.

I've replaced the battery situation improved instantly, so it'll take some time before I discharge it fully and attach a new plot



Dirty python script to generate plot from battery.log attached (python2+matplotlib)


Can this script run on Kindle?
tiandongxv is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When should I charge the battery? charlyee Amazon Kindle 25 02-03-2016 08:11 AM
iLiad can't charge iLiad battery ragdoll iRex 2 11-11-2015 06:49 AM
How Far Do You Let Your Battery Go Before You Charge ? JimmyH Amazon Kindle 18 11-03-2014 12:11 PM
Battery Will Not Charge w1ksz enTourage eDGe 19 04-10-2013 10:12 AM
Can't Charge My Battery Lady Fitzgerald Astak EZReader 8 06-22-2010 05:09 PM


All times are GMT -4. The time now is 05:29 PM.


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