VIDIOC_QUERYCAP:设备的 ioctl 不合适

问题描述

我正在尝试使用 v4l2 库编写自己的代码,但是当我尝试从相机获取功能时,我的代码总是出错。但是我拥有的其他代码做同样的事情根本不会崩溃。有谁知道为什么?

我的代码

int fd;
if((fd = open("/dev/video0",O_RDWR)) < 0){
    perror("Couldn't open camera");
    return 1;
}

//getting the camera's capabilities
v4l2_capability cap;
if(ioctl(fd,VIdioC_QUERYCAP,&cap) < 0){
    perror("Can't get the camera's capabilites");
    return 1;
}

其他人的代码

int fd; // A file descriptor to the video device
if((fd = open("/dev/video0",O_RDWR)) < 0){
    perror("Failed to open device,OPEN");
    return 1;
}


// 2. Ask the device if it can capture frames
v4l2_capability cap;
if(ioctl(fd,&cap) < 0){
    // something went wrong... exit
    perror("Failed to get device capabilities,VIdioC_QUERYCAP");
    return 1;
}

这是错误: VIdioC_QUERYCAP:设备的 ioctl 不合适

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)