易截截图软件、单文件、免安装、纯绿色、仅160KB

linux下的framebuffer的例子(转)

例子实现了直接写屏的功能,即把屏幕清空(变黑),程序的流程大致为:打开一个FrameBuffer设备;通过mmap调用把显卡的物理内存空间映射到用户空间;通过映射关系直接写内存。
头文件
////////////////////////////////////////
///////////// fbtools.h ////////////////
////////////////////////////////////////
#ifndef _FBTOOLS_H_
#define _FBTOOLS_H_
#include <linux/fb.h>
//a framebuffer device structure;
typedef struct fbdev
{
int fb;
unsigned long fb_mem_offset;
unsigned long fb_mem;
struct fb_fix_screeninfo fb_fix;
struct fb_var_screeninfo fb_var;
char dev[20];
} FBDEV, *PFBDEV;
//open & init a frame buffer
//to use this function,
//you must set FBDEV.dev="/dev/fb0"
//or "/dev/fbX"
//it's your frame buffer.
int fb_open(PFBDEV pFbdev);
//close a frame buffer
int fb_close(PFBDEV pFbdev);
//get display depth
int get_display_depth(PFBDEV pFbdev);
//full screen clear
void fb_memset(void *addr, int c, size_t len);
#endif
测试文件,其中深颜色的注释部分为在我机器上测得的结果
///////////////////////////////////////////
///////////////  fbtools.c  ///////////////
///////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <asm/page.h>
#include "fbtools.h"
#define TRUE 1
#define FALSE 0
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
//open & init a frame buffer
int fb_open(PFBDEV pFbdev)
{
pFbdev->fb = open(pFbdev->dev, O_RDWR);// pFbdev->fb==3
if(pFbdev->fb < 0)
{
printf("Error opening %s: %m. Check kernel config
", pFbdev->dev);
return FALSE;
}
if (-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
{
printf("ioctl FBIOGET_VSCRE


相关文档:

Linux设备模型之input子系统详解

一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......

linux系统下jdk1.6.0_18的安装

1.下载相应的jdk软件
    下载地址 http://java.sun.com/javase/downloads/index.jsp
     我下载的是 jdk-6u18-linux-i586.bin
2. 拷贝到linux服务器的安装目录下
     我的安装目录是/var/spool/servers/,进入到该目录/var/spool/servers/
  &nb ......

LINUX 部分性能参数列表

1. /proc/sys/net/core/rmem_max — 最大的TCP数据接收缓冲
2. /proc/sys/net/core/wmem_max — 最大的TCP数据发送缓冲
3. /proc/sys/net/ipv4/tcp_timestamps — 时间戳在(请参考RFC 1323)TCP的包头增加12个字节
4. /proc/sys/net/ipv4/tcp_sack — 有选择的应答
5. /proc/sys/net/ipv4/tcp_windo ......

linux 站点

www.csdn.net
www.linux.org
www.chinaunix.net
http://www.loveunix.net/
http://www.linuxsir.org/main/
http://www.linuxforum.net/
http://www.codeproject.com/
http://www.codeplex.com/
http://sourceforge.net/
python:
http://www.python.org/
agile:
http://www.thoughtworks.com/ ......

Linux中的动态链接库与静态链接库

静态链接库是以.a结尾的文件,一般是用工具将多个.o文件合并到一起组成静态库
动态链接库是以.so结尾的文件,和windows下的dll文件类似。
静态链接库都可以在程序编译过程中用 -L参数来指定他们 -L/opt/lib/XXX.a
动态链接库一般是在LD_LIBRARY_PATH中来指定搜索路径,也可以在 -L/opt/lib 后面加一个 lXX,对应了lib中的XX. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号