v4l2: Also handle the new ENOENT return value of VIDIOC_QUERYCTRL
[platform/upstream/gst-plugins-good.git] / sys / v4l2 / v4l2_calls.c
index 74b2e0a..07d390a 100644 (file)
@@ -17,8 +17,8 @@
  *
  * You should have received a copy of the GNU Library General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -129,7 +129,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
 
     input.index = n;
     if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUMINPUT, &input) < 0) {
-      if (errno == EINVAL)
+      if (errno == EINVAL || errno == ENOTTY)
         break;                  /* end of enumeration */
       else {
         GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
@@ -145,7 +145,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
     GST_LOG_OBJECT (e, "   name:      '%s'", input.name);
     GST_LOG_OBJECT (e, "   type:      %08x", input.type);
     GST_LOG_OBJECT (e, "   audioset:  %08x", input.audioset);
-    GST_LOG_OBJECT (e, "   std:       %016x", (guint) input.std);
+    GST_LOG_OBJECT (e, "   std:       %016" G_GINT64_MODIFIER "x", input.std);
     GST_LOG_OBJECT (e, "   status:    %08x", input.status);
 
     v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL);
@@ -250,7 +250,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
 
     control.id = n;
     if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCTRL, &control) < 0) {
-      if (errno == EINVAL) {
+      if (errno == EINVAL || errno == ENOTTY || errno == EIO || errno == ENOENT) {
         if (n < V4L2_CID_PRIVATE_BASE) {
           GST_DEBUG_OBJECT (e, "skipping control %08x", n);
           /* continue so that we also check private controls */
@@ -260,12 +260,9 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
           break;
         }
       } else {
-        GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS,
-            (_("Failed getting controls attributes on device '%s'."),
-                v4l2object->videodev),
-            ("Failed querying control %d on device '%s'. (%d - %s)",
-                n, v4l2object->videodev, errno, strerror (errno)));
-        return FALSE;
+        GST_WARNING_OBJECT (e, "Failed querying control %d on device '%s'. "
+            "(%d - %s)", n, v4l2object->videodev, errno, strerror (errno));
+        continue;
       }
     }
     if (control.flags & V4L2_CTRL_FLAG_DISABLED) {