linux frame buffer grab
linux的驱动就是个字符设备,可以用read write ioctl mmap操作,通过/dev/fbx可以像文件一样直接读写
截屏dd if=/dev/fb0 of=snapshot
恢复cat snapshot > /dev/fb0
开源的有fbgrab工具,不过是生成png文件,我自己写了一个生成bmp文件的工具叫fbcap,录制成avi格式,通过socket或serial把设备的操作发送到host上:)。
保存bmp文件代码:
int savebmp(char* filename, int size, int bmWidth, int bmHeight, int bmBitsPixel, unsigned char* buffer)
{
FILE *fp = NULL;
int j = bmHeight;
int nColors = 0;
int nPeletteLen = 0;
RGBQUAD *rgbquad = NULL;
fp = fopen(filename, "w+");
if(fp == NULL)
{
printf("open file :%s fail\n", filename);
return -1;
}
printf("size=%d, width=%d, height=%d, bitsPixel=%d\n", size, bmWidth, bmHeight, bmBitsPixel);
if (bmBitsPixel <= 8)
{
nColors = bmBitsPixel << 1;
nPeletteLen = nColors * sizeof(RGBQUAD);
rgbquad= malloc(sizeof(RGBQUAD)*nColors);
if (rgbquad == NULL)
{
fclose(fp);
return -1;
}
memset(rgbquad, 0, nColors * sizeof(RGBQUAD));
int index = 0;
for(index = 0; index < nColors; index++)
{
rgbquad[index].rgbBlue = index;
rgbquad[index].rgbGreen = index;
rgbquad[index].rgbRed = index;
}
#if 1
if (bmBitsPixel == 1)//blue word,white backgroud
{
rgbquad[nColors -2].rgbBlue = 255;
rgbquad[nColors -2].rgbGreen = 255;
rgbquad[nColors -2].rgbRed = 255;
rgbquad[nColors -1].rgbBlue = 0xff;
rgbquad[nColors -1].rgbGreen = 0;
rgbquad[nColors -1].rgbRed = 0;
}
#else
if (bmBitsPixel == 1)//white word,black backgroud
{
rgbquad[nColors -2].rgbBlue = 0 ;
rgbquad[nColors -2].rgbGreen = 0;
rgbquad[nColors -2].rgbRed = 0;
rgbquad[nColors -1].rgbBlue =0xFF;
rgbquad[nColors -1].rgbGreen = 0xff;
rgbquad[nColors -1].rgbRed = 0xFF;
}
#endif
}
printf("nColors=%d,pelettelen=%d\n",nColors, nPeletteLen);
//
BITMAPFILEHEADER bfh;
bfh.bfType = ((unsigned short)('M'<< 8)|'B');
bfh.bfRe
相关文档:
本函数的分析很难具体,因为涉及了很多arm的处理器型号和每个型号对应的cache和write buffer的工作方式,这片文章只是做简单的记录,方便以后了解更深后回来再来完善这个函数。
这个函数的调用过程如:start_kernel()->setup_arch()->paging_init()->memtable_init( ......
lsmod(list modules)
功能说明:显示已载入系统的模块。
语 法:lsmod
补充说明:执行lsmod指令,会列出所有已载入系统的模块。Linux操作系统的核心具有模块化的特性,应此在编译核心时,务须把全部的功能都放入核心。您可以将这些功能编译成一个个单独的模块,待需要时再分别载入。
范例:
[root@lin ......
在linux下安装oracle是件繁琐的事情。具体来讲分为一下几大步:
1.修改系统版本
vi /etc/redhat-release
注释掉第一行,添加一行:redhat-4
2.安装软件包
rpm -Uvh setarch-2*
rpm -Uvh make-3*
rpm -Uvh glibc-2*
rpm -Uvh libaio-0*
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh comp ......
方法一: Expect 实现交互
UNIX 窗口中 输入以下命令:
expect ftplinux.txt 10.0.15.22 ftplinux.txt
ftplinux.txt 中内容如下:
--开始-----
spawn ftp [lindex $argv 0]
expect "Name(*):"
send "ftp\r"
expect "Password:*"
send "hell05a\r"
expect "ftp> ......
出处:http://bbs.java.ccidnet.com
挂接命令(mount)
首先,介绍一下挂接(mount)命令的使用方法,mount命令参数非常多,这里主要讲一下今天我们要用到的。
命令格式:
mount [-t vfstype] [-o options] device dir
其中:
1.-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确 ......