linux的dev中有video,为啥我的/dev/video0打不开!

做视频采集。

由于用的是光盘自带的内核。

加载驱动都弄了挺长时间。

好不容易看见驱动加载好了。

[root@FriendlyARM /]# usb 1-1: new full speed USB device using s3c2410-ohci and address 2

usb 1-1: New USB device found, idVendor=05a9, idProduct=a511

usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0

usb 1-1: configuration #1 chosen from 1 choice

ov511 1-1:1.0: USB OV511+ video device found

usb 1-1: model: Unknown

ov511: Camera type (108) not recognized

ov511: Please notify mark@alpha.dyndns.org of the name,

ov511: manufacturer, model, and this number of your camera.

ov511: Also include the output of the detection process.

usb 1-1: Sensor is an OV7620

ov511 1-1:1.0: Device at usb-s3c24xx-1 registered to minor 0

用的摄像头是OV511

然后运行程序,邪门的是程序就停在open_video函数上面不动,也没有打印信息,好像电脑死机一样停住,ctrl+c也退不出。

下面是我的open_video程序:

#define V4L_FILE "/dev/video0"

int open_video(char *fileptr,fb_v4l *vd,int dep,int pal,

int width,int height)

{

if((vd->fd=open(fileptr,O_RDWR))<0)

{

perror("v4l_open");

return ERR_VIDEO_OPEN;

}

printf("=============Open video success=======\n");

if(ioctl(vd->fd,VIDIOCGCAP,&(vd->capability))<0)

{

perror("v4l_get_capability");

return ERR_VIDEO_GCAP;

}

printf("=============Get device success========\n");

if(ioctl(vd->fd,VIDIOCGPICT,&(vd->picture))<0)

{

perror("v4l_get_picture");

return ERR_VIDEO_GPIC;

}

printf("=============Get picture success==========\n");

vd->picture.palette=pal;

vd->picture.depth=dep;

if(ioctl(vd->fd,VIDIOCSPICT,&(vd->picture))<0)

{ perror("v4l_get_palette");

return ERR_VIDEO_SPIC;}

vd->mmap.format=pal;

vd->mmap.width=width;

vd->mmap.height=height;

vd->mmap.format=vd->picture.palette;

vd->frame_current=0;

vd->frame_using[0]=0;

vd->frame_using[1]=0;

if(ioctl(vd->fd,VIDIOCGMBUF,&(vd->mbuf))<0)

{

perror("v4l_get_buf;");

return -1;

}

vd->map=mmap(0,vd->mbuf.size,PROT_READ|PROT_WRITE,MAP_SHARED,vd->fd,0);

if(vd->map<0)

{perror("v4l_mmap_init:mmap");

return -1;}

printf("The video device was opened successfully.\n");

return 0;

}

现在的问题就是这段程序运行不了。

第一个小的程序段:

if((vd->fd=open(fileptr,O_RDWR))<0)

{

perror("v4l_open");

return ERR_VIDEO_OPEN;

}

printf("=============Open video success=======\n");

这个都执行不了。

求助,为什么我的这个摄像头我不能对其进行操作呢?

希望做过这方面的给个知指导意见。

就是open不了,/dev/video.没有错误信息,就是程序光标停在那里不动。

求解。

这是我第三次发帖,希望不要没人回复。

期待版主降临。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值