V4L2_CID_FOCUS_AUTO is not supported.

asked 2016-09-07 06:23:58 -0500

pedro_abreu gravatar image

Whenever I run the default test file from the usb_cam package and use a recent bought camera I get the two following statements: V4L2_CID_FOCUS_AUTO is not supported. [WARNING] unknown control focus_auto

I have already found that the driver source has a block of code regarding the autofocus, but I do not getwhat the unknown control message means. I've tried setting the parameter autofocus to false as explained in the usb_cam documentation, but it didn't seem to work. It seems like I should edit the driver source code but I'm not sure how... (the part I'm talking about):

void UsbCam::set_auto_focus(int value){
struct v4l2_queryctrl queryctrl;
struct v4l2_ext_control control;

memset(&queryctrl, 0, sizeof(queryctrl));
queryctrl.id = V4L2_CID_FOCUS_AUTO;

if (-1 == xioctl(fd_, VIDIOC_QUERYCTRL, &queryctrl))
{
  if (errno != EINVAL)
  {
     perror("VIDIOC_QUERYCTRL");
     return;
  }
  else
  {
  //ROS_INFO("V4L2_CID_FOCUS_AUTO is not supported");
  return;
   }
 }
 else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
 {
    //ROS_INFO("V4L2_CID_FOCUS_AUTO is not supported");
  return;
 }
 else
 {
   memset(&control, 0, sizeof(control));
   control.id = V4L2_CID_FOCUS_AUTO;
   control.value = value;

   if (-1 == xioctl(fd_, VIDIOC_S_CTRL, &control))
   {
     perror("VIDIOC_S_CTRL");
  return;
}

} }

edit retag flag offensive close merge delete