当前位置: 技术问答>linux和unix
OV511 调试出了问题,大虾帮忙看看!
来源: 互联网 发布时间:2016-03-15
本文导语: 小弟在学USB驱动,买了一个网眼 V2000的摄像头。在linux2.4.20-8中带有OV511的驱动(ov511.c;ov511.h),我想先用一下是否好用,就改了一个测试程序来看看,结果一运行测试程序,程序就退出了,大虾们帮我简单看看我的...
小弟在学USB驱动,买了一个网眼 V2000的摄像头。在linux2.4.20-8中带有OV511的驱动(ov511.c;ov511.h),我想先用一下是否好用,就改了一个测试程序来看看,结果一运行测试程序,程序就退出了,大虾们帮我简单看看我的测试程序是什么问题啊
[code]
#include "spcav4l.h"
int main (int argc, const char* argv[])
{
char videodevice[] = "/dev/v4l/video0";
char jpegfile[] = "1.bmp";
int grabmethod = 0;
int format = VIDEO_PALETTE_JPEG;
int width = 240;
int height = 320;
int i;
printf("here 3!n");
memset(&videoIn, 0, sizeof (struct vdIn));
if(init_videoIn(&videoIn, videodevice, width, height, format,grabmethod) == 0)
{
printf("init is ok!n");
}
else printf("init is wrong!n");
sleep(2);
printf("here 1!n");
v4lGrab(&videoIn, jpegfile);
sleep(2);
close_v4l (&videoIn);
return 0;
}
[/code]
压缩包里面是程序的全部代码
[code]
#include "spcav4l.h"
int main (int argc, const char* argv[])
{
char videodevice[] = "/dev/v4l/video0";
char jpegfile[] = "1.bmp";
int grabmethod = 0;
int format = VIDEO_PALETTE_JPEG;
int width = 240;
int height = 320;
int i;
printf("here 3!n");
memset(&videoIn, 0, sizeof (struct vdIn));
if(init_videoIn(&videoIn, videodevice, width, height, format,grabmethod) == 0)
{
printf("init is ok!n");
}
else printf("init is wrong!n");
sleep(2);
printf("here 1!n");
v4lGrab(&videoIn, jpegfile);
sleep(2);
close_v4l (&videoIn);
return 0;
}
[/code]
压缩包里面是程序的全部代码
|
What I mean is to add debug codes (such as printf) to see what happens. Or use "strace".