Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 05-21-2024, 12:59 PM   #1
shyhermit
Connoisseur
shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.
 
Posts: 94
Karma: 3160
Join Date: Apr 2024
Device: none
Battery Statistics Calculator script (NickelMenu) not working in Libra Colour

I can't get the wonderful script Battery Statistics Calculator 1.0 (2023-05-18) that Aleron wrote to work on the Libra Colour:

Here is the script description:

https://www.mobileread.com/forums/sh...postcount=1004

I used NickelMenu to trigger the script.

When triggered, the script that reporting a bit of files called in the /sys/class/power_supply?battery/capacity do not exist.

Am I correct that this Kobo has changed the locations of these files in the newer firmware for the Libra Colour?
shyhermit is offline   Reply With Quote
Old 05-21-2024, 01:12 PM   #2
hatuluang
Connoisseur
hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.
 
hatuluang's Avatar
 
Posts: 74
Karma: 348662
Join Date: Jan 2023
Location: Indonesia
Device: Kobo Clara 2E
Quote:
Originally Posted by shyhermit View Post
I can't get the wonderful script Battery Statistics Calculator 1.0 (2023-05-18) that Aleron wrote to work on the Libra Colour:

Here is the script description:

https://www.mobileread.com/forums/sh...postcount=1004

I used NickelMenu to trigger the script.

When triggered, the script that reporting a bit of files called in the /sys/class/power_supply?battery/capacity do not exist.

Am I correct that this Kobo has changed the locations of these files in the newer firmware for the Libra Colour?
Please find more info at https://www.mobileread.com/forums/sh...&postcount=999 and https://www.mobileread.com/forums/sh...postcount=1000

Last edited by hatuluang; 05-21-2024 at 01:52 PM.
hatuluang is offline   Reply With Quote
Advert
Old 05-21-2024, 01:51 PM   #3
shyhermit
Connoisseur
shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.
 
Posts: 94
Karma: 3160
Join Date: Apr 2024
Device: none
I did. I put the script in the :/mnt/onboard/.adds/ which is the default (instead of :/mnt/onboard/.adds/battcalc/ as you suggested). The script is called correctly, but the various calls the script makes do not work.

It should not make a difference as long as the location referenced in NickelMenu's config file is correct, right? Can you confirm?
shyhermit is offline   Reply With Quote
Old 05-21-2024, 01:56 PM   #4
hatuluang
Connoisseur
hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.hatuluang ought to be getting tired of karma fortunes by now.
 
hatuluang's Avatar
 
Posts: 74
Karma: 348662
Join Date: Jan 2023
Location: Indonesia
Device: Kobo Clara 2E
Quote:
Originally Posted by shyhermit View Post
I did. I put the script in the :/mnt/onboard/.adds/ which is the default (instead of :/mnt/onboard/.adds/battcalc/ as you suggested). The script is called correctly, but the various calls the script makes do not work.

It should not make a difference as long as the location referenced in NickelMenu's config file is correct, right? Can you confirm?
You are right, I changed my previous comment.
Please look at
https://www.mobileread.com/forums/sh...&postcount=999
and
https://www.mobileread.com/forums/sh...postcount=1000
hatuluang is offline   Reply With Quote
Old 05-21-2024, 01:59 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,575
Karma: 146059340
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
You might want to take a look in the NickelMenu thread from message #999 and message #1000.

You can telnet to your Kobo and take a look at what you get from looking at the contents of /sys/class/power_supply/battery/.

Edit: for the Libra Colour, you will need to look at the contents of /sys/class/power_supply/bd71827_bat instead.

Message to self: READ TO THE END OF THE THREAD BEFORE REPLYING!

Last edited by DNSB; 05-21-2024 at 02:04 PM.
DNSB is online now   Reply With Quote
Advert
Old 05-21-2024, 02:42 PM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,575
Karma: 146059340
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Played on my Libra Colour and changed battery to bd71827_bat in the shell script. I've attached the script (renamed to battcalc.sh.txt so rename back) and an image of the popup.

My first pass at the changes screwed up when I copy/pasted the script and the line endings were changed to CRLF. Used Notepad++ to change them to LF and all was happy.

Spoiler:
Code:
# Battery Statistics Calculator 1.0 (2023-05-18) by Aleron Ives
#
# This script calculates battery statistics for the Kobo Libra 2.
# Check the contents of /sys/class/power_supply/ if you use a different
# model to ensure that the statistics you want to track are available.
# 
# For the Libra Colour, you need to use bd71827_bat instead of battery.
# 
# You can use NickelMenu to invoke this script like so:
# menu_item :main :Battery :cmd_output :500 :/mnt/onboard/.adds/battcalc.sh
# 
# Gather the necessary statistics
# 
meter=$(cat /sys/class/power_supply/bd71827_bat/capacity)
v_now=$(cat /sys/class/power_supply/bd71827_bat/voltage_now)
v_min=$(cat /sys/class/power_supply/bd71827_bat/voltage_min)
v_max=$(cat /sys/class/power_supply/bd71827_bat/voltage_max)
c_now=$(cat /sys/class/power_supply/bd71827_bat/charge_now)
c_full=$(cat /sys/class/power_supply/bd71827_bat/charge_full)
c_dfull=$(cat /sys/class/power_supply/bd71827_bat/charge_full_design)

