test-wgo.c
来自「华邦的W996[78]cf芯片组的摄象头驱动程序」· C语言 代码 · 共 47 行
C
47 行
/* Test for driver WebCam GO */#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <fcntl.h>#include <stdlib.h>#include <videodev.h>int main() { int f,f0; char buf[355*288]; if ( (f0=open("prova.yuv",O_RDWR | O_CREAT)) == -1) { printf("Cannot-open tmpfilen"); return -1; } printf("Testing device open ... "); if ( (f = open("/dev/video",O_RDWR)) == -1) { printf("Cannot-open /dev/video\n"); return -1; } /* Sleep a while */ sleep(2); /* Read some data and write to file */ read(f,buf,355*288); write(f0,buf,355*288); sleep(2); close(f0); printf("Testing device close ...\n"); close(f); printf("Ok!!!"); return 1;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?