lcd 显示屏出现问题
以下代码[*]#include <unistd.h>
[*]#include <stdio.h>
[*]#include <stdlib.h>
[*]#include <fcntl.h>
[*]#include <string.h>
[*]#include <linux/fb.h>
[*]#include <sys/mman.h>
[*]#include <sys/ioctl.h>
[*]#include <arpa/inet.h>
[*]int main ( int argc, char *argv[] )
[*]{
[*] int fbfd = 0;
[*] struct fb_var_screeninfo vinfo;
[*] struct fb_fix_screeninfo finfo;
[*] long int screensize = 0;
[*] struct fb_bitfield red;
[*] struct fb_bitfield green;
[*] struct fb_bitfield blue;
[*]
[*] //打开显示设备
[*] fbfd = open("/dev/fb0", O_RDWR);
[*] if (!fbfd)
[*] {
[*] printf("Error: cannot open framebuffer device.\n");
[*] exit(1);
[*] }
[*]
[*] if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo))
[*] {
[*] printf("Error:reading fixed information.\n");
[*] exit(2);
[*] }
[*]
[*] if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo))
[*] {
[*] printf("Error: reading variable information.\n");
[*] exit(3);
[*] }
[*]
[*] printf("R:%d,G:%d,B:%d \n", vinfo.red, vinfo.green, vinfo.blue );
[*]
[*] printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel );
[*] xres = vinfo.xres;
[*] yres = vinfo.yres;
[*] bits_per_pixel = vinfo.bits_per_pixel;
[*]
[*] //计算屏幕的总大小(字节)
[*] screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
[*] printf("screensize=%d byte\n",screensize);
[*]
[*] //对象映射
[*] fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
[*] if ((int)fbp == -1)
[*] {
[*] printf("Error: failed to map framebuffer device to memory.\n");
[*] exit(4);
[*] }
[*]
[*] printf("sizeof file header=%d\n", sizeof(BITMAPFILEHEADER));
[*]
[*] printf("into show_bmp function\n");
[*]
[*] //显示图像
[*] show_bmp();
[*]
[*] //删除对象映射
[*] munmap(fbp, screensize);
[*] close(fbfd);
[*] return 0;
[*]}
Error:reading fixed information.
在2440开发板上运行的时候,报错 这是怎么回事啊,这个程序不是通用的吗:'( 楼主,这是你自己编写的程序? 飞凌-unix 发表于 2014-7-3 08:51 static/image/common/back.gif
楼主,这是你自己编写的程序?
不是,网上搜的 哪来的不重要吧,重要的是问题在哪? 那你也不能随便找个程序就来用吧! 建议你先把程序源码看懂是怎么回事,你也不能随便下载一个程序就用吧
页:
[1]