]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
media: uvcvideo: Report V4L2 device caps through the video_device structure
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 4 Dec 2017 23:06:01 +0000 (18:06 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 4 Jan 2018 11:37:58 +0000 (06:37 -0500)
The V4L2 core populates the struct v4l2_capability device_caps field
from the same field in video_device. There's no need to handle that
manually in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Tested-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvc_v4l2.c

index f6fbfc122871b2623e8de07c67c27d6ef2753694..d63458539e032211d9f8b5e7b09e8c814cc9bdd6 100644 (file)
@@ -1921,6 +1921,17 @@ int uvc_register_video_device(struct uvc_device *dev,
                vdev->vfl_dir = VFL_DIR_TX;
        else
                vdev->vfl_dir = VFL_DIR_RX;
+
+       switch (type) {
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+       default:
+               vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+               break;
+       case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+               vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+               break;
+       }
+
        strlcpy(vdev->name, dev->name, sizeof vdev->name);
 
        /*
index 3e7e283a44a8e9adfd23e24f0b13bcd8cc6527d9..5e03239825772988545ac2455b714dda9f228a6e 100644 (file)
@@ -568,10 +568,6 @@ static int uvc_ioctl_querycap(struct file *file, void *fh,
        usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));
        cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
                          | chain->caps;
-       if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-               cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
-       else
-               cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
 
        return 0;
 }