wiki:jazz/09-02-01

Version 1 (modified by jazz, 15 years ago) (diff)

--

2009-02-01

BUGFIX: jfbterm (5)

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>       // include frame buffer header files
#include <sys/ioctl.h>

int main(void)
{
  int fbfd = 0 ;            // frame buffer file description

  /* Get device independent unchangeable information about a frame buffer
   * device and a specific video mode by FBIOGET_FSCREENINFO ioctl. */
  struct  fb_fix_screeninfo finfo;

  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("Succesfully Read the Fixed Screen Information\n");
  }

  printf("fb_fix_screeninfo.smem_len = %d\n", finfo.smem_len);
  printf("fb_fix_screeninfo.mmio_len = %d\n", finfo.mmio_len);
}