Files
MeowOS Dev 245bee2946 MeowOS for HiBy R3 Pro II — 公共发布版本(历史已重置)
• 全新单提交:清除含敏感信息的旧历史(sudo 口令、内网 IP、SSH 密钥路径、热点 SSID、设备 MAC)
• 本地开发文档/测试记录/构建脚本全部移入 gitignored 的 devdocs/ 与 scripts/build/(不入库)
• 保留:MeowOS 源码(launcher/watchdog/bootmenu/meow_svcd/SDK)、项目规范文档、mips-repo
增补组件:SDK 统一日志+通知 API、meow_svcd 服务管理器、mips-repo 软件仓库
2026-08-30 01:12:34 +08:00

65 lines
2.3 KiB
C

/* fbpantest2.c — does fb0 actually PAN? Print ioctl return + errno.
* Key question: is the display pannable via FBIOPAN_DISPLAY/FBIOPUT_VSCREENINFO,
* or is the double buffer flipped by direct LCDC register writes (desar) that
* the fb var yoffset never reflects?
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stdint.h>
#define GETV 0x4600
static int get_info(int fd, uint32_t *yoff, uint32_t *yres) {
unsigned char v[160]; memset(v,0,sizeof v);
if (ioctl(fd, GETV, v) < 0) return -1;
*yres = *(uint32_t*)(v + 4);
*yoff = *(uint32_t*)(v + 20);
return 0;
}
int main(void) {
int fd = open("/dev/fb0", O_RDWR);
if (fd < 0) { perror("open"); return 1; }
uint32_t orig=0,yres=0; get_info(fd,&orig,&yres);
uint32_t target=(orig<yres)?yres:0;
printf("orig yoffset=%u yres=%u target=%u\n", orig,yres,target);
unsigned char v[160];
memset(v,0,sizeof v);
ioctl(fd, GETV, v);
*(uint32_t*)(v+16)=0; *(uint32_t*)(v+20)=target;
v[84]=0; /* activate = 0 (implies activate-on-next?) */
errno=0;
int r6=ioctl(fd, 0x4606, v);
int e6=errno; errno=0;
uint32_t now=0; get_info(fd,&now,&yres);
printf("PAN_DISPLAY(0x4606) r=%d errno=%d(%s) -> yoffset now %u\n", r6,e6,strerror(e6),now);
if (now==target) { errno=0; ioctl(fd,0x4606,v); /* restore */ }
/* now try PUT_VSCREENINFO with activate=FB_ACTIVATE_NOW */
memset(v,0,sizeof v); ioctl(fd, GETV, v);
*(uint32_t*)(v+16)=0; *(uint32_t*)(v+20)=target;
errno=0;
int r1=ioctl(fd, 0x4601, v);
int e1=errno; errno=0;
get_info(fd,&now,&yres);
printf("PUT_VSCREENINFO(0x4601) r=%d errno=%d(%s) -> yoffset now %u\n", r1,e1,strerror(e1),now);
if (now==target) { memset(v,0,sizeof v); ioctl(fd,GETV,v); *(uint32_t*)(v+16)=0; *(uint32_t*)(v+20)=orig; ioctl(fd,0x4601,v); }
/* getid; also read FBIOGET_DISPINFO(0x4618) */
unsigned char d[256]; memset(d,0,sizeof d);
errno=0;
int rd=ioctl(fd, 0x4618, d);
int ed=errno;
printf("GET_DISPINFO(0x4618) r=%d errno=%d(%s)\n", rd, ed, strerror(ed));
for (unsigned i=0;i<64;i+=4){ if (*(uint32_t*)(d+i)) printf(" d[%u]=%08x\n", i, *(uint32_t*)(d+i)); }
close(fd);
return 0;
}