Hi..Challenging problem and doubt

Hi,

First of all, I would like to thankful to you for giving good guidelines and encouragement to solve my problem. Your suggessions are very helpful to me and for my work. Thank you very much for your quick response.

I have one more doubt. i.e.,

When I am trying to execute the below Framebuffer example program in Lepton

formatting link
linux, My program is unable to read the Fixed screen information(FBIOGET_FSCREENINFO) and Variable screen information (FBIOGET_VSCREENINFO). But, it is successfully initialized and open the framebuffer (/dev/fb0) device. The same thing (problem) is repeating in RedHat Linux also. What can I do? Please show me a solution.

The below program is successfully running in SuSe Linux 9.3. But, it is not running in Lepton Linux.

The example program is:

#include #include #include #include #include

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 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, %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; }

The above program is displaying 3 errors. Those are:

Error reading fixed information Error reading variable information. Error: failed to map framebuffer device to memory.

Please show me a solution. I will be waiting for your reply. Thank you very much for considering your valuable time for me.

With regards, Chandra.

Reply to
crazymoonboy
Loading thread data ...

No specific advice, but are the kernel version numbers the same between the working and non working linux systems?

Could it be a permissions issue?

Reply to
cs_posting

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.