充电态权威源 mp2731-charger/status(修 battery/status 撒谎恒 Discharging)
真机实测:设备充电中但 battery/status 恒 Discharging;权威源为 mp2731-charger/status(Charging/Full),回退链 fusb302-typec-source/online==1 → 旧逻辑 battery/status==Charging || ac/online==1。电量仍读 battery/capacity。 - meow_svc_power: battery/status 命令充电判定走权威链(MEOW_PS_DIR 可重定向供宿主自测); svc_power_authtest 补 6 用例(mp2731 Charging/Full/Discharging + 两级回退)全 PASS - SDK meow_ui_sys: 状态栏充电态同权威链 - launcher util.c: 抽 batt_is_charging() 公共判定;meow_sys_light 1s 轻刷补充电态(插拔实时) - bootmenu 无充电判定(仅读 capacity)/MeowPanel 透传 power 服务:均无需改 - 真机验证(充电窗口):新二进制 battery=88%(Charging),对照固件内旧版 88%(Discharging) - hello/files/ncm 随 meow_ui.a(af6703f2) 重链已热更到卡(.new+mv,md5 对核一致) md5: meow_svc_power 39ae3aa2 / meow_launcherd 2aa61780 / hello 2444c151 / files 691db88b / ncm 89da63ed(仅重链,源码未动)
This commit is contained in:
1 parent
793a807ce3
commit
f149e24f28
13 files changed
+114
-12
No files matched your search
Binary file not shown.
@@ -747,15 +747,31 @@ static int wifi_signal_level(void)
|
||||
}
|
||||
|
||||
|
||||
/* 充电态权威判定(真机实测 2026-09-01:battery/status 恒 Discharging 撒谎):
|
||||
* 1) mp2731-charger/status(Charging/Full=充电中)为权威;
|
||||
* 2) 不可读回退 fusb302-typec-source/online==1(USB-C PD 控制器插线检测);
|
||||
* 3) 再回退旧逻辑 battery/status==Charging || ac/online==1。
|
||||
* 返回 1=充电 0=未充电。 */
|
||||
static int batt_is_charging(void)
|
||||
{
|
||||
char st[16];
|
||||
read_sys_str("/sys/class/power_supply/mp2731-charger/status", st, sizeof st);
|
||||
if (st[0]) return (strstr(st, "Charg") || strstr(st, "Full")) ? 1 : 0;
|
||||
int onl = read_file_int("/sys/class/power_supply/fusb302-typec-source/online");
|
||||
if (onl >= 0) return (onl == 1) ? 1 : 0;
|
||||
read_sys_str("/sys/class/power_supply/battery/status", st, sizeof st);
|
||||
if (strstr(st, "Charg") || strstr(st, "Full")) return 1;
|
||||
return read_file_int("/sys/class/power_supply/ac/online") == 1 ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/* 全量重抓(进 MeowOS 时调用一次;阻塞可接受)。绝不放进 10ms 主循环。 */
|
||||
void meow_sys_refresh(void)
|
||||
{
|
||||
load_meowos_version(); /* M2.47:读 /etc/meowos_version(单一数据源,每次刷新对齐) */
|
||||
int b = read_file_int("/sys/class/power_supply/battery/capacity");
|
||||
g_sys.batt = (b >= 0 && b <= 100) ? b : -1;
|
||||
char st[16];
|
||||
read_sys_str("/sys/class/power_supply/battery/status", st, sizeof st);
|
||||
g_sys.charging = (strstr(st, "Charg") || strstr(st, "Full")) ? 1 : 0;
|
||||
g_sys.charging = batt_is_charging();
|
||||
g_sys.batt_mv = read_file_int("/sys/class/power_supply/battery/voltage_now") / 1000;
|
||||
|
||||
/* WiFi:wifi_on=网卡管理态 up(射频开);wifi_connected=operstate up(已关联 AP)。
|
||||
@@ -820,6 +836,7 @@ void meow_sys_light(void)
|
||||
{
|
||||
int b = read_file_int("/sys/class/power_supply/battery/capacity");
|
||||
if (b >= 0 && b <= 100) g_sys.batt = b;
|
||||
g_sys.charging = batt_is_charging(); /* 插拔实时跟踪(两个小 sysfs 节点,开销可忽略) */
|
||||
char op[16];
|
||||
read_sys_str("/sys/class/net/wlan0/operstate", op, sizeof op);
|
||||
g_sys.wifi_connected = !strcmp(op, "up") ? 1 : 0;
|
||||
|
||||
Reference in new issue
Block a user