From: Laurent Pinchart Date: Tue, 28 Aug 2012 21:38:58 +0000 (-0300) Subject: [media] uvcvideo: Set device_caps in VIDIOC_QUERYCAP X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f887e99ae2210e23c9726b6f146938a84f6acc47;p=openwrt%2Fstaging%2Fblogic.git [media] uvcvideo: Set device_caps in VIDIOC_QUERYCAP Set the capabilities field to global capabilities, and the device_caps field to the video node capabilities. This issue was found by the v4l2-compliance tool. Signed-off-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 5967081747ce..ae24f7d70b03 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1741,6 +1741,11 @@ static int uvc_register_video(struct uvc_device *dev, return ret; } + if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE; + else + stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT; + atomic_inc(&dev->nstreams); return 0; } diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 3bd93736a82a..b1aa55fb8984 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -565,12 +565,14 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); cap->version = LINUX_VERSION_CODE; + cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING + | chain->caps; if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) - cap->capabilities = V4L2_CAP_VIDEO_CAPTURE - | V4L2_CAP_STREAMING; + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE + | V4L2_CAP_STREAMING; else - cap->capabilities = V4L2_CAP_VIDEO_OUTPUT - | V4L2_CAP_STREAMING; + cap->device_caps = V4L2_CAP_VIDEO_OUTPUT + | V4L2_CAP_STREAMING; break; } diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index d83b6baf703a..a6c561f631a0 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -371,6 +371,8 @@ struct uvc_video_chain { struct uvc_entity *selector; /* Selector unit */ struct mutex ctrl_mutex; /* Protects ctrl.info */ + + u32 caps; /* V4L2 chain-wide caps */ }; struct uvc_stats_frame {