Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-12-2016, 01:15 PM   #1
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 507
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Mesure battery duration for KSM

The goal was, as I wrote at an older Koreader's forum post:
Quote:
I asked tshering in his KSM thread for a way to count the time I read and he was kind enough to give me a command to add to my power-off script to measure the uptime of the reader.

It would be nice if someone with bash knowledge could improve it to give us somehow the total time, since now I have to make the counting manually, and to format it in a more readable way e.g.:
  • uptime: 0:00:14:32 (total 0:02:42:56)
  • idle: 0:00:13:32 (total 0:02:24:31)
  • battery: 68%
I was using a combination of this handy mod for Koreader and tshering's scripts to get a more accurate picture of my battery's duration.
And since nobody improved the original script, I had to learn a bit about bash and try to improve it myself.
So I did, and this is the outcome.

DISCLAIMER - USE AT YOUR OWN RISK
I'm using this with Kobo Glo (non-HD), KSM7 and Koreader v2015.11-11-g16509e2.
It should work with other configurations too, but I can't be sure about the KSM8 before someone else try it.
UPDATE: For KSM8 files and instructions, please read the 2nd post from tshering.

INSTALL FOR KSM7
There is a KoboRoot.tgz in the KSM07_uptimeX_0x.zip
The steps are:
  • Extract KoboRoot.tgz from the KSM07_uptimeX_0x.zip
  • Copy KoboRoot.tgz into the .kobo folder
  • In KSM7 menu select "handle update" > "install update"
  • Wait until the device has restarted

The KoboRoot.tgz archive contains a modified poweroff.sh script that will be copied to the "\.adds\kbmenu\onstart\" directory and
the show_uptime.sh and delete_uptime.sh scripts that will be copied to the "\.adds\kbmenu\scripts_intern\returntests\" directory.

That's it!

After that, every time you shut down the device (really shut down, not suspend) it will add a line to a uptime.txt file that it will be created in the "\.adds\kbmenu\logs\" directory.
This line will be in the form of:
Code:
2016:03:08_19:59, 0:00:11:58 total: 52992 bat: 78
which is the date and time that the device was shut down, the time it spend open, the total ms that the device was open after the creation of the uptime .txt, and the current battery level.

Whenever you want to check the status you have to goto KSM and navigate to scripts>tests>returntests.msh and execute the "show uptime.sh" script.
You will get a reading of:

Uptime: 0:00:01:56
Total time: 0:14:06:23
Battery charge: 65
Battery spend: 22

If you want to restart the measurements (after a partial or complete charge) you have to execute the "delete uptime.sh" (found in the same place) which deletes the uptime.txt.
You have to restart the device after that to start fresh.

The "Battery charge" and the "Battery spend" sum is the battery level of the device when the uptime.txt was re-created.

If anybody that is more knowledgeable than me with bash (almost everybody ;o) can improve the scripts, please do so and post the updates here.

After two complete battery cycles, I'm in a happy position to announce that my Glo's battery is enough for more than 2 days of continuous reading:
2 days with 76 shutdowns and
2 days and 4 hours with 56 shutdowns.

I'll keep on measuring a bit more before coming to a conclusive number, but its much better than I thought.

...and have a nice read too...

Edit1: Uploaded a zip file, since .7z files are not supported ...
Edit2: Instruction for Koreader support.
Attached Files
File Type: zip KSM07_uptimeX_02.zip (1.2 KB, 285 views)

Last edited by embryo; 09-21-2017 at 04:02 PM.
embryo is offline   Reply With Quote
Old 05-12-2016, 04:45 PM   #2
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
embryo, thank you for the nice contribution!

Here is the version for KSM 08.

How to install:
  • extract KoboRoot.tgz from the uploaded archive
  • copy KoboRoot.tgz into .kobo
  • select (KSM home) "handle update" > "install update"
  • wait until the device has restarted

The navigation path to the two scripts is:
(KSM home) "user scripts" > "tests" > "returntests user.msh"

I renamed show_uptime.sh and delete_uptime.sh to uptime_show.sh and uptime_delete.sh so that they are displayed next to each other in the list. These two files should work on KSM 07 too (at least when started via the menu; when starting them from telnet one has to set and export the variable "ksmroot"). The KSM 08 version of the script poweroff.sh must not be used under KSM 07 however!

Note: Looking at the screen shot again I notice that "battery spend" sounds strange.
Attached Thumbnails
Click image for larger version

