|
这是我的程序,我要改变虚拟分辨率的大小,总是不能成功,希望大侠吗给我解释下,是我内核编译的不支持还是硬件不支持呢!?
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fb.h>
#include <errno.h>
int main ()
{
int fp=0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
fp = open ("/dev/fb0",O_RDWR);
if (fp < 0)
{
printf("Error : Can not open framebuffer device\n");
exit(1);
}
if (ioctl(fp,FBIOGET_FSCREENINFO,&finfo))
{
printf("Error reading fixed information\n");
exit(2);
}
if (ioctl(fp,FBIOGET_VSCREENINFO,&vinfo))
{
printf("Error reading variable information\n");
exit(3);
}
printf("The mem is :%d\n",finfo.smem_len);
printf("The line_length is :%d\n",finfo.line_length);
printf("The xres is :%d\n",vinfo.xres);
printf("The yres is :%d\n",vinfo.yres);
printf("bits_per_pixel is :%d\n",vinfo.bits_per_pixel);
printf("The xoffset is :%d\n",vinfo.xoffset);
printf("The yoffset is :%d\n",vinfo.yoffset);
//修改偏移地址
vinfo.xoffset=100;
vinfo.yoffset=100;
if (ioctl(fp,FBIOPUT_VSCREENINFO,&vinfo))
{
printf("Error reading variable information\n");
exit(3);
}
//重新读取修改的值
if (ioctl(fp,FBIOGET_VSCREENINFO,&vinfo))
{
printf("Error reading variable information\n");
exit(3);
}
printf("The mem is :%d\n",finfo.smem_len);
printf("The line_length is :%d\n",finfo.line_length);
printf("The xres is :%d\n",vinfo.xres);
printf("The yres is :%d\n",vinfo.yres);
printf("bits_per_pixel is :%d\n",vinfo.bits_per_pixel);
printf("The xoffset is :%d\n",vinfo.xoffset);
printf("The yoffset is :%d\n",vinfo.yoffset);
close (fp);
return 0;
} |
|