From: Crazy B. <cra...@ya...> - 2006-01-23 07:22:12
|
Hi, I am using Lepton Floppy Linux and Redhat Linux. When I am trying to execute the Framebuffer sample program, It is displaying the below error message: The framebuffer device was opened successfully. Error reading fixed screen information. Error reading variable screen information. Actually, It is opening Framebuffer (/dev/fb0) device successfully. But, it is unable to read the Fixed screen information (FBIOGET_FSCREENINFO) and Variable screen information (FBIOGET_VSCREENINFO). fbset command is also not working. What can I do? Please give me the solution. Here, I am giving the sample code of framebuffer. Please run this and see the output. #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <linux/fb.h> #include <sys/mman.h> int main(void) { int fbfd = 0; struct fb_var_screeninfo vinfo; struct fb_fix_screeninfo finfo; long int screensize = 0; char *fbp = 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 screen information.\n"); exit(2); } else printf("\nSuccesfully Read the Fixed Screen Information\n"); /* Get variable screen information */ if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) { printf("Error reading variable screen information.\n"); exit(3); } else printf("\n Successfully Read the Variable Information\n"); printf("%dx%d, %dbpp\n", 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"); munmap(fbp, screensize); close(fbfd); return 0; } I will be waiting for your reply. Thank you. With regards, Chandra. --------------------------------- What are the most popular cars? Find out at Yahoo! Autos |