本文介绍了如何直接写入linux framebuffer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何直接写入linux framebuffer?

How to write directly to linux framebuffer?

推荐答案

看FBIOPUT_VSCREENINFO、ioctl和mmap

look at FBIOPUT_VSCREENINFO, ioctl and mmap

(我有代码,但在这台电脑上没有,抱歉)

(I have the code but not at this pc, sorry)

这应该让你开始

  //open file descriptor and get info
inf fdScreen = open( "devicename", O_RDWR );
fb_var_screeninfo varInfo;
ioctl( fdScreen, FBIOGET_VSCREENINFO, &varInfo );

  //set resolution/dpi/color depth/.. in varInfo, then write it back
ioctl( fdScreen, FBIOPUT_VSCREENINFO, &varInfo );

  //get writable screen memory; unsigned short here for 16bit color
unsigned short* display = mmap( 0, nScreenSize,
                                PROT_READ | PROT_WRITE, MAP_SHARED, fdScreen, 0 );

这篇关于如何直接写入linux framebuffer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-31 22:34