Name:	screen_20160512_222059.png
Views:	406
Size:	76.6 KB
ID:	148616  
Attached Files
File Type: zip KSM08_uptimeX_02.zip (1.2 KB, 297 views)

Last edited by tshering; 05-13-2016 at 03:58 PM.
tshering is offline   Reply With Quote
Advert
Old 05-12-2016, 06:54 PM   #3
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 507
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by tshering View Post
embryo, thank you for the nice contribution!

Here is the version for KSM 08.
Thank you and don't forget that you started it...
I'll link your post from the first post
Quote:
How to install:
  • extract KoboRoot.tgz from the uploaded archive
  • copy KoboRoot.tgz into .kobo
  • select (KSM home) "handle update" > "install update"
  • wait until the device has restarted

The navigation path to the two scripts is:
(KSM home) "user scripts" > "tests" > "returntests user.msh"

I renamed show_uptime.sh and delete_uptime.sh to uptime_show.sh and uptime_delete.sh so that they are displayed next to each other in the list.
Well, THAT was what I was trying to avoid by using these names.. ;o)
I think its dangerous to have the delete script next to the script that you use all the time.
Its a mistake waiting to happen...
Quote:
These two files should work on KSM 07 too (at least when started via the menu; when starting them from telnet one has to set and export the variable "ksmroot"). The KSM 08 version of the script poweroff.sh must not be used under KSM 07 however!

Note: Looking at the screen shot again I notice that "battery spend" sounds strange.
It looks like your battery meter didn't change since the first entry in the uptime.txt.
Remember this is measuring the consumption of the "Total time" not how much is missing from the 100%
It should change.
If it doesn't, then there is something different in the environment variables of the touch (which I highly doubt)

BTW Do you thing I should provide a KoboRoot.tgz for installation?

Last edited by embryo; 05-12-2016 at 07:02 PM.
embryo is offline   Reply With Quote
Old 05-13-2016, 04:08 AM   #4
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by embryo View Post
Well, THAT was what I was trying to avoid by using these names.. ;o)
I think its dangerous to have the delete script next to the script that you use all the time.
Its a mistake waiting to happen...
I see, our preferences differ. I prefer to have those things that I consider as belonging together also grouped together in the list. Anyway, since the two scripts are on the user partition (and no other scripts are depending on them) everybody can rename them according to taste.

Quote:
Originally Posted by embryo View Post
It looks like your battery meter didn't change since the first entry in the uptime.txt.
Remember this is measuring the consumption of the "Total time" not how much is missing from the 100%
It should change.
If it doesn't, then there is something different in the environment variables of the touch (which I highly doubt)
I have no problem with the "0." I meant to say that the expression "battery spend" sounds strange to me. I would rather expect "battery discharge," "battery discharged" or something like that. But since I am not a native English speaker, I cannot really propose anything.

Quote:
Originally Posted by embryo View Post
BTW Do you thing I should provide a KoboRoot.tgz for installation?
I think for some people this might be helpful. It just came to my mind that I could modify poweroff.sh a little so that it works for KSM 07 and 08. But since the location of this file is different in 07 and 08, we still need two different installation packages. (By the way there was a screen rotation problem with the 07 poweroff.sh. You cannot see it on the Glo).

Update: I modified poweroff.sh. I expect it to work on 07 (update 4) and 08. I did not test it, since I do not have a Kobo with me. I will test it under 08 this evening.
We could use the same installation package for 07 and 08, if we do not care that poweroff.sh will be copied to two different locations. -We could get rid of the unnecessary file afterwards with the help of udev/rules.d, but I do not care for the moment.
Attached Files
File Type: zip poweroff.zip (690 Bytes, 295 views)

Last edited by tshering; 05-13-2016 at 04:49 AM.
tshering is offline   Reply With Quote
Old 05-13-2016, 06:08 AM   #5
Alan_S
Evangelist
Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.
 
Alan_S's Avatar
 
Posts: 440
Karma: 1084584
Join Date: Aug 2007
Location: Sisak, Croatia
Device: Kobo Aura H2O, Kobo Aura ONE
Quote:
Originally Posted by embryo View Post
After that, every time you shut down the device (really shut down, not suspend) it will add a line to a uptime.txt file that it will be created in the "\.adds\kbmenu\logs\" directory.
Would be possible to measure suspended time also?

