View Single Post
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, 144 views)
File Type: zip battstat_1.1.zip (1.2 KB, 130 views)
File Type: zip battstat_1_2.zip (1.3 KB, 121 views)
File Type: zip battstat_1_3.zip (1.6 KB, 136 views)

Last edited by MrTick; 12-09-2019 at 07:34 AM. Reason: Added changelog
MrTick is offline   Reply With Quote