let v_now/=1000; let v_min/=1000; let v_max/=1000 # Convert to V
let c_now/=1000; let c_full/=1000; let c_dfull/=1000 # Convert to mAh
let v_nowr=$v_now%1000; let v_now/=1000 # Simulate floating-point arithmetic
let v_minr=$v_min%1000; let v_min/=1000 # "
let v_maxr=$v_max%1000; let v_max/=1000 # "
let charge=$c_now*100/$c_full # Calculate charge percentage from mAh
let c_health=$c_full*100/$c_dfull # Calculate health percentage from mAh

# Format and display the results

echo Capacity: $c_now mAh / $meter% / $charge%
echo Voltage: $v_min.$v_minr V / $v_now.$v_nowr V / $v_max.$v_maxr V
echo Health: $c_full mAh / $c_dfull mAh / $c_health%
Attached Thumbnails
Click image for larger version

Name:	battery_LC.png
Views:	46
Size:	33.0 KB
ID:	208427  
Attached Files
File Type: txt battcalc.sh.txt (1.6 KB, 22 views)

Last edited by DNSB; 05-21-2024 at 02:45 PM.
DNSB is online now   Reply With Quote
Old 05-21-2024, 03:37 PM   #7
shyhermit
Connoisseur
shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.
 
Posts: 94
Karma: 3160
Join Date: Apr 2024
Device: none
Once again, DNSB comes to the rescue!

Thank you!!! Just tried your mod. It works on the Libra Colour. Still not very accurate, as it shows a brand new Libra Colour not at 100% battery capacity (perhaps rounding error?). But better than nothing!

Quote:
Originally Posted by DNSB View Post
Played on my Libra Colour and changed battery to bd71827_bat in the shell script. I've attached the script (renamed to battcalc.sh.txt so rename back) and an image of the popup.

My first pass at the changes screwed up when I copy/pasted the script and the line endings were changed to CRLF. Used Notepad++ to change them to LF and all was happy.
shyhermit is offline   Reply With Quote
Old 05-21-2024, 04:39 PM   #8
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,575
Karma: 146059340
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Good to hear that it works for you. Yeah, 1889 of 1890 is a bit better than 99% but the most Linux shells only do integer operations so 99% is displayed rather than 99.95%.

Perhaps someone will create a version of the script using if/then/else to allow operation on a wider variety of devices without needing editing.
DNSB is online now   Reply With Quote
Old 05-21-2024, 04:50 PM   #9
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,159
Karma: 13621998
Join Date: Sep 2022
Device: Kobo Libra 2
It's interesting that the Libra Colour still has all the statistics. IIRC other models like the Clara and Sage don't report as much information.

If you think 1% is "not very accurate", wait until you check the stats while charging and it says your battery is at 4.8 V. (If that were true, your Libra would be exploding and on fire lol.)

I've noticed that shyhermit isn't the first person to dig my battery statistics script out of the NickelMenu thread; maybe we should have a dedicated thread for people to post NickelMenu scripts and sample configurations?
Aleron Ives is offline   Reply With Quote
Old 05-21-2024, 05:46 PM   #10
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,575
Karma: 146059340
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
There was a Best of NickelMenu? thread which might be hijacked for that purpose or a new thread could be created.
DNSB is online now   Reply With Quote
Old 05-21-2024, 06:23 PM   #11
shyhermit
Connoisseur
shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.shyhermit could sell banana peel slippers to a Deveel.
 
Posts: 94
Karma: 3160
Join Date: Apr 2024
Device: none
I absolutely adore your script, Aleron. It is still fantastic stats notwithstanding the inherent issue.

I am an Apple fan. Recalling the very early days of iPhone hacking, the internal battery stats was one of the biggest achievements that the jailbreak community succeeded in cracking early on.

Quote:
Originally Posted by Aleron Ives View Post
It's interesting that the Libra Colour still has all the statistics. IIRC other models like the Clara and Sage don't report as much information.

If you think 1% is "not very accurate", wait until you check the stats while charging and it says your battery is at 4.8 V. (If that were true, your Libra would be exploding and on fire lol.)

I've noticed that shyhermit isn't the first person to dig my battery statistics script out of the NickelMenu thread; maybe we should have a dedicated thread for people to post NickelMenu scripts and sample configurations?
shyhermit is offline   Reply With Quote
Old 05-24-2024, 06:12 PM   #12
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,159
Karma: 13621998
Join Date: Sep 2022
Device: Kobo Libra 2
I'm experimenting with calculating the remaining capacity from the voltage, and while it does work, it messes up the lovely 3-items-per-line paradigm.
Aleron Ives is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Skipping forced registration on Libra Colour and Clara Colour shyhermit Kobo Reader 47 05-18-2024 12:53 PM
Newbie question on NickelMenu use with Libra Colour shyhermit Kobo Reader 4 05-14-2024 02:48 PM
Battery life of Libra Colour Gone Kobo Reader 31 05-09-2024 12:31 AM
NickelMenu script for fixing Pocket images qkqw Kobo Developer's Corner 46 03-18-2024 03:21 PM
NickelMenu - 'Generator error' message on Libra H2O ? steveparry KOReader 1 04-22-2021 12:47 PM


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


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