summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-10-13 03:52:49 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-11-12 17:00:44 +0200
commit8b9dd1b7fc05d0a7f9c1cd7088ca04fb120b0b51 (patch)
tree986840aa077f3b1df014c5fdc565290db81dc744
parentf77136733b0bce4444b4e4fc852d3fd837d15446 (diff)
isp: v4l2: Fix capabilities parsing
When adding support for device_caps the kernel changed the userspace API and started reporting both output and capture through the capabilities field. Use the device_caps field instead to get the per-device-node capabilities. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--isp/v4l2.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/isp/v4l2.c b/isp/v4l2.c
index be5c604..6f3ffbe 100644
--- a/isp/v4l2.c
+++ b/isp/v4l2.c
@@ -258,6 +258,7 @@ struct v4l2_device *v4l2_open(const char *devname)
{
struct v4l2_device *dev;
struct v4l2_capability cap;
+ __u32 capabilities;
int ret;
dev = malloc(sizeof *dev);
@@ -285,9 +286,17 @@ struct v4l2_device *v4l2_open(const char *devname)
return NULL;
}
- if (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)
+ /* If the device_caps field is set use it, otherwise use the older
+ * capabilities field. We can't rely on the capabilities field
+ * unconditionally as kernels that support device_caps for the omap3isp
+ * driver (>= v3.19) will set both CAPTURE and OUTPUT in the
+ * capabilities field.
+ */
+ capabilities = cap.device_caps ? : cap.capabilities;
+
+ if (capabilities & V4L2_CAP_VIDEO_CAPTURE)
dev->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- else if (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)
+ else if (capabilities & V4L2_CAP_VIDEO_OUTPUT)
dev->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
else {
printf("Error opening device %s: neither video capture "