-
-
Save gbluma/7327127 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <fcntl.h> | |
#include <linux/fb.h> | |
#include <sys/mman.h> | |
// application entry point | |
int main(int argc, char* argv[]) | |
{ | |
int fbfd = 0; // framebuffer filedescriptor | |
struct fb_var_screeninfo var_info; | |
// Open the framebuffer device file for reading and writing | |
fbfd = open("/dev/fb0", O_RDWR); | |
if (!fbfd) { | |
printf("Error: cannot open framebuffer device.\n"); | |
return(1); | |
} | |
printf("The framebuffer device opened.\n"); | |
// Get variable screen information | |
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var_info)) { | |
printf("Error reading variable screen info.\n"); | |
} | |
printf("Display info %dx%d, %d bpp\n", | |
var_info.xres, var_info.yres, | |
var_info.bits_per_pixel ); | |
// close file | |
close(fbfd); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment