libcamera: v4l2_subdevice: Enable streams API when supported
The streams API needs to be enabled explictly by setting a subdev client capability. Do so unconditionally for subdevs that expose streams support. We don't need any kernel version check to use the VIDIOC_SUBDEV_S_CLIENT_CAP ioctl, as it is guaranteed to be supported by kernels that support streams. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -359,6 +359,21 @@ int V4L2Subdevice::open()
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* If the subdev supports streams, enable the streams API. */
|
||||
if (caps_.hasStreams()) {
|
||||
struct v4l2_subdev_client_capability clientCaps{};
|
||||
clientCaps.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS;
|
||||
|
||||
ret = ioctl(VIDIOC_SUBDEV_S_CLIENT_CAP, &clientCaps);
|
||||
if (ret < 0) {
|
||||
ret = -errno;
|
||||
LOG(V4L2, Error)
|
||||
<< "Unable to set client capabilities: "
|
||||
<< strerror(-ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user