Shutting device off in a way is "safe" to maximize battery life, you can't have more than that. But, suspending device could have problems, device maybe wouldn't go completely to sleep, or whatever is reason that battery drains much faster than normal.
Alan_S is offline   Reply With Quote
Advert
Old 05-13-2016, 07:55 AM   #6
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 507
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by tshering View Post
I see, our preferences differ. I prefer to have those things that I consider as belonging together also grouped together in the list. Anyway, since the two scripts are on the user partition (and no other scripts are depending on them) everybody can rename them according to taste.
I prefer the grouping too.
Its more logical.
I changed it after an "accident" happened.
Quote:
I have no problem with the "0." I meant to say that the expression "battery spend" sounds strange to me. I would rather expect "battery discharge," "battery discharged" or something like that. But since I am not a native English speaker, I cannot really propose anything.
I'm also foreign to the English language.
I like the "discharge" version.
Maybe some native English speaker can enlighten us?
Quote:
I think for some people this might be helpful. It just came to my mind that I could modify poweroff.sh a little so that it works for KSM 07 and 08. But since the location of this file is different in 07 and 08, we still need two different installation packages. (By the way there was a screen rotation problem with the 07 poweroff.sh. You cannot see it on the Glo).

Update: I modified poweroff.sh. I expect it to work on 07 (update 4) and 08. I did not test it, since I do not have a Kobo with me. I will test it under 08 this evening.
We could use the same installation package for 07 and 08, if we do not care that poweroff.sh will be copied to two different locations. -We could get rid of the unnecessary file afterwards with the help of udev/rules.d, but I do not care for the moment.
This is excellent!
I tried the poweroff.sh and it works with my KSM7 Glo.

I agree to use one package for everything.
It makes things easier for everybody.
I can rename the scripts the more "logical" way.
The existence of an extra file that nobody uses is no problem I think.

But maybe there is a difference in the other script's location too.
From your KoboRoot.tgz structure I can see that they must be copied to the kbmenu_user folder and not to the kbmenu that the KSM7 uses.
Is this going to impose any more problems?
embryo is offline   Reply With Quote
Old 05-13-2016, 08:03 AM   #7
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 507
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by Alan_S View Post
Would be possible to measure suspended time also?
I couldn't find any way to do that.
I know of a variable for the idle part of the wake time but I didn't find any for the suspend time.
Maybe someone with more knowledge of linux vars?
embryo is offline   Reply With Quote
Old 05-13-2016, 08:20 AM   #8
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by embryo View Post
But maybe there is a difference in the other script's location too.
From your KoboRoot.tgz structure I can see that they must be copied to the kbmenu_user folder and not to the kbmenu that the KSM7 uses.
Is this going to impose any more problems?
You are right! I totally forgot about this.

As for suspend, we could use preventfreeze.sh to log this and whether nickel, KOReader or PbChess was running.
tshering is offline   Reply With Quote
Old 05-13-2016, 09:15 AM   #9
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 507
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Updated the archive for the KSM7 installation with the tshering's newer poweroff.sh script (1st post).
embryo is offline   Reply With Quote
Old 05-13-2016, 04:00 PM   #10
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Updated the archive for the KSM8 (2nd post).
tshering is offline   Reply With Quote
Old 05-14-2016, 11:47 AM   #11
Alan_S
Evangelist
Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.Alan_S ought to be getting tired of karma fortunes by now.
 
Alan_S's Avatar
 
Posts: 440
Karma: 1084584
Join Date: Aug 2007
Location: Sisak, Croatia
Device: Kobo Aura H2O, Kobo Aura ONE
Quote:
Originally Posted by embryo View Post
I couldn't find any way to do that.
If you find way for measuring suspended time, please inform and update script.

And about message, battery spent is correct. But it can be also discharged, it isn't that important.

Last edited by Alan_S; 05-14-2016 at 11:51 AM.
Alan_S is offline   Reply With Quote
Old 09-21-2017, 04:00 PM   #12
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 507
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Koreader support

I wrote some instructions for using the uptime.sh script with KoReader.
I tested them with KSM7 and it *should* work with KSM8, but if someone try it, please post the results.
embryo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB identification with KSM Jellby Kobo Developer's Corner 4 01-09-2015 07:30 AM
Greetings from KSM ksmurali Introduce Yourself 4 05-25-2011 04:35 AM
iPad What battery duration do you experience? mgmueller Apple Devices 29 06-03-2010 05:25 PM
DR800 battery duration (and message deleted in iRex Forums) rfog iRex 3 01-19-2010 09:13 AM
Iliad battery duration is better? fdojose iRex 1 02-08-2008 02:37 PM


All times are GMT -4. The time now is 07:08 AM.


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