/*
* Android framebuffer info test
* file name: fb_test.c
* compile cmd: arm-none-linux-gnueabi-gcc -static -o fb_test fb_test.c
*
* zhangwei
* [email protected]
* 2010-03-13
*/
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
int main (void)
{
int fp=0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
fp = open ("/dev/graphics/fb0",O_RDWR);
if (fp < 0){
printf("Error : Can not open framebuffer device\n");
return 1;
}
if (ioctl(fp,FBIOGET_FSCREENINFO,&finfo)){
printf("Error reading fixed information\n");
return 2;
}
if (ioctl(fp,FBIOGET_VSCREENINFO,&vinfo)){
printf("Error reading variable information\n");
return 3;
}
printf(">>>> fb_var_screeninfo\n");
printf("xres :%d\n",vinfo.xres);
printf("yres :%d\n",vinfo.yres);
printf("xres_virtual :%d\n",vinfo.xres_virtual);
printf("yres_virtual :%d\n",vinfo.yres_virtual);
printf("xoffset :%d\n",vinfo.xoffset);
printf("yoffset :%d\n",vinfo.yoffset);
printf("bits_per_pixel :%d\n",vinfo.bits_per_pixel);
printf("grayscale :%d\n",vinfo.grayscale);
printf("nonstd :%d\n",vinfo.nonstd);
printf("activate :%d\n",vinfo.activate);
printf("height :%d\n",vinfo.height);
printf("width :%d\n",vinfo.width);
printf("accel_flags :%d\n",vinfo.accel_flags);
printf("pixclock :%d\n",vinfo.pixclock);
printf("left_margin :%d\n",vinfo.left_margin);
printf("right_margin :%d\n",vinfo.right_margin);
printf("upper_margin :%d\n",vinfo.upper_margin);
printf("lower_margin :%d\n",vinfo.lower_margin);
printf("hsync_len :%d\n",vinfo.hsync_len);
printf("vsync_len :%d\n",vinfo.vsync_len);
printf("sync :%d\n",vinfo.sync);
printf("vmode :%d\n",vinfo.vmode);
printf("rotate :%d\n",vinfo.rotate);
printf("\n");
printf(">>>> fb_fix_screeninfo\n");
printf("smem_len :%d\n",finfo.smem_len);
printf("type :%d\n",finfo.type);
printf("type_aux :%d\n",finfo.type_aux);
printf("visual :%d\n",finfo.visual);
printf("xpanstep :%d\n",finfo.xpanstep);
printf("ypanstep :%d\n",finfo.ypanstep);
printf("ywrapstep :%d\n",finfo.ywrapstep);
printf("line_length :%d\n",finfo.line_length);
printf("mmio_len :%d\n",finfo.mmio_len);
printf("accel :%d\n",finfo.accel);
close (fp);
return 0;
}
|