![]() |
#991 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Did you accidentally change the power button to take a screenshot instead?
|
![]() |
![]() |
![]() |
#992 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,688
Karma: 16307824
Join Date: Sep 2022
Device: Kobo Libra 2
|
Quote:
![]() Code:
menu_item :main :Battery :cmd_output :500 :cat /sys/class/power_supply/battery/capacity /sys/class/power_supply/battery/voltage_now /sys/class/power_supply/battery/voltage_min /sys/class/power_supply/battery/voltage_max /sys/class/power_supply/battery/charge_now /sys/class/power_supply/battery/charge_full /sys/class/power_supply/battery/charge_full_design
The pop-up window will look like this (but without the key): Code:
39 3707800 (3.71 V) 3520000 (3.52 V) 4200000 (4.20 V) 590000 (590 mAh) 1429000 (1429 mAh) 1430000 (1430 mAh) ![]() You can track the decline in the voltage as the battery discharges, and you can track the health of your battery by comparing the maximum capacity against the design capacity. You can also double check the calculated percentage by dividing (current capacity / maximum capacity). In this example, the capacity indicates 41%, but the battery meter claims 39%. Of course, this assumes that sysfs actually produces reliable numbers, but at least it's more information than the default battery meter gives us. ![]() If any Linux gurus out there can tell me how I could intercept the output of cat and format it nicely instead of displaying the raw numbers, I'd be interested to try that. |
|
![]() |
![]() |
![]() |
#993 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
|
Quote:
Code:
# Example just echoing a number to test the concept. # Use 'units' --terse mode. # Convert from uV to V. # Then echo it along with a literal V. echo $(units -t "$(echo 3707800) uV" V) V # result: 3.7078 V # Replacing the call to echo with your call to cat: echo $(units -t "$(cat /sys/class/power_supply/battery/voltage_now) uV" V) V Code:
# The idea is to look for 6 or 7 digits, and insert a dot before the final 6 digits. # If it was 6 digits then a leading 0 is inserted before the decimal. # Trailing zeroes in the fractional part are stripped. # If this results in a number like "3." then a single trailing zero is added, e.g. "3.0". # Finally the line has the units appended on. # Example using echo: echo 3707800 | sed -E -e 's/([0-9]?)([0-9]{6})/\1.\2/; s/^\./0./; s/\.([0-9]*[1-9])?0+/.\1/; s/\.$/.0/; s/$/ V/' # result: 3.7078 V # With the actual file: cat /sys/class/power_supply/battery/voltage_now | sed -E -e 's/([0-9]?)([0-9]{6})/\1.\2/; s/^\./0./; s/\.([0-9]*[1-9])?0+/.\1/; s/\.$/.0/; s/$/ V/' Code:
# Here if the result has no fractional part it is omitted instead of shown as ".0". # Example using echo: echo 1429000 | sed -E -e 's/([0-9]{3,4})([0-9]{3})/\1.\2/; s/^\./0./; s/\.([0-9]*[1-9])?0+/.\1/; s/\.$//; s/$/ mAh/' # result: 1429 mAh # With the actual file: cat /sys/class/power_supply/battery/charge_now | sed -E -e 's/([0-9]{3,4})([0-9]{3})/\1.\2/; s/^\./0./; s/\.([0-9]*[1-9])?0+/.\1/; s/\.$//; s/$/ mAh/' Last edited by isarl; 05-17-2023 at 05:37 PM. |
|
![]() |
![]() |
![]() |
#994 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,688
Karma: 16307824
Join Date: Sep 2022
Device: Kobo Libra 2
|
Sadly, the units command is not available. Is it possible to run commands and store the output in variables the way you can if you're directly interacting with the shell, or are you required to perform every operation in one line? If I use one cat and one sed at a time, then it seems like I'd have to generate multiple pop-up windows to display all the information. I don't see any mention in the documentation of being able to pass the output of one command as the input for a chain_success command, either.
Alternatively, could I put everything into a shell script inside /mnt/onboard/.adds/ and then execute that with cmd_output? Last edited by Aleron Ives; 05-17-2023 at 10:01 PM. |
![]() |
![]() |
![]() |
#995 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2020
Device: Kobo Libra H20
|
|
![]() |
![]() |
![]() |
#996 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
|
That should work. It doesn't have to be in .adds/ in particular, but that seems like a logical place.
Last edited by isarl; 05-18-2023 at 09:43 AM. |
![]() |
![]() |
![]() |
#997 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
|
First off: if you have a NickelMenu entry to toggle screenshots, just try using that. It will be easier.
![]() If you don't, then… Look for the file Kobo eReader.conf, located in the .kobo/Kobo/ directory on your device. This file contains a bunch of options organized into sections. Each option is given as a “key” (a setting name) and a “value” (the current setting for that option), like this: Code:
[SectionHeader] key1=value1 key2=value2 [NewSectionHeader] anotherkey=anothervalue Code:
[FeatureSettings] Screenshots=true Code:
[FeatureSettings] ExcludeSyncFolders=\\.kobo/screensaver_old Screenshots=false NB: Your [FeatureSettings] section, or the Screenshots line, may be absent. If they are, it is safe to add them in yourself, if you are careful to match the syntax in the rest of the file. If it says “Screenshots=true” then that's why your power button won't put your device to sleep. Make sure to check your device storage to find all the screenshots you have inadvertently taken, which you may wish to delete. ![]() ![]() You may find the following NickelMenu entries, taken from the config I use on my own device, helpful. “Screenshot Status” displays a popup which simply informs you whether they are enabled or disabled. “Toggle Screenshots” does what it says: it turns them on if they're off, and it turns them off if they're on. Feel free to adjust the whitespacing if you like; these are what I find most readable in my own config file but your tastes may differ. ![]() Code:
menu_item : main : Screenshot Status : cmd_output : 500 : quiet : grep -q '^Screenshots=true$' "/mnt/onboard/.kobo/Kobo/Kobo eReader.conf" chain_success : dbg_toast : Screenshots are enabled chain_failure : dbg_toast : Screenshots are disabled menu_item : main : Toggle Screenshots : nickel_setting : toggle : screenshots Last edited by isarl; 05-18-2023 at 09:59 AM. Reason: Significantly rewrite explanation for much added clarity. |
![]() |
![]() |
![]() |
#998 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,190
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
|
|
![]() |
![]() |
![]() |
#999 | |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Quote:
![]() I can also confirm the author's suspicions about the accuracy of the raw values: it's dogshit on most devices ![]() Last edited by NiLuJe; 05-18-2023 at 01:56 PM. |
|
![]() |
![]() |
![]() |
#1000 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2020
Device: Kobo Libra H20
|
Quote:
![]() Please, could you explain this : ExcludeSyncFolders option |
|
![]() |
![]() |
![]() |
#1001 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,190
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
ExcludeSyncFolders limits the directories in which Nickel searches for content. For example, if you installed KOReader, all the image files and supported book filetypes associated with it would appear in your library if they were not excluded.
|
![]() |
![]() |
![]() |
#1002 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 287
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
|
Quote:
Code:
menu_item : main : Screensaver Status : cmd_output : 500 : quiet : test -e /mnt/onboard/.kobo/screensaver_old chain_success : dbg_toast : Screensaver is off chain_failure : dbg_toast : Screensaver is on menu_item : main : Toggle Screensaver : cmd_output : 500 : quiet : test -e /mnt/onboard/.kobo/screensaver_old chain_failure : skip : 3 chain_success : cmd_spawn : quiet: mv /mnt/onboard/.kobo/screensaver_old /mnt/onboard/.kobo/screensaver chain_success : dbg_toast : Screensaver on chain_always : skip : -1 chain_failure : cmd_spawn : quiet: mv /mnt/onboard/.kobo/screensaver /mnt/onboard/.kobo/screensaver_old chain_success : dbg_toast : Screensaver off |
|
![]() |
![]() |
![]() |
#1003 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,688
Karma: 16307824
Join Date: Sep 2022
Device: Kobo Libra 2
|
Quote:
![]() 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. # # 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/battery/capacity) v_now=$(cat /sys/class/power_supply/battery/voltage_now) v_min=$(cat /sys/class/power_supply/battery/voltage_min) v_max=$(cat /sys/class/power_supply/battery/voltage_max) c_now=$(cat /sys/class/power_supply/battery/charge_now) c_full=$(cat /sys/class/power_supply/battery/charge_full) c_dfull=$(cat /sys/class/power_supply/battery/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% ![]() You get the current battery capacity in mAh, the current percentage that the battery icon reports, the current percentage as calculated by the current / maximum mAh, the minimum, current, and maximum battery voltage, and the battery health calculated from the maximum vs the design capacity. Last edited by Aleron Ives; 05-18-2023 at 08:13 PM. |
|
![]() |
![]() |
![]() |
#1004 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 183
Karma: 158116
Join Date: Oct 2015
Device: Kobo Glo HD (landscape), Kobo Aura One
|
Quote:
|
|
![]() |
![]() |
![]() |
#1005 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,688
Karma: 16307824
Join Date: Sep 2022
Device: Kobo Libra 2
|
The list of options is here:
https://github.com/pgaskin/NickelMen...v0.5.4/res/doc There is no nickel_open for a specific book. It only allows you to open a specific menu. |
![]() |
![]() |
![]() |
Tags |
kobo, launcher, ldpreload, nickel |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kobo eReaders and Heat | PeterT | Kobo Reader | 13 | 08-02-2014 04:35 AM |
kobo arc launcher not working | lana loves books | Kobo Tablets | 8 | 03-21-2014 06:40 AM |
Orginization on kobo ereaders | crochetgeek2010 | Kobo Reader | 7 | 09-03-2013 02:13 PM |
Kobo Announces eReaders Available for Purchase on Kobo.com in Canada and US | markemark | News | 1 | 04-02-2013 01:46 PM |
Ereaders with Integrated Dictionary | poohbear_nc | Which one should I buy? | 4 | 04-08-2010 06:42 AM |