#include #include #include #include #include #include #include #include #include int main() { void *map; int fd; struct fb_var_screeninfo vi; struct fb_fix_screeninfo fi; struct fb_cmap cmap; setbuf(stdout, NULL); printf("opening /dev/fb0 ... "); fd = open("/dev/fb0", O_RDWR); if (fd < 0) { perror("opening /dev/fb0 failed"); return 1; } printf("OK!\n"); printf("getting framebuffer info (screeninfo) ... "); ioctl(fd, FBIOGET_FSCREENINFO, &fi); ioctl(fd, FBIOGET_VSCREENINFO, &vi); printf("OK!\n"); printf("doing mmap ... "); map = mmap(NULL, 393216, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); if (map == MAP_FAILED) { perror("mmap(/dev/fb0) failed"); exit(0); } printf("OK!\n"); printf("getting framebuffer info (cmap) ... "); ioctl(fd, FBIOGETCMAP, &cmap); printf("OK!\n"); sleep(10); return 0; }