当前位置: 技术问答>linux和unix
failed to map framebuffer device to memory
来源: 互联网 发布时间:2017-05-19
本文导语: 现在在做视频采集,编译没问题,但是运行的时候却出先以下错误,请指点。 环境:vmware+ubuntu10.04(2.6.32) The framebuffer device was opened successfully. 640x480, 4bpp Error: failed to map framebuffer device to memory. 我已经用超...
现在在做视频采集,编译没问题,但是运行的时候却出先以下错误,请指点。
环境:vmware+ubuntu10.04(2.6.32)
The framebuffer device was opened successfully.
640x480, 4bpp
Error: failed to map framebuffer device to memory.
我已经用超级用户登录了,并且也存在 /dev/fb0
以下是程序:
#include
#include
#include
#include
#include
int main()
{
int fbfd = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char *fbp = 0;
int x = 0, y = 0;
long int location = 0;
// Open the file for reading and writing
fbfd = open("/dev/fb0", O_RDWR);
if (!fbfd) {
printf("Error: cannot open framebuffer device.n");
exit(1);
}
printf("The framebuffer device was opened successfully.n");
// Get fixed screen information
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) {
printf("Error reading fixed information.n");
exit(2);
}
// Get variable screen information
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {
printf("Error reading variable information.n");
exit(3);
}
printf("%dx%d, %dbppn", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel );
// Figure out the size of the screen in bytes
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
// Map the device to memory
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("The framebuffer device was mapped to memory successfully.n");
x = 100; y = 100; // Where we are going to put the pixel
// Figure out where in memory to put the pixel
for ( y = 100; y
环境:vmware+ubuntu10.04(2.6.32)
The framebuffer device was opened successfully.
640x480, 4bpp
Error: failed to map framebuffer device to memory.
我已经用超级用户登录了,并且也存在 /dev/fb0
以下是程序:
#include
#include
#include
#include
#include
int main()
{
int fbfd = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char *fbp = 0;
int x = 0, y = 0;
long int location = 0;
// Open the file for reading and writing
fbfd = open("/dev/fb0", O_RDWR);
if (!fbfd) {
printf("Error: cannot open framebuffer device.n");
exit(1);
}
printf("The framebuffer device was opened successfully.n");
// Get fixed screen information
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) {
printf("Error reading fixed information.n");
exit(2);
}
// Get variable screen information
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {
printf("Error reading variable information.n");
exit(3);
}
printf("%dx%d, %dbppn", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel );
// Figure out the size of the screen in bytes
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
// Map the device to memory
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("The framebuffer device was mapped to memory successfully.n");
x = 100; y = 100; // Where we are going to put the pixel
// Figure out where in memory to put the pixel
for ( y = 100; y
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
站内导航:
特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!
©2012-2021,