Quantcast
Channel: MobileRead Forums - Kindle Developer's Corner
Viewing all articles
Browse latest Browse all 4422

Monitoring battery charge

$
0
0
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.

Attached Files
File Type: zip battstat.zip (1.1 KB)
File Type: zip battstat_1.1.zip (1.2 KB)

Viewing all articles
Browse latest Browse all 4422

Trending Articles