WIP checkpoint (M2.53→M2.54 工作区): 字体归MeowOS/fonts+SDK跟随+多字体(进行中)+boot板载+状态栏28+亮度/音量修复+文档刷新
This commit is contained in:
1 parent
245bee2946
commit
064635b3c4
44 files changed
+2834
-308
No files matched your search
Binary file not shown.
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* M2 诊断 · 信号记录 hook(仅记录,不改行为;排查「HibyOS 播放器 UI 触发关机/升级 →
|
||||
* 卡最后一帧但系统没真关机/SSH 能连」第一步):supervisor 加 bm_log() 写 TF 卡
|
||||
* MeowAPPs/logs/meow_boot_<bootts>.log(卡不可用降级 stderr),记录 supervisor
|
||||
* MeowOS/logs/meow_boot_<bootts>.log(卡不可用降级 stderr),记录 supervisor
|
||||
* **收到**的信号(SIGTERM/SIGINT/SIGQUIT/SIGHUP——handler 只置标志,主循环 log 后
|
||||
* signal(s,SIG_DFL)+raise(s) 恢复默认重抛,与未加 hook 一致终止)、**发出**给播放器的
|
||||
* 信号(SIGSTOP/SIGCONT/SIGTERM/SIGKILL)、以及**播放器退出原因**(WTERMSIG/WEXITSTATUS)。
|
||||
@@ -95,7 +95,7 @@
|
||||
#define DEV_TOUCH "/dev/input/event1" /* goodix-ts(未 grab,可共享读) */
|
||||
#define FB_DEV "/dev/fb0"
|
||||
#define MEOWAPPS "/usr/data/mnt/sd_0/MeowAPPs"
|
||||
#define CONF_FILE MEOWAPPS "/meow.conf" /* TF 卡配置:boot_default/boot_timeout_ms/boot_menu */
|
||||
#define CONF_FILE MEOWAPPS "/meow.conf" /* TF 卡配置:boot_timeout_ms/boot_menu/bg_color;boot_default 权威在板载 /data/meow_boot_default */
|
||||
#define MODE_FILE "/tmp/meow_boot_mode" /* 开机模式标记(tmpfs,开机清空) */
|
||||
#define PLAYER_BIN "/usr/bin/hiby_player"
|
||||
#define PLAYER_LOG "/usr/data/meow_player.log"
|
||||
@@ -410,7 +410,7 @@ static int amixer_vol(int numid)
|
||||
return v;
|
||||
}
|
||||
|
||||
/* 40px 状态栏:行1=时钟(左) 电量% WIFI BT(右),行2=VOL nn%(左),y=40 分隔线 */
|
||||
/* 28px 状态栏:行1=时钟(左) 电量% WIFI BT(右),行2=VOL nn%(左),y=28 分隔线(40→28,用户定) */
|
||||
static void draw_statusbar(uint32_t bg)
|
||||
{
|
||||
char timebuf[16], right[48];
|
||||
@@ -441,16 +441,16 @@ static void draw_statusbar(uint32_t bg)
|
||||
char bt[8] = "";
|
||||
if (bluetooth_present()) snprintf(bt, sizeof bt, "BT");
|
||||
|
||||
draw_text(8, 4, timebuf, 1, 0x9FB8D9);
|
||||
draw_text(8, 2, timebuf, 1, 0x9FB8D9);
|
||||
if (batt[0]) strcat(right, batt);
|
||||
if (wifi[0]) { if (right[0]) strcat(right, " "); strcat(right, wifi); }
|
||||
if (bt[0]) { if (right[0]) strcat(right, " "); strcat(right, bt); }
|
||||
if (right[0]) {
|
||||
int rx = fb_xres - 8 - (int)strlen(right) * 6;
|
||||
draw_text(rx, 4, right, 1, 0x9FB8D9);
|
||||
draw_text(rx, 2, right, 1, 0x9FB8D9);
|
||||
}
|
||||
if (vol[0]) draw_text(8, 22, vol, 1, 0x9FB8D9);
|
||||
fill_rect(0, 40, fb_xres, 1, 0x333355); /* 分隔线(移至 y=40) */
|
||||
if (vol[0]) draw_text(8, 14, vol, 1, 0x9FB8D9);
|
||||
fill_rect(0, 28, fb_xres, 1, 0x333355); /* 分隔线(移至 y=28) */
|
||||
}
|
||||
|
||||
/* 只刷时钟数字(每秒一次,不弹 amixer/不碰菜单体) */
|
||||
@@ -463,43 +463,70 @@ static void draw_clock(uint32_t bg)
|
||||
snprintf(timebuf, sizeof timebuf, "%02d:%02d:%02d",
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
int w = (int)strlen(timebuf) * 6;
|
||||
fill_rect(4, 2, 8 + w, 12, bg);
|
||||
draw_text(8, 4, timebuf, 1, 0x9FB8D9);
|
||||
fill_rect(4, 0, 8 + w, 12, bg);
|
||||
draw_text(8, 2, timebuf, 1, 0x9FB8D9);
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
/* 配置:boot_default / boot_timeout_ms / boot_menu(从 TF 卡尽力读) */
|
||||
/* 配置:boot_default / boot_timeout_ms / boot_menu / bg_color */
|
||||
/* boot_default:权威 = 板载 /data/meow_boot_default(O_TRUNC 单值、不写 TF 卡);
|
||||
* meow.conf 的 boot_default= 仅作无板载标记时的兜底(不新增写入,见 set_boot_default_meow)。 */
|
||||
/* ================================================================== */
|
||||
static int cfg_boot_default = DEF_BOOT_DEFAULT;
|
||||
static long cfg_boot_timeout_ms = DEF_BOOT_TIMEOUT_MS;
|
||||
static int cfg_boot_menu = DEF_BOOT_MENU;
|
||||
static uint32_t cfg_bg = DEF_BG;
|
||||
|
||||
/* 读板载 /data/meow_boot_default(开机默认权威标记)。返回 0/1;-1=不存在/非法。 */
|
||||
static int read_boot_default_onboard(void)
|
||||
{
|
||||
int fd = open("/data/meow_boot_default", O_RDONLY);
|
||||
if (fd < 0) return -1;
|
||||
char buf[8];
|
||||
int n = read(fd, buf, sizeof buf - 1);
|
||||
close(fd);
|
||||
if (n <= 0) return -1;
|
||||
buf[n] = 0;
|
||||
int v = atoi(buf);
|
||||
return (v == 0 || v == 1) ? v : -1;
|
||||
}
|
||||
|
||||
static void load_config(void)
|
||||
{
|
||||
cfg_boot_default = DEF_BOOT_DEFAULT;
|
||||
cfg_boot_timeout_ms = DEF_BOOT_TIMEOUT_MS;
|
||||
cfg_boot_menu = DEF_BOOT_MENU;
|
||||
cfg_bg = DEF_BG;
|
||||
int has_conf = 1;
|
||||
FILE *f = fopen(CONF_FILE, "r");
|
||||
if (!f) { fprintf(stderr, "bootmenu: no %s, using defaults\n", CONF_FILE); return; }
|
||||
char buf[128];
|
||||
while (fgets(buf, sizeof buf, f)) {
|
||||
if (!strncmp(buf, "boot_default=", 13)) {
|
||||
cfg_boot_default = atoi(buf + 13);
|
||||
if (cfg_boot_default != 0 && cfg_boot_default != 1) cfg_boot_default = DEF_BOOT_DEFAULT;
|
||||
} else if (!strncmp(buf, "boot_timeout_ms=", 16)) {
|
||||
long t = atol(buf + 16);
|
||||
if (t >= 500 && t <= 60000) cfg_boot_timeout_ms = t;
|
||||
} else if (!strncmp(buf, "boot_menu=", 10)) {
|
||||
int m = atoi(buf + 10);
|
||||
if (m == 0 || m == 1) cfg_boot_menu = m;
|
||||
} else if (!strncmp(buf, "bg_color=", 9)) {
|
||||
unsigned int v;
|
||||
if (sscanf(buf + 9, "%x", &v) == 1) cfg_bg = v & 0xFFFFFF;
|
||||
if (!f) { fprintf(stderr, "bootmenu: no %s, using defaults\n", CONF_FILE); has_conf = 0; }
|
||||
if (has_conf) {
|
||||
char buf[128];
|
||||
while (fgets(buf, sizeof buf, f)) {
|
||||
if (!strncmp(buf, "boot_default=", 13)) {
|
||||
/* 板载 /data/meow_boot_default 为权威;此处仅作无板载标记时的兜底(不再新增写入)。 */
|
||||
cfg_boot_default = atoi(buf + 13);
|
||||
if (cfg_boot_default != 0 && cfg_boot_default != 1) cfg_boot_default = DEF_BOOT_DEFAULT;
|
||||
} else if (!strncmp(buf, "boot_timeout_ms=", 16)) {
|
||||
long t = atol(buf + 16);
|
||||
if (t >= 500 && t <= 60000) cfg_boot_timeout_ms = t;
|
||||
} else if (!strncmp(buf, "boot_menu=", 10)) {
|
||||
int m = atoi(buf + 10);
|
||||
if (m == 0 || m == 1) cfg_boot_menu = m;
|
||||
} else if (!strncmp(buf, "bg_color=", 9)) {
|
||||
unsigned int v;
|
||||
if (sscanf(buf + 9, "%x", &v) == 1) cfg_bg = v & 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
/* 板载标记优先(权威):覆盖 meow.conf 兜底/编译默认。 */
|
||||
int ob = read_boot_default_onboard();
|
||||
if (ob == 0 || ob == 1) {
|
||||
if (ob != cfg_boot_default)
|
||||
fprintf(stderr, "bootmenu: boot_default onboard=%d (override %d)\n", ob, cfg_boot_default);
|
||||
cfg_boot_default = ob;
|
||||
}
|
||||
fclose(f);
|
||||
fprintf(stderr, "bootmenu: cfg boot_default=%d timeout_ms=%ld boot_menu=%d bg=%06x\n",
|
||||
cfg_boot_default, cfg_boot_timeout_ms, cfg_boot_menu, cfg_bg);
|
||||
}
|
||||
@@ -519,10 +546,10 @@ static unsigned long long now_ms(void)
|
||||
* - 借鉴 launcher log_open_card/logmsg 思路,但**不共享 /tmp/meow_bootts**
|
||||
* (launcher 缓存的是完整基名 meow_<ts>,直接复读会拼成 meow_boot_meow_…);
|
||||
* 每次自行按 /proc/uptime 推开机时间戳,同一 boot 内文件名恒定。
|
||||
* - 写 /usr/data/mnt/sd_0/MeowAPPs/logs/meow_boot_<bootts>.log(O_APPEND|O_CREAT 0644)。
|
||||
* - 写 /usr/data/mnt/sd_0/MeowOS/logs/meow_boot_<bootts>.log(O_APPEND|O_CREAT 0644)。
|
||||
* - 卡不可用(未挂载/不可写)→ 降级 stderr。**只记录,不改任何行为。**
|
||||
* ================================================================== */
|
||||
#define BM_LOG_DIR "/usr/data/mnt/sd_0/MeowAPPs/logs"
|
||||
#define BM_LOG_DIR "/usr/data/mnt/sd_0/MeowOS/logs"
|
||||
static int bm_log_fd = -1;
|
||||
static char bm_log_file[256] = "";
|
||||
|
||||
@@ -1287,21 +1314,12 @@ static void write_mode(int choice)
|
||||
|
||||
/* Bug 1:选 MeowOS → 把它持久为开机默认(写 spec 标记 + meow.conf boot_default=0),与 launcher
|
||||
* «回到HibyOS»(set_boot_default_hiby 写 boot_default=1)对称。效果:本次选中即进 MeowOS 主屏,且
|
||||
* 下一次开机选单默认 MeowOS(不再「选 MeowOS 仍落回 HibyOS」)。追加一行,bootmenu 逐行读、最后一行生效。 */
|
||||
* 下一次开机选单默认 MeowOS(不再「选 MeowOS 仍落回 HibyOS」)。
|
||||
* 权威标记 = 板载 /data/meow_boot_default(O_TRUNC 单值);meow.conf 不再写/承载 boot_default。 */
|
||||
static void set_boot_default_meow(void)
|
||||
{
|
||||
int fd = open("/data/meow_boot_default", O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd >= 0) { write(fd, "0\n", 2); close(fd); fprintf(stderr, "bootmenu: /data/meow_boot_default=0\n"); }
|
||||
char conf[256];
|
||||
snprintf(conf, sizeof conf, "%s/meow.conf", MEOWAPPS);
|
||||
fd = open(conf, O_WRONLY | O_CREAT | O_APPEND, 0644);
|
||||
if (fd >= 0) {
|
||||
if (write(fd, "boot_default=0\n", 15) < 0) fprintf(stderr, "bootmenu: write boot_default failed\n");
|
||||
close(fd);
|
||||
fprintf(stderr, "bootmenu: boot_default=0 appended to meow.conf\n");
|
||||
} else {
|
||||
fprintf(stderr, "bootmenu: meow.conf open failed: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
|
||||
Reference in new issue
Block a user