Linux摄像头编程小结
转自:http://blog.chinaunix.net/u/7547/showart_122619.html
1.open device:
video_dev = open("\dev\video0",O_RDWR));
2.get the information of the video device
struct video_capability video_cap;
memset(&video_cap,0,sizeof(video_cap));
if(ioctl(video_dev,VIDIOCGCAP,&video_cap) == -1)
{
perror("Cann't get the information of the video device");
close(video_dev);
exit(1);
}
3.get the information of the channels
struct video_channel video_chan;
memset(&video_chan,0,sizeof(video_chan));
for(channel = 0;channel < video_cap.channels;channel++)
{
video_chan.channel = channel;
if(ioctl(video_dev,VIDIOCGCHAN,&video_chan) == -1)
{
perror("Cann't get the information of the channels");
close(video_dev);
exit(3);
}
if(video_chan.type == VIDEO_TYPE_TV)
{
#ifdef DEBUG
printf("NO.%d channel is %s,type is tv!\n",channel,video_chan.name);
#endif
}
if(video_chan.type == VIDEO_TYPE_CAMERA)
相关文档:
转帖自:http://bbs.61job.cn/space/viewspacepost.aspx?postid=4489
在Linux中不管你是做服务器还是只是平常使用,上网肯定都是最重要和不可缺少的一个因素之一,
所以就涉及到它的ip gateway dns等network配置和使用。但是设置linux网络的方法有两种:
第一种:使用命令修改(直接即时生效,重启失效)
&n ......
功能说明:列出目前与过去登入系统的用户相关信息。
语 法:last [-adRx][-f <记录文件>][-n <显示列数>][帐号名称...][终端机编号...]
补充说明:单独执行last指令,它会读取位于/var/log目录下,名称为wtmp的文件,并把该给文件的内容记录的登入系统的用户名单全部显示出来。
参 数:
......
剖析RedHat Linux中三个重要内核文件
作者:mynix 来源:www.linux.org (2007-02-08 13:46:41)
vmlinux是未压缩的内核,vmlinuz是vmlinux的压缩文件。zImage(vmlinuz)和bzImage(vmlinuz)都是用gzip压缩的。它们不仅是一个压缩文件,而且在这两个文件的开头部分内嵌有gzip解压缩代码。bzImage中的b是&ldqu ......
1. 打开串口
与其他的关于设备编程的方法一样,在Linux下,操作、控制串口也是通过操作起设备文件进行的。在Linux下,串口的设备文件是/dev/ttyS0或/dev/ttyS1等。因此要读写串口,我们首先要打开串口:
char *dev = "/dev/ttyS0"; //串口1
int fd = open( dev, O_RDWR );
//| O_NOCT ......