首页 > 其他分享 >获取lcd设备分辨率 色深

获取lcd设备分辨率 色深

时间:2024-05-11 19:21:17浏览次数:20  
标签:色深 int 分辨率 flag lcd fb include size

/*******************************************************************
*
*	file name:	get_dev_info.c
*	author	 :  lzj
*	date	 :  2024/05/11
*	function :  获取lcd设备分辨率*色深
* 	note	 :  None
*
*	CopyRight (c)  2023-2024   [email protected]   All Right Reseverd 
*
* *****************************************************************/
#include <sys/ioctl.h>
#include <linux/fb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int Get_Dev_Fbsize()
{
    int size;
    struct fb_var_screeninfo a;
    int fb_flag=open("/dev/fb0",O_RDWR);
    if (-1==fb_flag)
    {
        printf("lcd open faile");
    }
    ioctl(fb_flag,FBIOGET_VSCREENINFO,&a);
    size=(a.xres * a.yres * a.bits_per_pixel)/8;
    close(fb_flag);
    return size;
}
int main(int argc, char const *argv[])
{
    printf("%d\n",Get_Dev_Fbsize());
    return 0;
}

标签:色深,int,分辨率,flag,lcd,fb,include,size
From: https://www.cnblogs.com/lzj-ZJ/p/18187062

相关文章