1. MTK Kernel Log 看电池信息
- healthd: battery l=83 v=4203 t=35.0 h=2 st=2 c=0 chg=u
5,103: <12>[15987.646554] (4)[396:healthd]healthd: battery l=83 v=4203 t=35.0 h=2 st=2 c=0 chg=u
37,950: <12>[16153.104002] (7)[396:healthd]healthd: battery l=84 v=4216 t=35.0 h=2 st=2 c=0 chg=u
73,572: <12>[17332.148539] (4)[396:healthd]healthd: battery l=85 v=4220 t=35.0 h=2 st=2 c=0 chg=u
120,647: <12>[18563.883006] (7)[396:healthd]healthd: battery l=86 v=4228 t=35.0 h=2 st=2 c=0 chg=u
10,864: <12>[19185.760618] (6)[396:healthd]healthd: battery l=87 v=4282 t=33.0 h=2 st=2 c=0 chg=u
21,646: <12>[19533.879429] (4)[396:healthd]healthd: battery l=88 v=4305 t=32.0 h=2 st=2 c=0 chg=u
31,624: <12>[19848.329578] (7)[396:healthd]healthd: battery l=89 v=4319 t=31.0 h=2 st=2 c=0 chg=u
40,018: <12>[20147.372360] (7)[396:healthd]healthd: battery l=90 v=4333 t=31.0 h=2 st=2 c=0 chg=u
48,666: <12>[20446.413474] (5)[396:healthd]healthd: battery l=91 v=4337 t=30.0 h=2 st=2 c=0 chg=u
56,099: <12>[20725.455383] (5)[396:healthd]healthd: battery l=92 v=4357 t=30.0 h=2 st=2 c=0 chg=u
63,030: <12>[20991.192993] (7)[396:healthd]healthd: battery l=93 v=4383 t=30.0 h=2 st=2 c=0 chg=u
69,485: <12>[21233.539805] (6)[396:healthd]healthd: battery l=94 v=4398 t=29.0 h=2 st=2 c=0 chg=u
75,258: <12>[21472.581821] (6)[396:healthd]healthd: battery l=95 v=4411 t=29.0 h=2 st=2 c=0 chg=u
81,041: <12>[21711.627340] (6)[396:healthd]healthd: battery l=96 v=4420 t=29.0 h=2 st=2 c=0 chg=u
87,369: <12>[21960.669543] (4)[396:healthd]healthd: battery l=97 v=4424 t=28.0 h=2 st=2 c=0 chg=u
94,114: <12>[22249.710015] (5)[396:healthd]healthd: battery l=98 v=4424 t=28.0 h=2 st=2 c=0 chg=u
103,583: <12>[22648.752967] (5)[396:healthd]healthd: battery l=99 v=4424 t=27.0 h=2 st=2 c=0 chg=u
110,535: <12>[22918.272997] (4)[396:healthd]healthd: battery l=100 v=4424 t=28.0 h=2 st=2 c=0 chg=u
2. 参数含义
\system\core\healthd\BatteryMonitor.cpp
healthd: battery l=83 v=4203 t=35.0 h=2 st=2 c=0 chg=u
- l 表示电池电量百分比
- v 表示电池电压
- t 表示电池温度
- h 表示电池的健康状态
- st 表示电池的状态
- chg 表示当前电池是否为(电源器充电,USB充电,无线充电,不充电)
snprintf(dmesgline, sizeof(dmesgline),
"battery l=%d v=%d t=%s%d.%d h=%d st=%d",
props.batteryLevel, props.batteryVoltage,
props.batteryTemperature < 0 ? "-" : "",
abs(props.batteryTemperature / 10),
abs(props.batteryTemperature % 10), props.batteryHealth,
props.batteryStatus);
snprintf(dmesgline + len, sizeof(dmesgline) - len, " chg=%s%s%s",
props.chargerAcOnline ? "a" : "",
props.chargerUsbOnline ? "u" : "",
props.chargerWirelessOnline ? "w" : "");
healthd_mode_ops->battery_update(&props);
return props.chargerAcOnline | props.chargerUsbOnline |
props.chargerWirelessOnline;
对应信息 adb shell dumpsys battery
Current Battery Service state:
(UPDATES STOPPED -- use 'reset' to restart)
AC powered: false
USB powered: false
Wireless powered: false
Max charging current: 500000
Max charging voltage: 5000000
Charge counter: 36
status: 2
health: 2
present: true
level: 39
scale: 100
voltage: 3865
temperature: 290
technology: Li-ion