Unix Technical Forum

Hi..Challenging problem and doubt

This is a discussion on Hi..Challenging problem and doubt within the Sun Solaris Hardware forums, part of the Solaris Operating System category; --> Hi, First of all, I would like to thankful to you for giving good guidelines and encouragement to solve ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Hardware

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008, 03:01 PM
crazymoonboy
 
Posts: n/a
Default 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 (http://mulinux.dotsrc.org/lepton.html) 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 <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 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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:09 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com