fix(keys): 插孔消抖 + 音量 ramp 3s 上限 + 亮度写日志 — 耳机插拔 ADC 幽灵音量键修复
真机实证(meow_20260901_034946.log): 4.4 插入瞬间电气瞬态在 jz_adc_aux(event2)
产生 VOL_UP 幽灵按住, vol_ramp 24%→上限50 (225391 ramp 起→227213 爬满,
紧随 audiod jack changed). 修(限 meow_launcherd/+meow_watchdog/):
① launcher audio.c + watchdog 各自读 /sys/class/switch/{headset,balance}/state
(节流缓存 1s/500ms, 热路径不每圈读文件), 变化后 800ms 内忽略音量键边沿
(vol_ramp_begin 不起/在爬 ramp 中止/wd_vol_adj 单步忽略)
② ramp 总时长上限 VOL_RAMP_MAX_MS=3000 兜底防一次幽灵打满(正常长按 24→50 ~1.4s 不伤)
③ write_brightness(val,src) 全 10 调用点带源+逐写 logmsg, 亮度跳上限下次可定位
(grep 全库: 写 backlight 仅 launcher/watchdog/svc_power/bootmenu, 无确定 255 路径)
宿主: 新 test_vol_ramp_jack 15/15 PASS(单击/长按回归+3s cap+消抖忽略/中止/恢复);
test_wd_fw 17/17 + test_settings_brightness + test_notif_tf PASS; MIPS -Wall -Wextra 0 warning
(顺带修 watchdog 既有 sys/poll.h→poll.h 重定向 warning).
watchdog 已热更设备 /usr/data(baa997ea); launcher 7be1d4eb 待固件. fw_content.conf 已更新.
遗留: SDK meow_ui_input.c 音量键路径需同款消抖(sdk/ 有主未动)
This commit is contained in:
1 parent
44d170413d
commit
4bafdb5d69
13 files changed
+348
-20
No files matched your search
@@ -41,7 +41,7 @@ void apply_user_brightness(void)
|
||||
}
|
||||
int v = meow_settings_brightness_clamped();
|
||||
if (v <= 0) v = 60; /* 防御:clamp 后不可能 ≤0,仅兜底 */
|
||||
write_brightness(v);
|
||||
write_brightness(v, "apply_user_brightness");
|
||||
g_sys.brightness = v;
|
||||
meow_brightness_pending = 0;
|
||||
logmsg("apply user brightness (MeowOS takeover) -> %d", v);
|
||||
@@ -73,13 +73,16 @@ static void write_file(const char *path, const char *val)
|
||||
}
|
||||
|
||||
|
||||
void write_brightness(int val)
|
||||
void write_brightness(int val, const char *src)
|
||||
{
|
||||
/* 亮度幽灵排查(2026-09-01:用户报告插耳机瞬间亮度自己跳到 raw 上限,写者未知):
|
||||
* 每次写背光都留值+调用源线索,下次「亮度自己跳」可直接定位写者。 */
|
||||
char buf[8];
|
||||
int l = snprintf(buf, sizeof buf, "%d\n", val);
|
||||
int fd = open(BACKLIGHT, O_WRONLY);
|
||||
if (fd < 0) { logmsg("backlight open fail: %s", strerror(errno)); return; }
|
||||
if (write(fd, buf, l) < 0) logmsg("backlight write %d: %s", val, strerror(errno));
|
||||
if (fd < 0) { logmsg("backlight <- %d (src=%s) open fail: %s", val, src, strerror(errno)); return; }
|
||||
if (write(fd, buf, l) < 0) logmsg("backlight <- %d (src=%s): %s", val, src, strerror(errno));
|
||||
else logmsg("backlight <- %d (src=%s)", val, src);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
@@ -107,7 +110,7 @@ void ensure_backlight(void)
|
||||
}
|
||||
int target = (saved_brightness > 0) ? saved_brightness : 60;
|
||||
logmsg("backlight off (cur=%d bl_power=%d) -> %d", cur, blp, target);
|
||||
if (cur <= 0) write_brightness(target);
|
||||
if (cur <= 0) write_brightness(target, "ensure_backlight");
|
||||
if (blp > 0) write_file(BACKLIGHT_POWER, "0\n");
|
||||
}
|
||||
|
||||
@@ -126,7 +129,7 @@ void restore_backlight(void)
|
||||
{
|
||||
if (menu_opened_blank) {
|
||||
logmsg("restore: panel was blanked at menu open, re-blank (0 + FBIOBLANK 4)");
|
||||
write_brightness(0);
|
||||
write_brightness(0, "restore_backlight(re-blank)");
|
||||
int fbfd = open(FB_DEV, O_RDWR);
|
||||
if (fbfd >= 0) { ioctl(fbfd, FBIOBLANK, 4); close(fbfd); }
|
||||
menu_opened_blank = 0;
|
||||
@@ -138,7 +141,7 @@ void restore_backlight(void)
|
||||
int target = (saved_brightness > 0) ? saved_brightness : 60;
|
||||
logmsg("restore backlight (cur=%d bl_power=%d) -> %d (saved=%d)",
|
||||
cur, blp, target, saved_brightness);
|
||||
if (cur <= 0) write_brightness(target);
|
||||
if (cur <= 0) write_brightness(target, "restore_backlight");
|
||||
if (blp > 0) write_file(BACKLIGHT_POWER, "0\n");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user