Battery Health Diagnostics & Cycle Monitor icon

Battery Health Diagnostics & Cycle Monitor

v0.5guidecommunity

Real-time battery health calculation daemon polling Linux power supply sysfs nodes to track charge cycles, true capacity retention, and health percentages.

Community Package•Battery & Power Management•by Wo Bu Shi Chen Sang & Duo Rou Yu Yuan Pu Tao•GPL-3.0-only•Updated Jan 1, 2023
Platforms:
✓ Magisk✓ KernelSU✓ APatch
Download v0.5Starting download...
battery-health-query-v0.5.zip

Overview

Battery Health Diagnostics & Cycle Monitor (authored by Wo Bu Shi Chen Sang & Duo Rou Yu Yuan Pu Tao) provides accurate, hardware-level battery health information on rooted Android devices.

Instead of relying on proprietary OEM health estimates or third-party battery monitor apps that keep wakelocks active, this module interacts directly with kernel sysfs nodes exposed by the hardware power management IC (PMIC).


Technical Architecture & How It Works

1. Kernel Sysfs Gas-Gauge Reading

The diagnostic script (custom_script.sh) evaluates several hardware sysfs nodes depending on the SoC platform:

# Qualcomm State of Health (SOH) register
soh=$(cat /sys/class/qcom-battery/soh 2>/dev/null)

# Factory design capacity (uAh -> mAh)
charge_full_design=$(( $(cat /sys/class/power_supply/battery/charge_full_design) / 1000 ))

# Current maximum charge retention capacity (uAh -> mAh)
charge_full=$(( $(cat /sys/class/power_supply/battery/charge_full) / 1000 ))

# True capacity retention percentage
retention=$(( (charge_full * 100) / charge_full_design ))

2. Live Magisk Description Injection

Rather than requiring an APK interface, the daemon dynamically updates its own module.prop description field:

sed -i "s/^description=.*/description=[${timestamp}] SOH: ${soh}% | Real: ${charge_full}\/${charge_full_design} mAh (${retention}%)/" $custombattery_Path/module.prop

Users can observe their current battery health simply by opening Magisk Manager, KernelSU Manager, or APatch WebUI.


Verification & Manual Query

Execute the standalone diagnostic script directly via root terminal:

su -c sh /data/adb/modules/custom.battery/点我直接查询.sh

Frequently Asked Questions

Why is the displayed health percentage different from OEM system settings?

OEM battery health algorithms frequently apply software smoothing and conservative calibration curves. This module queries raw kernel sysfs nodes directly from the battery gas-gauge IC, delivering true unadulterated hardware telemetry.

Does this module run a heavy background loop?

No. The daemon updates metrics on a gentle timer and upon boot completion, consuming 0% idle CPU and zero measurable battery power.